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/09/16 16:45] – 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 36: | Line 40: | ||
</ | </ | ||
- | ==== 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 53: | Line 56: | ||
Now that we successfully adding a block. Now let's add chest loot. | Now that we successfully adding a block. Now let's add chest loot. | ||
- | ==== ADDING CHEST LOOT ==== | + | ==== Adding Chest Loot ==== |
Firstly, we need an identifier. This identifier points to a json file that contains your chest loot. | Firstly, we need an identifier. This identifier points to a json file that contains your chest loot. | ||
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