44from typing import Any
55
66ITEMS = {
7+ "copper_sword" : 191 ,
8+ "copper_pickaxe" : 191 ,
9+ "copper_axe" : 191 ,
10+ "copper_shovel" : 191 ,
11+ "copper_hoe" : 191 ,
12+ "copper_helmet" : 122 ,
13+ "copper_chestplate" : 177 ,
14+ "copper_leggings" : 166 ,
15+ "copper_boots" : 144 ,
16+
717 "diamond_sword" : 1562 ,
818 "diamond_pickaxe" : 1562 ,
919 "diamond_axe" : 1562 ,
5161def beet_default (ctx : Context ):
5262 """Creates a loot table for dropping the 9 result items when disassembling an item."""
5363 vanilla = ctx .inject (Vanilla )
54- vanilla .minecraft_version = '1.21.5 '
64+ vanilla .minecraft_version = '1.21.9 '
5565 recipes = vanilla .data .recipes
5666
5767 for item , durability in ITEMS .items ():
68+ output_pack = ctx .data .overlays ["since_88" ] if "copper" in item else ctx .data
69+
5870 recipe = recipes [f"minecraft:{ item } " ].data
5971 ingredients : list [tuple [str , int ]] = []
6072 if recipe ["type" ] == "minecraft:crafting_shaped" :
@@ -117,13 +129,14 @@ def beet_default(ctx: Context):
117129 }]
118130 })
119131
120- ctx . data [f"{ ctx .project_id } :disassembleables/{ item } " ] = LootTable ({
132+ output_pack [f"{ ctx .project_id } :disassembleables/{ item } " ] = LootTable ({
121133 "__comment" : "Generated by generate_disassembly.py" ,
122134 "type" : "minecraft:generic" ,
123135 "pools" : pools
124136 })
125137
126- caller : Any = {
138+ # base pack
139+ caller : dict [str , Any ] = {
127140 "__comment" : "Generated by generate_disassembly.py" ,
128141 "type" : "minecraft:fishing" ,
129142 "pools" : [{
@@ -132,6 +145,8 @@ def beet_default(ctx: Context):
132145 }]
133146 }
134147 for item in ITEMS :
148+ if "copper" in item :
149+ continue
135150 caller ["pools" ][0 ]["entries" ][0 ]["children" ].append ({
136151 "type" : "minecraft:loot_table" ,
137152 "value" : f'gm4_disassemblers:disassembleables/{ item } ' ,
@@ -150,3 +165,32 @@ def beet_default(ctx: Context):
150165 })
151166
152167 ctx .data [f"{ ctx .project_id } :caller" ] = LootTable (caller )
168+
169+ # since 88 overlay
170+ caller_88 : dict [str , Any ] = {
171+ "__comment" : "Generated by generate_disassembly.py" ,
172+ "type" : "minecraft:fishing" ,
173+ "pools" : [{
174+ "rolls" : 1 ,
175+ "entries" : [{"type" :"minecraft:alternatives" ,"children" :[]}]
176+ }]
177+ }
178+ for item in ITEMS :
179+ caller_88 ["pools" ][0 ]["entries" ][0 ]["children" ].append ({
180+ "type" : "minecraft:loot_table" ,
181+ "value" : f'gm4_disassemblers:disassembleables/{ item } ' ,
182+ "conditions" : [{
183+ "condition" : "match_tool" ,
184+ "predicate" : {
185+ "items" : [f"minecraft:{ item } " ]
186+ }
187+ }]
188+ })
189+ if item .startswith ("diamond_" ):
190+ caller_88 ["pools" ][0 ]["entries" ][0 ]["children" ][- 1 ]["conditions" ].append ({
191+ "condition" : "value_check" ,
192+ "range" : 1 ,
193+ "value" : {"type" :"score" ,"target" :{"type" :"fixed" ,"name" :"disassemble_diamonds" },"score" :"gm4_disassembler" }
194+ })
195+
196+ ctx .data .overlays ["since_88" ][f"{ ctx .project_id } :caller" ] = LootTable (caller_88 )
0 commit comments