mcdex 0.1.0.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mcdex/__init__.py +281 -0
- mcdex/advancements/__init__.py +16 -0
- mcdex/advancements/_mc_advancements.py +3558 -0
- mcdex/advancements/advancements.json +12101 -0
- mcdex/attributes/__init__.py +16 -0
- mcdex/attributes/_mc_attributes.py +83 -0
- mcdex/attributes/attributes.json +289 -0
- mcdex/banner_patterns/__init__.py +16 -0
- mcdex/banner_patterns/_mc_banner_patterns.py +86 -0
- mcdex/banner_patterns/banner_patterns.json +310 -0
- mcdex/base/__init__.py +146 -0
- mcdex/base/_advancement_id.py +22 -0
- mcdex/base/_attribute_id.py +22 -0
- mcdex/base/_banner_pattern_id.py +26 -0
- mcdex/base/_biome_id.py +22 -0
- mcdex/base/_block_entity_id.py +22 -0
- mcdex/base/_block_id.py +35 -0
- mcdex/base/_cat_sound_variant_id.py +23 -0
- mcdex/base/_cat_variant_id.py +22 -0
- mcdex/base/_catalogue_meta.py +38 -0
- mcdex/base/_chicken_sound_variant_id.py +23 -0
- mcdex/base/_chicken_variant_id.py +23 -0
- mcdex/base/_cow_sound_variant_id.py +23 -0
- mcdex/base/_cow_variant_id.py +22 -0
- mcdex/base/_damage_type_id.py +21 -0
- mcdex/base/_dimension_id.py +21 -0
- mcdex/base/_effect_id.py +21 -0
- mcdex/base/_enchantment_id.py +22 -0
- mcdex/base/_entity_id.py +35 -0
- mcdex/base/_equipment_slot.py +34 -0
- mcdex/base/_frog_variant_id.py +22 -0
- mcdex/base/_game_id.py +88 -0
- mcdex/base/_game_rule_id.py +21 -0
- mcdex/base/_item_id.py +98 -0
- mcdex/base/_mc_thing.py +289 -0
- mcdex/base/_mc_version.py +140 -0
- mcdex/base/_music_id.py +25 -0
- mcdex/base/_not_in_version.py +68 -0
- mcdex/base/_painting_variant_id.py +23 -0
- mcdex/base/_particle_id.py +21 -0
- mcdex/base/_pig_sound_variant_id.py +23 -0
- mcdex/base/_pig_variant_id.py +22 -0
- mcdex/base/_potion_id.py +25 -0
- mcdex/base/_potion_modifier.py +30 -0
- mcdex/base/_sound_id.py +21 -0
- mcdex/base/_statistic_id.py +22 -0
- mcdex/base/_structure_id.py +21 -0
- mcdex/base/_trim_material_id.py +26 -0
- mcdex/base/_trim_pattern_id.py +25 -0
- mcdex/base/_version.py +188 -0
- mcdex/base/_villager_profession_id.py +24 -0
- mcdex/base/_villager_type_id.py +25 -0
- mcdex/base/_wolf_sound_variant_id.py +23 -0
- mcdex/base/_wolf_variant_id.py +22 -0
- mcdex/base/_zombie_nautilus_variant_id.py +23 -0
- mcdex/biomes/__init__.py +16 -0
- mcdex/biomes/_mc_biomes.py +137 -0
- mcdex/biomes/biomes.json +652 -0
- mcdex/block_entities/__init__.py +16 -0
- mcdex/block_entities/_mc_block_entities.py +95 -0
- mcdex/block_entities/block_entities.json +331 -0
- mcdex/blocks/__init__.py +16 -0
- mcdex/blocks/_mc_blocks.py +1338 -0
- mcdex/blocks/blocks.json +7770 -0
- mcdex/cat_sound_variants/__init__.py +16 -0
- mcdex/cat_sound_variants/_mc_cat_sound_variants.py +47 -0
- mcdex/cat_sound_variants/cat_sound_variants.json +25 -0
- mcdex/cat_variants/__init__.py +16 -0
- mcdex/cat_variants/_mc_cat_variants.py +54 -0
- mcdex/cat_variants/cat_variants.json +91 -0
- mcdex/chicken_sound_variants/__init__.py +17 -0
- mcdex/chicken_sound_variants/_mc_chicken_sound_variants.py +48 -0
- mcdex/chicken_sound_variants/chicken_sound_variants.json +24 -0
- mcdex/chicken_variants/__init__.py +16 -0
- mcdex/chicken_variants/_mc_chicken_variants.py +47 -0
- mcdex/chicken_variants/chicken_variants.json +30 -0
- mcdex/cow_sound_variants/__init__.py +16 -0
- mcdex/cow_sound_variants/_mc_cow_sound_variants.py +47 -0
- mcdex/cow_sound_variants/cow_sound_variants.json +24 -0
- mcdex/cow_variants/__init__.py +16 -0
- mcdex/cow_variants/_mc_cow_variants.py +47 -0
- mcdex/cow_variants/cow_variants.json +30 -0
- mcdex/damage_types/__init__.py +16 -0
- mcdex/damage_types/_mc_damage_types.py +94 -0
- mcdex/damage_types/damage_types.json +317 -0
- mcdex/dimensions/__init__.py +16 -0
- mcdex/dimensions/_mc_dimensions.py +46 -0
- mcdex/dimensions/dimensions.json +29 -0
- mcdex/effects/__init__.py +16 -0
- mcdex/effects/_mc_effects.py +83 -0
- mcdex/effects/effects.json +251 -0
- mcdex/enchantments/__init__.py +16 -0
- mcdex/enchantments/_mc_enchantments.py +86 -0
- mcdex/enchantments/enchantments.json +270 -0
- mcdex/entities/__init__.py +16 -0
- mcdex/entities/_mc_entities.py +206 -0
- mcdex/entities/entities.json +1042 -0
- mcdex/frog_variants/__init__.py +16 -0
- mcdex/frog_variants/_mc_frog_variants.py +47 -0
- mcdex/frog_variants/frog_variants.json +29 -0
- mcdex/game_rules/__init__.py +16 -0
- mcdex/game_rules/_mc_game_rules.py +110 -0
- mcdex/game_rules/game_rules.json +436 -0
- mcdex/items/__init__.py +16 -0
- mcdex/items/_mc_items.py +1842 -0
- mcdex/items/items.json +20060 -0
- mcdex/music/__init__.py +16 -0
- mcdex/music/_music.py +65 -0
- mcdex/music/music.json +143 -0
- mcdex/painting_variants/__init__.py +16 -0
- mcdex/painting_variants/_mc_painting_variants.py +96 -0
- mcdex/painting_variants/painting_variants.json +369 -0
- mcdex/particles/__init__.py +16 -0
- mcdex/particles/_mc_particles.py +184 -0
- mcdex/particles/particles.json +917 -0
- mcdex/pig_sound_variants/__init__.py +16 -0
- mcdex/pig_sound_variants/_mc_pig_sound_variants.py +48 -0
- mcdex/pig_sound_variants/pig_sound_variants.json +30 -0
- mcdex/pig_variants/__init__.py +16 -0
- mcdex/pig_variants/_mc_pig_variants.py +46 -0
- mcdex/pig_variants/pig_variants.json +30 -0
- mcdex/potions/__init__.py +20 -0
- mcdex/potions/_mc_potions.py +101 -0
- mcdex/potions/_modified_potion.py +129 -0
- mcdex/potions/potions.json +297 -0
- mcdex/py.typed +0 -0
- mcdex/sounds/__init__.py +16 -0
- mcdex/sounds/_mc_sounds.py +2395 -0
- mcdex/sounds/sounds.json +13077 -0
- mcdex/statistics/__init__.py +16 -0
- mcdex/statistics/_mc_statistics.py +123 -0
- mcdex/statistics/statistics.json +521 -0
- mcdex/structures/__init__.py +16 -0
- mcdex/structures/_mc_structures.py +99 -0
- mcdex/structures/structures.json +367 -0
- mcdex/trim_materials/__init__.py +16 -0
- mcdex/trim_materials/_mc_trim_materials.py +54 -0
- mcdex/trim_materials/trim_materials.json +77 -0
- mcdex/trim_patterns/__init__.py +16 -0
- mcdex/trim_patterns/_mc_trim_patterns.py +61 -0
- mcdex/trim_patterns/trim_patterns.json +119 -0
- mcdex/villager_professions/__init__.py +17 -0
- mcdex/villager_professions/_mc_villager_professions.py +61 -0
- mcdex/villager_professions/villager_professions.json +125 -0
- mcdex/villager_types/__init__.py +16 -0
- mcdex/villager_types/_mc_villager_types.py +52 -0
- mcdex/villager_types/villager_types.json +54 -0
- mcdex/wolf_sound_variants/__init__.py +17 -0
- mcdex/wolf_sound_variants/_mc_wolf_sound_variants.py +53 -0
- mcdex/wolf_sound_variants/wolf_sound_variants.json +54 -0
- mcdex/wolf_variants/__init__.py +16 -0
- mcdex/wolf_variants/_mc_wolf_variants.py +53 -0
- mcdex/wolf_variants/wolf_variants.json +66 -0
- mcdex/zombie_nautilus_variants/__init__.py +17 -0
- mcdex/zombie_nautilus_variants/_mc_zombie_nautilus_variants.py +48 -0
- mcdex/zombie_nautilus_variants/zombie_nautilus_variants.json +23 -0
- mcdex-0.1.0.dev0.dist-info/METADATA +1285 -0
- mcdex-0.1.0.dev0.dist-info/RECORD +161 -0
- mcdex-0.1.0.dev0.dist-info/WHEEL +5 -0
- mcdex-0.1.0.dev0.dist-info/licenses/LICENSE +201 -0
- mcdex-0.1.0.dev0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The 'mcdex.pig_sound_variants' package provides the pig sound variants of the
|
|
3
|
+
game: the 'MCPigSoundVariants' catalogue, an enumeration of every pig sound
|
|
4
|
+
variant of the data file 'pig_sound_variants.json' that ships with the package.
|
|
5
|
+
|
|
6
|
+
- MCPigSoundVariants
|
|
7
|
+
"""
|
|
8
|
+
# Apache-2.0 license
|
|
9
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from ._mc_pig_sound_variants import MCPigSoundVariants
|
|
13
|
+
|
|
14
|
+
__all__ = (
|
|
15
|
+
'MCPigSoundVariants',
|
|
16
|
+
)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MCPigSoundVariants is the catalogue of the game's pig sound variants: an
|
|
3
|
+
enumeration with one member for every pig sound variant of the data file that
|
|
4
|
+
ships with mcdex, each the same pig sound variant in every version, with the id
|
|
5
|
+
each version knows it by: what /summon takes for a pig of that sound variant.
|
|
6
|
+
"""
|
|
7
|
+
# Apache-2.0 license
|
|
8
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from worktoy.keenum import Kee
|
|
12
|
+
|
|
13
|
+
from ..base import MCThing, PigSoundVariantId
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class MCPigSoundVariants(MCThing):
|
|
17
|
+
"""
|
|
18
|
+
The catalogue of the game's pig sound variants, each a member, found by its
|
|
19
|
+
name in capitals, in any case, or by its unique name:
|
|
20
|
+
|
|
21
|
+
mini = MCPigSoundVariants.MINI
|
|
22
|
+
mini is MCPigSoundVariants['mini'] # True
|
|
23
|
+
mini['26.1']
|
|
24
|
+
# PigSoundVariantId('mini',
|
|
25
|
+
# 'minecraft:pig{sound_variant:"minecraft:mini"}')
|
|
26
|
+
len(MCPigSoundVariants)
|
|
27
|
+
|
|
28
|
+
Implementation
|
|
29
|
+
--------------
|
|
30
|
+
|
|
31
|
+
All of it is 'MCThing's, reading 'pig_sound_variants.json' beside this
|
|
32
|
+
module. mcdex's tools write the members, one for every name of that file.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
36
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
37
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
38
|
+
|
|
39
|
+
# Class Variables
|
|
40
|
+
__data_file__ = 'pig_sound_variants.json'
|
|
41
|
+
__data_key__ = 'pig_sound_variants'
|
|
42
|
+
__id_class__ = PigSoundVariantId
|
|
43
|
+
__kind__ = 'pig sound variant'
|
|
44
|
+
|
|
45
|
+
# Members, one for every name of 'pig_sound_variants.json'
|
|
46
|
+
BIG = Kee[str]('big')
|
|
47
|
+
CLASSIC = Kee[str]('classic')
|
|
48
|
+
MINI = Kee[str]('mini')
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"covers": [
|
|
3
|
+
"1.7.2",
|
|
4
|
+
"26.3"
|
|
5
|
+
],
|
|
6
|
+
"legend": {
|
|
7
|
+
"": "vanilla has no such pig sound variant in this version"
|
|
8
|
+
},
|
|
9
|
+
"pig_sound_variants": {
|
|
10
|
+
"big": {
|
|
11
|
+
"ids": {
|
|
12
|
+
"1.7.2": "",
|
|
13
|
+
"26.1": "minecraft:pig{sound_variant:\"minecraft:big\"}"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"classic": {
|
|
17
|
+
"ids": {
|
|
18
|
+
"1.7.2": "Pig",
|
|
19
|
+
"1.11": "minecraft:pig",
|
|
20
|
+
"26.1": "minecraft:pig{sound_variant:\"minecraft:classic\"}"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"mini": {
|
|
24
|
+
"ids": {
|
|
25
|
+
"1.7.2": "",
|
|
26
|
+
"26.1": "minecraft:pig{sound_variant:\"minecraft:mini\"}"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The 'mcdex.pig_variants' package provides the pig variants of the game: the
|
|
3
|
+
'MCPigVariants' catalogue, an enumeration of every pig variant of the data file
|
|
4
|
+
'pig_variants.json' that ships with the package.
|
|
5
|
+
|
|
6
|
+
- MCPigVariants
|
|
7
|
+
"""
|
|
8
|
+
# Apache-2.0 license
|
|
9
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from ._mc_pig_variants import MCPigVariants
|
|
13
|
+
|
|
14
|
+
__all__ = (
|
|
15
|
+
'MCPigVariants',
|
|
16
|
+
)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MCPigVariants is the catalogue of the game's pig variants: an enumeration with
|
|
3
|
+
one member for every pig variant of the data file that ships with mcdex, each
|
|
4
|
+
the same pig variant in every version, with the id each version knows it by:
|
|
5
|
+
what /summon takes for a pig of that variant.
|
|
6
|
+
"""
|
|
7
|
+
# Apache-2.0 license
|
|
8
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from worktoy.keenum import Kee
|
|
12
|
+
|
|
13
|
+
from ..base import MCThing, PigVariantId
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class MCPigVariants(MCThing):
|
|
17
|
+
"""
|
|
18
|
+
The catalogue of the game's pig variants, each a member, found by its name in
|
|
19
|
+
capitals, in any case, or by its unique name:
|
|
20
|
+
|
|
21
|
+
temperate = MCPigVariants.TEMPERATE
|
|
22
|
+
temperate is MCPigVariants['temperate'] # True
|
|
23
|
+
temperate['1.12.2'] # PigVariantId('temperate', 'minecraft:pig')
|
|
24
|
+
len(MCPigVariants)
|
|
25
|
+
|
|
26
|
+
Implementation
|
|
27
|
+
--------------
|
|
28
|
+
|
|
29
|
+
All of it is 'MCThing's, reading 'pig_variants.json' beside this module.
|
|
30
|
+
mcdex's tools write the members, one for every name of that file.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
34
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
35
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
36
|
+
|
|
37
|
+
# Class Variables
|
|
38
|
+
__data_file__ = 'pig_variants.json'
|
|
39
|
+
__data_key__ = 'pig_variants'
|
|
40
|
+
__id_class__ = PigVariantId
|
|
41
|
+
__kind__ = 'pig variant'
|
|
42
|
+
|
|
43
|
+
# Members, one for every name of 'pig_variants.json'
|
|
44
|
+
COLD = Kee[str]('cold')
|
|
45
|
+
TEMPERATE = Kee[str]('temperate')
|
|
46
|
+
WARM = Kee[str]('warm')
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"covers": [
|
|
3
|
+
"1.7.2",
|
|
4
|
+
"26.3"
|
|
5
|
+
],
|
|
6
|
+
"legend": {
|
|
7
|
+
"": "vanilla has no such pig variant in this version"
|
|
8
|
+
},
|
|
9
|
+
"pig_variants": {
|
|
10
|
+
"cold": {
|
|
11
|
+
"ids": {
|
|
12
|
+
"1.7.2": "",
|
|
13
|
+
"1.21.5": "minecraft:pig{variant:\"minecraft:cold\"}"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"temperate": {
|
|
17
|
+
"ids": {
|
|
18
|
+
"1.7.2": "Pig",
|
|
19
|
+
"1.11": "minecraft:pig",
|
|
20
|
+
"1.21.5": "minecraft:pig{variant:\"minecraft:temperate\"}"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"warm": {
|
|
24
|
+
"ids": {
|
|
25
|
+
"1.7.2": "",
|
|
26
|
+
"1.21.5": "minecraft:pig{variant:\"minecraft:warm\"}"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The 'mcdex.potions' package provides the potions of the game: the 'MCPotions'
|
|
3
|
+
catalogue, an enumeration of every potion of the data file 'potions.json' that
|
|
4
|
+
ships with the package; and the 'ModifiedPotion', a long or a strong potion,
|
|
5
|
+
which the catalogue gives for a base potion with a modifier.
|
|
6
|
+
|
|
7
|
+
- MCPotions
|
|
8
|
+
- ModifiedPotion
|
|
9
|
+
"""
|
|
10
|
+
# Apache-2.0 license
|
|
11
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
from ._modified_potion import ModifiedPotion
|
|
15
|
+
from ._mc_potions import MCPotions
|
|
16
|
+
|
|
17
|
+
__all__ = (
|
|
18
|
+
'MCPotions',
|
|
19
|
+
'ModifiedPotion',
|
|
20
|
+
)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"""
|
|
2
|
+
MCPotions is the catalogue of the game's potions: an enumeration with one
|
|
3
|
+
member for every potion of the data file that ships with mcdex, each the same
|
|
4
|
+
potion in every version, with the id each version knows it by: the potion an
|
|
5
|
+
item is made with: from 1.9 its name, before it the potion item's damage value.
|
|
6
|
+
"""
|
|
7
|
+
# Apache-2.0 license
|
|
8
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from typing import TYPE_CHECKING
|
|
12
|
+
|
|
13
|
+
from worktoy.keenum import Kee
|
|
14
|
+
|
|
15
|
+
from ..base import MCThing, PotionId, PotionModifier
|
|
16
|
+
from ._modified_potion import ModifiedPotion
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
19
|
+
from typing import Any
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class MCPotions(MCThing):
|
|
23
|
+
"""
|
|
24
|
+
The catalogue of the game's potions, each a member, found by its name in
|
|
25
|
+
capitals, in any case, or by its unique name:
|
|
26
|
+
|
|
27
|
+
swiftness = MCPotions.SWIFTNESS
|
|
28
|
+
swiftness is MCPotions['swiftness'] # True
|
|
29
|
+
swiftness['1.8.9'] # PotionId('swiftness', '2')
|
|
30
|
+
len(MCPotions)
|
|
31
|
+
|
|
32
|
+
Implementation
|
|
33
|
+
--------------
|
|
34
|
+
|
|
35
|
+
All of it is 'MCThing's, reading 'potions.json' beside this module.
|
|
36
|
+
mcdex's tools write the members, one for every name of that file.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
40
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
41
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
42
|
+
|
|
43
|
+
# Class Variables
|
|
44
|
+
__data_file__ = 'potions.json'
|
|
45
|
+
__data_key__ = 'potions'
|
|
46
|
+
__id_class__ = PotionId
|
|
47
|
+
__kind__ = 'potion'
|
|
48
|
+
|
|
49
|
+
# Private Variables
|
|
50
|
+
__modified_potions__: dict = {}
|
|
51
|
+
|
|
52
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
53
|
+
# Python API # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
54
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def __class_resolve__(cls, identifier: Any) -> Any:
|
|
58
|
+
"""
|
|
59
|
+
A potion by its unique name, as in any catalogue; or a base potion
|
|
60
|
+
with a modifier, 'MCPotions[MCPotions.NIGHT_VISION,
|
|
61
|
+
PotionModifier.LONG]' or 'MCPotions["night_vision", "long"]': the
|
|
62
|
+
long or strong potion, a 'ModifiedPotion', the same object every
|
|
63
|
+
time. A base potion the game has no such potion of raises 'KeyError'.
|
|
64
|
+
"""
|
|
65
|
+
if not isinstance(identifier, tuple) or len(identifier) != 2:
|
|
66
|
+
return super().__class_resolve__(identifier)
|
|
67
|
+
base, modifier = cls(identifier[0]), PotionModifier(identifier[1])
|
|
68
|
+
key = (base.name, modifier.name)
|
|
69
|
+
if key not in cls.__modified_potions__:
|
|
70
|
+
if modifier.value not in base._record():
|
|
71
|
+
infoSpec = """mcdex has no %s %s potion"""
|
|
72
|
+
raise KeyError(infoSpec % (modifier.value, base.uniqueName))
|
|
73
|
+
cls.__modified_potions__[key] = ModifiedPotion(base, modifier)
|
|
74
|
+
return cls.__modified_potions__[key]
|
|
75
|
+
|
|
76
|
+
# Members, one for every name of 'potions.json'
|
|
77
|
+
AWKWARD = Kee[str]('awkward')
|
|
78
|
+
EMPTY = Kee[str]('empty')
|
|
79
|
+
FIRE_RESISTANCE = Kee[str]('fire_resistance')
|
|
80
|
+
HARMING = Kee[str]('harming')
|
|
81
|
+
HEALING = Kee[str]('healing')
|
|
82
|
+
INFESTED = Kee[str]('infested')
|
|
83
|
+
INVISIBILITY = Kee[str]('invisibility')
|
|
84
|
+
LEAPING = Kee[str]('leaping')
|
|
85
|
+
LUCK = Kee[str]('luck')
|
|
86
|
+
MUNDANE = Kee[str]('mundane')
|
|
87
|
+
NIGHT_VISION = Kee[str]('night_vision')
|
|
88
|
+
OOZING = Kee[str]('oozing')
|
|
89
|
+
POISON = Kee[str]('poison')
|
|
90
|
+
REGENERATION = Kee[str]('regeneration')
|
|
91
|
+
SLOW_FALLING = Kee[str]('slow_falling')
|
|
92
|
+
SLOWNESS = Kee[str]('slowness')
|
|
93
|
+
STRENGTH = Kee[str]('strength')
|
|
94
|
+
SWIFTNESS = Kee[str]('swiftness')
|
|
95
|
+
THICK = Kee[str]('thick')
|
|
96
|
+
TURTLE_MASTER = Kee[str]('turtle_master')
|
|
97
|
+
WATER = Kee[str]('water')
|
|
98
|
+
WATER_BREATHING = Kee[str]('water_breathing')
|
|
99
|
+
WEAKNESS = Kee[str]('weakness')
|
|
100
|
+
WEAVING = Kee[str]('weaving')
|
|
101
|
+
WIND_CHARGED = Kee[str]('wind_charged')
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ModifiedPotion is a long or a strong potion: a base potion of
|
|
3
|
+
'MCPotions' with a 'PotionModifier', and the id each version knows it by.
|
|
4
|
+
"""
|
|
5
|
+
# Apache-2.0 license
|
|
6
|
+
# Copyright (c) 2026 Asger Jon Vistisen
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import TYPE_CHECKING
|
|
10
|
+
|
|
11
|
+
from worktoy.desc import Field, FixBox
|
|
12
|
+
from worktoy.mcls import BaseObject
|
|
13
|
+
|
|
14
|
+
from ..base import MCThing, NotInVersion, PotionId, PotionModifier, Version
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING: # pragma: no cover, no mutate
|
|
17
|
+
from typing import Any, TypeAlias
|
|
18
|
+
|
|
19
|
+
VersionIds: TypeAlias = dict[Version, str]
|
|
20
|
+
Changes: TypeAlias = tuple[tuple[int, str], ...]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ModifiedPotion(BaseObject):
|
|
24
|
+
"""
|
|
25
|
+
A long or a strong potion is its base potion with a modifier, as the
|
|
26
|
+
game makes it, and has an id of its own in each version: the long
|
|
27
|
+
night vision is 'minecraft:long_night_vision' in 1.12.2 and '70' in
|
|
28
|
+
1.8.9, the night vision's 6 with the bit for long. 'MCPotions' gives
|
|
29
|
+
it, the same object every time:
|
|
30
|
+
|
|
31
|
+
longNightVision = MCPotions[MCPotions.NIGHT_VISION, PotionModifier.LONG]
|
|
32
|
+
longNightVision['1.12.2']
|
|
33
|
+
# PotionId('night_vision', 'minecraft:long_night_vision')
|
|
34
|
+
longNightVision.base # <MCPotions>.NIGHT_VISION
|
|
35
|
+
longNightVision.modifier # <PotionModifier>.LONG
|
|
36
|
+
|
|
37
|
+
Implementation
|
|
38
|
+
--------------
|
|
39
|
+
|
|
40
|
+
Its 'uniqueName' is its base potion's, and its ids are the table the
|
|
41
|
+
data file keeps under the modifier in the base potion's record, read
|
|
42
|
+
at the first use and checked as any thing's ids. Indexing it by a
|
|
43
|
+
version, and 'versionIds', are as for a member of a catalogue.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
47
|
+
# NAMESPACE # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
48
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
49
|
+
|
|
50
|
+
# Private Variables
|
|
51
|
+
__potion_changes__: Changes = ()
|
|
52
|
+
|
|
53
|
+
# Public Variables
|
|
54
|
+
base = FixBox[MCThing]()
|
|
55
|
+
modifier = FixBox[PotionModifier]()
|
|
56
|
+
uniqueName: Field[str] = Field()
|
|
57
|
+
versionIds: Field[VersionIds] = Field()
|
|
58
|
+
|
|
59
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
60
|
+
# GETTERS # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
61
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
62
|
+
|
|
63
|
+
@uniqueName.GET
|
|
64
|
+
def _getUniqueName(self, ) -> str:
|
|
65
|
+
"""The base potion's unique name, as 'night_vision'."""
|
|
66
|
+
return self.base.uniqueName
|
|
67
|
+
|
|
68
|
+
@versionIds.GET
|
|
69
|
+
def _getVersionIds(self, ) -> VersionIds:
|
|
70
|
+
"""
|
|
71
|
+
The id of the potion in every version from the first version of the
|
|
72
|
+
data, as a new dict, '' where vanilla has no such potion.
|
|
73
|
+
"""
|
|
74
|
+
return self.base._tableOf(self._changes())
|
|
75
|
+
|
|
76
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
77
|
+
# Python API # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
78
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
79
|
+
|
|
80
|
+
def __str__(self, ) -> str:
|
|
81
|
+
""""MCPotions[<MCPotions>.NIGHT_VISION, <PotionModifier>.LONG]"."""
|
|
82
|
+
clsName = type(self.base).__name__
|
|
83
|
+
return '%s[%s, %s]' % (clsName, self.base, self.modifier)
|
|
84
|
+
|
|
85
|
+
__repr__ = __str__
|
|
86
|
+
|
|
87
|
+
def __getitem__(self, version: Any) -> PotionId:
|
|
88
|
+
"""
|
|
89
|
+
The 'PotionId' of the potion in the given version.
|
|
90
|
+
|
|
91
|
+
Raises
|
|
92
|
+
------
|
|
93
|
+
NotInVersion
|
|
94
|
+
Vanilla has no such potion in that version.
|
|
95
|
+
ValueError
|
|
96
|
+
The version is earlier than the data.
|
|
97
|
+
"""
|
|
98
|
+
version_ = Version(version)
|
|
99
|
+
position = self.base._position(version_)
|
|
100
|
+
changes = self._changes()
|
|
101
|
+
first, _ = changes[0]
|
|
102
|
+
if position < first:
|
|
103
|
+
infoSpec = """mcdex has no data on %s before %s"""
|
|
104
|
+
info = infoSpec % (self, self.base._versions()[first].value)
|
|
105
|
+
raise ValueError(info)
|
|
106
|
+
id_ = self.base._valueIn(changes, position)
|
|
107
|
+
if not id_:
|
|
108
|
+
raise NotInVersion(self, version_)
|
|
109
|
+
return PotionId(self.uniqueName, id_)
|
|
110
|
+
|
|
111
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
112
|
+
# CONSTRUCTORS # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
113
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
114
|
+
|
|
115
|
+
def __init__(self, base: MCThing, modifier: PotionModifier) -> None:
|
|
116
|
+
self.base = base
|
|
117
|
+
self.modifier = modifier
|
|
118
|
+
|
|
119
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
120
|
+
# DOMAIN SPECIFIC # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
121
|
+
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
|
122
|
+
|
|
123
|
+
def _changes(self, ) -> Changes:
|
|
124
|
+
"""The changes of the potion's ids, read and checked at the first call."""
|
|
125
|
+
if not self.__potion_changes__:
|
|
126
|
+
record = self.base._record()[self.modifier.value]
|
|
127
|
+
self.__potion_changes__ = self.base._readIds(
|
|
128
|
+
str(self), self.uniqueName, record.get('ids', {}))
|
|
129
|
+
return self.__potion_changes__
|