-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.py
150 lines (133 loc) · 4.57 KB
/
constants.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import json
import os
import sys
ICE_PER_ICE = 9
DF_STACK_SIZE = 64
SHULKER_BOX_SIZE = 27
DF_SHULKER_BOX_STACK_SIZE = DF_STACK_SIZE * SHULKER_BOX_SIZE
NODE_COLOUR = '#102d5c'
IGNORE_ITEMS_REGEX = r'(dye_\w+_(bed|carpet))|bundle'
AXIOM_MATERIALS_REGEX = r"""
(stone|cobblestone|\w+_ingot$|slime_ball|redstone|\w+smithing_template|bone_meal|
wheat|quartz|resin_clump|coal|diamond|dried_kelp|emerald|honey_bottle|lapis_lazuli|white_wool|
raw_\w+(?!_block)|\w+dye|leather)$
"""
# Convert a tagged material category to its cheapest base material
TAGGED_MATERIALS_BASE = {
# Logs and wood-related materials
"#logs": "oak_log",
"#logs_that_burn": "oak_log",
"#oak_logs": "oak_log",
"#birch_logs": "birch_log",
"#spruce_logs": "spruce_log",
"#jungle_logs": "jungle_log",
"#acacia_logs": "acacia_log",
"#dark_oak_logs": "dark_oak_log",
"#pale_oak_logs": "pale_oak_log",
"#cherry_logs": "cherry_log",
"#mangrove_logs": "mangrove_log",
"#warped_stems": "warped_stem",
"#crimson_stems": "crimson_stem",
"#bamboo_blocks": "bamboo_block",
"#planks": "oak_planks",
"#wooden_slabs": "oak_slab",
# Tool and crafting materials
"#wooden_tool_materials": "oak_planks",
"#stone_tool_materials": "cobblestone",
"#iron_tool_materials": "iron_ingot",
"#diamond_tool_materials": "diamond",
"#gold_tool_materials": "gold_ingot",
"#stone_crafting_materials": "cobblestone",
# Fuels and smelting-related materials
"#coals": "coal",
"#soul_fire_base_blocks": "soul_sand",
"#smelts_to_glass": "sand",
# Miscellaneous materials
"#leaves": "oak_leaves",
"#eggs": "egg",
"#wool": "white_wool",
}
ITEM_TAGS = {
# Internally used shorthands for various items
"redstone_comparator": "comparator",
"redstone_repeater": "repeater",
"redstone_dust": "redstone",
"lapis_lazuli_block": "lapis_block",
"deepslate_lapis_lazuli_ore": "deepslate_lapis_ore",
"lapis_lazuli_ore": "lapis_ore",
"smooth_quartz_block": "smooth_quartz",
"jack_o'lantern": "jack_o_lantern",
"vines": "vine",
"hay_bale": "hay_block",
"monster_spawner": "spawner",
"jigsaw_block": "jigsaw",
"scute": "turtle_scute", # XXX could also be armadillo scute??
"grass": "short_grass",
# UK Translations
"compressed_ice": "packed_ice",
"biscuit": "cookie",
# Canadian Translations
"beet_seeds": "beetroot_seeds",
"moon_daisy": "oxeye_daisy",
# NZ Translations
"watermelon": "melon",
"watermelon_seeds": "melon_seeds",
"ender_dragon_head": "dragon_head",
}
# Skip these blocks when calculating materials
INVALID_BLOCKS = [
"air",
"void_air",
"cave_air",
"fire",
"soul_fire",
"nether_portal",
"end_portal",
"piston_head", # yes you can have a piston head on its own, but it's rare and you can get the piston back anyways if you're skilled enough
]
# Convert a block name to an item name
BLOCK_TAGS = {
"redstone_wire": "redstone",
"tripwire": "string",
"carrots": "carrot",
"potatoes": "potato",
"cocoa": "cocoa_beans",
"water": "water_bucket",
"lava": "lava_bucket",
"powder_snow": "powder_snow_bucket",
"bubble_column": "water_bucket",
"pumpkin_stem": "pumpkin_seeds",
"melon_stem": "melon_seeds",
"bamboo_sapling": "bamboo",
"beetroots": "beetroot",
"big_dripleaf_stem": "big_dripleaf",
"small_dripleaf_stem": "small_dripleaf",
"kelp_plant": "kelp",
"pitcher_crop": "pitcher_pod",
"sweet_berry_bush": "sweet_berries",
"torchflower_crop": "torchflower_seeds",
"tall_seagrass": "seagrass",
"azalea_bush": "azalea",
"flowering_azalea_bush": "flowering_azalea",
"cave_vines": "vine",
"cave_vines_plant": "vine",
"moving_piston": "block36",
}
# Entities that have the same name as their item form
SIMPLE_ENTITIES = [
"item_frame",
"painting",
"armor_stand",
]
# To get this to build to .exe we need this code, but to avoid circular dependencies it needs to be here, kinda eh
def constants_py_resource_path(relative_path):
"""Get absolute path to resource, works for dev and for PyInstaller"""
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
# Load a dictionary containing all items that don't stack to 64, and their stack size (either 16 or 1)
with open(constants_py_resource_path("limited_stacks.json"), "r") as f:
LIMITED_STACK_ITEMS = json.load(f)