tutorial:datagen_loot
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| tutorial:datagen_loot [2025/04/01 13:34] – solidblock | tutorial:datagen_loot [2025/04/01 13:47] (current) – solidblock | ||
|---|---|---|---|
| Line 4: | Line 4: | ||
| ===== Block loot tables ===== | ===== Block loot tables ===== | ||
| - | To create | + | To add a data generation for block loot tables, just create a class which extends '' |
| <code java TutorialBlockLootTableProvider.java> | <code java TutorialBlockLootTableProvider.java> | ||
| Line 34: | Line 34: | ||
| In the previous [[blocks]] tutorial, we created an //example block//. Now let's use the data generator to generate its loot table. It's as simple as: | In the previous [[blocks]] tutorial, we created an //example block//. Now let's use the data generator to generate its loot table. It's as simple as: | ||
| - | <code java TutorialBlockLootTableProvider> | + | <code java TutorialBlockLootTableProvider.java> |
| @Override | @Override | ||
| public void generate() { | public void generate() { | ||
| Line 48: | Line 48: | ||
| addDrop(TutorialBlocks.EXAMPLE_BLOCK, | addDrop(TutorialBlocks.EXAMPLE_BLOCK, | ||
| | | ||
| - | // drops a dirt when mined | + | // drops a dirt block |
| addDrop(TutorialBlocks.EXAMPLE_BLOCK, | addDrop(TutorialBlocks.EXAMPLE_BLOCK, | ||
| | | ||
| Line 60: | Line 60: | ||
| addDrop(TutorialBlocks.EXAMPLE_BLOCK, | addDrop(TutorialBlocks.EXAMPLE_BLOCK, | ||
| | | ||
| - | // drops three blocks | + | // drops five blocks |
| addDrop(TutorialBlocks.EXAMPLE_BLOCK, | addDrop(TutorialBlocks.EXAMPLE_BLOCK, | ||
| .apply(SetCountLootFunction.builder(ConstantLootNumberProvider.create(5)))); | .apply(SetCountLootFunction.builder(ConstantLootNumberProvider.create(5)))); | ||
| </ | </ | ||
| - | You can also generate | + | You can also generate |
| <code java> | <code java> | ||
| addDrop(TutorialBlocks.CUSTOM_CROP, | addDrop(TutorialBlocks.CUSTOM_CROP, | ||
| Line 105: | Line 105: | ||
| </ | </ | ||
| - | If you're using versions pre-1.20, please replace '' | + | > If you're using versions pre-1.20, please replace '' |
| - | Now run the data generator, then start Minecraft and run the command ''/ | + | Now run the data generator, then start Minecraft and run the command ''/ |
tutorial/datagen_loot.1743514493.txt.gz · Last modified: 2025/04/01 13:34 by solidblock