Line 46: |
Line 46: |
| | | |
| == The actual Class for Lootables == | | == The actual Class for Lootables == |
− | Here's an example Lootprovider class for blocks. The class is abstract and will be extended by the actual lootprovider class. This is however, optional. The class could also be used directly. | + | Here's an example Lootprovider class. The class is abstract and will be extended by the actual lootprovider class. This is however, optional. The class could also be used directly. |
| <syntaxhighlight lang="java"> | | <syntaxhighlight lang="java"> |
| public abstract class BaseLootTableProvider extends LootTableProvider { | | public abstract class BaseLootTableProvider extends LootTableProvider { |
Line 69: |
Line 69: |
| Map<ResourceLocation, LootTable> tables = new HashMap<>(); | | Map<ResourceLocation, LootTable> tables = new HashMap<>(); |
| for (Map.Entry<Block, LootTable.Builder> entry : lootTables.entrySet()) { | | for (Map.Entry<Block, LootTable.Builder> entry : lootTables.entrySet()) { |
− | tables.put(entry.getKey().getLootTable(), entry.getValue().setParamSet(LootParameterSets.BLOCK).build()); | + | tables.put(entry.getKey().getLootTable(), entry.getValue().build()); |
| } | | } |
| writeTables(cache, tables); | | writeTables(cache, tables); |
Line 119: |
Line 119: |
| .withEntry(DynamicLootEntry.dynamicEntry(new ResourceLocation("minecraft", "contents")))) | | .withEntry(DynamicLootEntry.dynamicEntry(new ResourceLocation("minecraft", "contents")))) |
| ); | | ); |
− | return LootTable.lootTable().withPool(builder); | + | return LootTable.lootTable().withPool(builder).setParamSet(LootParameterSets.BLOCK); |
| } | | } |
| </syntaxhighlight> | | </syntaxhighlight> |
| Thanks and creddits to McJty with his amazing tutorials: https://wiki.mcjty.eu/modding/index.php?title=YouTube-Tutorials and https://github.com/McJty/YouTubeModding14/tree/1.16/src/main/java/com/mcjty/mytutorial/datagen | | Thanks and creddits to McJty with his amazing tutorials: https://wiki.mcjty.eu/modding/index.php?title=YouTube-Tutorials and https://github.com/McJty/YouTubeModding14/tree/1.16/src/main/java/com/mcjty/mytutorial/datagen |
| [[Category:Data Generation]] | | [[Category:Data Generation]] |