Skip to content

Commit 8caa3d3

Browse files
fix: add other workbench loot tables
1 parent 7e62858 commit 8caa3d3

1 file changed

Lines changed: 60 additions & 6 deletions

File tree

src/client/java/com/tcm/MineTale/datagen/ModLootTableProvider.java

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,52 @@ public ModLootTableProvider(FabricDataOutput dataOutput, CompletableFuture<Holde
3535
@Override
3636
public void generate() {
3737
///Block Drops Itself
38-
//Bug!! Workbenches currently drop items based on the amount of blocks
39-
//the multiblock is. For example the Furnaces currently drop 4 furnaces.
40-
// dropSelf(ModBlocks.FURNACE_WORKBENCH_BLOCK_T1);
41-
// dropSelf(ModBlocks.FURNACE_WORKBENCH_BLOCK_T1);
4238
dropSelf(ModBlocks.ARMORERS_WORKBENCH_BLOCK);
43-
dropSelf(ModBlocks.CAMPFIRE_WORKBENCH_BLOCK);
44-
dropSelf(ModBlocks.WORKBENCH_WORKBENCH_BLOCK);
39+
40+
this.add(ModBlocks.ARMORERS_WORKBENCH_BLOCK,
41+
LootTable.lootTable() // Use the static factory method to start the builder
42+
.withPool(LootPool.lootPool()
43+
.setRolls(ConstantValue.exactly(1.0F))
44+
.add(LootItem.lootTableItem(ModBlocks.ARMORERS_WORKBENCH_BLOCK))
45+
.when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModBlocks.ARMORERS_WORKBENCH_BLOCK)
46+
.setProperties(StatePropertiesPredicate.Builder.properties()
47+
.hasProperty(AbstractWorkbench.HALF, DoubleBlockHalf.LOWER)
48+
.hasProperty(AbstractWorkbench.TYPE, ChestType.LEFT)
49+
)
50+
)
51+
.when(ExplosionCondition.survivesExplosion())
52+
)
53+
);
54+
55+
this.add(ModBlocks.CAMPFIRE_WORKBENCH_BLOCK,
56+
LootTable.lootTable() // Use the static factory method to start the builder
57+
.withPool(LootPool.lootPool()
58+
.setRolls(ConstantValue.exactly(1.0F))
59+
.add(LootItem.lootTableItem(ModBlocks.CAMPFIRE_WORKBENCH_BLOCK))
60+
.when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModBlocks.CAMPFIRE_WORKBENCH_BLOCK)
61+
.setProperties(StatePropertiesPredicate.Builder.properties()
62+
.hasProperty(AbstractWorkbench.HALF, DoubleBlockHalf.LOWER)
63+
.hasProperty(AbstractWorkbench.TYPE, ChestType.SINGLE)
64+
)
65+
)
66+
.when(ExplosionCondition.survivesExplosion())
67+
)
68+
);
69+
70+
this.add(ModBlocks.WORKBENCH_WORKBENCH_BLOCK,
71+
LootTable.lootTable() // Use the static factory method to start the builder
72+
.withPool(LootPool.lootPool()
73+
.setRolls(ConstantValue.exactly(1.0F))
74+
.add(LootItem.lootTableItem(ModBlocks.WORKBENCH_WORKBENCH_BLOCK))
75+
.when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModBlocks.WORKBENCH_WORKBENCH_BLOCK)
76+
.setProperties(StatePropertiesPredicate.Builder.properties()
77+
.hasProperty(AbstractWorkbench.HALF, DoubleBlockHalf.LOWER)
78+
.hasProperty(AbstractWorkbench.TYPE, ChestType.LEFT)
79+
)
80+
)
81+
.when(ExplosionCondition.survivesExplosion())
82+
)
83+
);
4584

4685
this.add(ModBlocks.FURNACE_WORKBENCH_BLOCK_T1,
4786
LootTable.lootTable() // Use the static factory method to start the builder
@@ -57,6 +96,21 @@ public void generate() {
5796
.when(ExplosionCondition.survivesExplosion())
5897
)
5998
);
99+
100+
this.add(ModBlocks.FURNACE_WORKBENCH_BLOCK_T2,
101+
LootTable.lootTable() // Use the static factory method to start the builder
102+
.withPool(LootPool.lootPool()
103+
.setRolls(ConstantValue.exactly(1.0F))
104+
.add(LootItem.lootTableItem(ModBlocks.FURNACE_WORKBENCH_BLOCK_T2))
105+
.when(LootItemBlockStatePropertyCondition.hasBlockStateProperties(ModBlocks.FURNACE_WORKBENCH_BLOCK_T2)
106+
.setProperties(StatePropertiesPredicate.Builder.properties()
107+
.hasProperty(AbstractWorkbench.HALF, DoubleBlockHalf.LOWER)
108+
.hasProperty(AbstractWorkbench.TYPE, ChestType.LEFT)
109+
)
110+
)
111+
.when(ExplosionCondition.survivesExplosion())
112+
)
113+
);
60114
}
61115

62116

0 commit comments

Comments
 (0)