User Tools

Site Tools


tutorial:adding_to_loot_tables

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tutorial:adding_to_loot_tables [2019/07/29 17:16] – small tweaks juuztutorial:adding_to_loot_tables [2019/08/12 23:06] – fixed parenthesis yanis48
Line 13: Line 13:
 <code java> <code java>
 LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> { LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> {
-    if ("minecraft:blocks/coal_ore".equals(id.toString()) {+    if ("minecraft:blocks/coal_ore".equals(id.toString())) {
         // Our code will go here         // Our code will go here
     }     }
Line 21: Line 21:
 ===== Adding items to the table ===== ===== Adding items to the table =====
  
-In loot tables, item are stored in //loot entries,// and entries are stored in //loot pools//. To add an item, we’ll need to add a pool with an item entry to the loot table.+In loot tables, items are stored in //loot entries,// and entries are stored in //loot pools//. To add an item, we’ll need to add a pool with an item entry to the loot table.
  
 We can make a pool with ''%%FabricLootPoolBuilder%%'', and add it to the loot table: We can make a pool with ''%%FabricLootPoolBuilder%%'', and add it to the loot table:
Line 27: Line 27:
 <code java> <code java>
 LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> { LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> {
-    if ("minecraft:blocks/coal_ore".equals(id.toString()) {+    if ("minecraft:blocks/coal_ore".equals(id.toString())) {
         FabricLootPoolBuilder poolBuilder = FabricLootPoolBuilder.builder()         FabricLootPoolBuilder poolBuilder = FabricLootPoolBuilder.builder()
                 .withRolls(ConstantLootTableRange.create(1)); // Same as "rolls": 1 in the loot table json                 .withRolls(ConstantLootTableRange.create(1)); // Same as "rolls": 1 in the loot table json
Line 39: Line 39:
 <code java> <code java>
 LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> { LootTableLoadingCallback.EVENT.register((resourceManager, lootManager, id, supplier, setter) -> {
-    if ("minecraft:blocks/coal_ore".equals(id.toString()) {+    if ("minecraft:blocks/coal_ore".equals(id.toString())) {
         FabricLootPoolBuilder poolBuilder = FabricLootPoolBuilder.builder()         FabricLootPoolBuilder poolBuilder = FabricLootPoolBuilder.builder()
                 .withRolls(ConstantLootTableRange.create(1))                 .withRolls(ConstantLootTableRange.create(1))
tutorial/adding_to_loot_tables.txt · Last modified: 2024/02/05 16:08 by mschae23