tutorial:datagen_loot
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
tutorial:datagen_loot [2022/11/14 19:32] – nexus-dino | tutorial:datagen_loot [2023/06/05 17:45] – mcrafterzz | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | Before reading this, make sure you have a class that implements '' | + | ====== Loot Table Generation ====== |
- | To get started, make a class (or a few, you need one for blocks, chests and entities) that extends '' | + | Before reading this, make sure you've read [[datagen_setup|Getting |
+ | |||
+ | To begin, make a class (or a few, you need one for blocks, chests and entities) that extends '' | ||
==== Setting Up ==== | ==== Setting Up ==== | ||
Line 7: | Line 9: | ||
<code java> | <code java> | ||
- | private static class MyBlockLootTables extends | + | private static class MyBlockLootTables extends |
- | public MyBlockLootTables(FabricDataGenerator dataGenerator) { | + | public MyBlockLootTables(FabricDataOutput dataOutput) { |
- | | + | |
} | } | ||
| | ||
@Override | @Override | ||
- | public void accept(BiConsumer< | + | public void generate() { |
// ... | // ... | ||
} | } | ||
Line 23: | Line 25: | ||
@Override | @Override | ||
public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { | public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) { | ||
+ | // ... | ||
fabricDataGenerator.addProvider(MyBlockLootTables:: | fabricDataGenerator.addProvider(MyBlockLootTables:: | ||
+ | // ... | ||
} | } | ||
</ | </ | ||
Line 38: | Line 42: | ||
==== Adding Block Loot ==== | ==== Adding Block Loot ==== | ||
<code java> | <code java> | ||
- | private static class MyBlockLootTables extends | + | private static class MyBlockLootTables extends |
- | public MyBlockLootTables(FabricDataGenerator dataGenerator) { | + | public MyBlockLootTables(FabricDataOutput dataOutput) { |
- | | + | |
} | } | ||
- | + | | |
@Override | @Override | ||
- | public void accept(BiConsumer< | + | public void generate() { |
- | // The BlockLootTableGenerator class contains a behemoth of utility methods. Just take some time and go through the methods available to override. | + | |
- | | + | |
} | } | ||
} | } | ||
Line 67: | Line 70: | ||
private static class MyChestLootTables extends SimpleFabricLootTableProvider { | private static class MyChestLootTables extends SimpleFabricLootTableProvider { | ||
- | public MyChestLootGenerator(FabricDataGenerator | + | public MyChestLootGenerator(FabricDataOutput |
super(dataGenerator, | super(dataGenerator, | ||
} | } |
tutorial/datagen_loot.txt · Last modified: 2023/06/16 17:29 by slainlight