Posted May 18, 20178 yr Hi everyone, I wondered why my mob doesn't drop anything, so I used the loot tables for the sheep and it works, I returned to the webpage where I learned to make loot tables it turns out it was posted 5 years ago, HAHA Idiot me, so I was looking for a tutorial on making custom loot tables thanks a bunch.
May 18, 20178 yr Make sure that your loottable is a valid json and has proper syntax (name property defined) Place it somewhere within assets/modid/loot_tables/ Get a ResourceLocation pointing to it in your core. It should point to your loottable file, but it should not include the path up to loot_tables folder and the extension. Obtain a registry ResourceLocation using LootTableList::register Double check that your ResourceLocation is correct, your json is correct, etc. That ResourceLocation you obtain in step 4 is what you need. Refer to this topic for more details and examples: It is a very recent one too, so all the information there is up to date. Another related topic I've found: loottable file, location and syntax example. And registration example.
May 18, 20178 yr 2 minutes ago, V0idWa1k3r said: loottable file, location and syntax example. And registration example. I've changed those files since posting in that other thread, you can see the latest versions (as of the writing of this post) here: Loot table file Loot table registration For anyone reading this thread in the future, you can use the Tree/Branch/Tag dropdown on GitHub to see the latest versions of these files on each branch. The branches are currently named after the Minecraft version they're targeting. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 18, 20178 yr Author Just now, V0idWa1k3r said: Make sure that your loottable is a valid json and has proper syntax (name property defined) Place it somewhere within assets/modid/loot_tables/ Get a ResourceLocation pointing to it in your core. It should point to your loottable file, but it should not include the path up to loot_tables folder and the extension. Obtain a registry ResourceLocation using LootTableList::register Double check that your ResourceLocation is correct, your json is correct, etc. That ResourceLocation you obtain in step 4 is what you need. Refer to this topic for more details and examples: It is a very recent one too, so all the information there is up to date. Another related topic I've found: loottable file, location and syntax example. And registration example. Do I have to extend my lootable list to minecraft's LootTableList?
May 18, 20178 yr You do not need to extend anything anywhere. Look at the examples Choonster graciously provided
May 18, 20178 yr Author Here is one of the lootables, I based with sheep's. https://pastebin.com/BeJD1GQN
May 18, 20178 yr 3 hours ago, V0idWa1k3r said: Make sure that your loottable is a valid json and has proper syntax (name property defined) Your json has no name property defined for your pools. Forge requires that property to be defined for mod loottables.
May 18, 20178 yr Author Just now, V0idWa1k3r said: Your json has no name property defined for your pools. Forge requires that property to be defined for mod loottables. So you're telling me that minecraft van put anything without name property but modders need to?
May 18, 20178 yr Author Just now, V0idWa1k3r said: Your json has no name property defined for your pools. Forge requires that property to be defined for mod loottables. So you're telling me that minecraft van put anything without name property but modders need to? Just now, V0idWa1k3r said: Erm, yes Am I forgetting something? package com.TheRPGAdventurer; import static com.TheRPGAdventurer.RealmOfTheDragonsLootTables.RegistrationHandler.create; import com.TheRPGAdventurer.RealmOfTheDragons; import java.util.HashSet; import java.util.Set; import net.minecraft.util.ResourceLocation; import net.minecraft.world.storage.loot.LootTable; import net.minecraft.world.storage.loot.LootTableList; public class RealmOfTheDragonsLootTables { public static final ResourceLocation ENTITIES_DRAGON_AMETHYST = create("amethsyt"); public static final ResourceLocation ENTITIES_DRAGON_GARNET = create("garnet"); public static final ResourceLocation ENTITIES_DRAGON_JADE = create("jade"); public static final ResourceLocation ENTITIES_DRAGON_RUBY = create("ruby"); public static final ResourceLocation ENTITIES_DRAGON_SAPPHIRE = create("sapphire"); /** * Register this mod's {@link LootTable}s. */ public static void registerLootTables() { RegistrationHandler.LOOT_TABLES.forEach(LootTableList::register); } public static class RegistrationHandler { /** * Stores the IDs of this mod's {@link LootTable}s. */ private static final Set<ResourceLocation> LOOT_TABLES = new HashSet<>(); /** * Create a {@link LootTable} ID. * * @param id The ID of the LootTable without the testmod3: prefix * @return The ID of the LootTable */ protected static ResourceLocation create(String id) { final ResourceLocation lootTable = new ResourceLocation(RealmOfTheDragons.MODID, id); RegistrationHandler.LOOT_TABLES.add(lootTable); return lootTable; } } }
May 18, 20178 yr 7 minutes ago, TheRPGAdventurer said: So you're telling me that minecraft van put anything without name property but modders need to? Yes. Forge adds the naming requirement for mod loot tables and auto-generates names for vanilla loot tables. 7 minutes ago, TheRPGAdventurer said: Am I forgetting something? You need to specify a name for each pool in the loot table file. I explained the naming requirements here (in the thread that @V0idWa1k3r linked). Please use code blocks (the <> icon in the editor) when posting code. Alternatively, use Gist/Pastebin. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 18, 20178 yr Author Just now, Choonster said: Yes. Forge adds the naming requirement for mod loot tables and auto-generates names for vanilla loot tables. You need to specify a name for each pool in the loot table file. I explained the naming requirements here (in the thread that @V0idWa1k3r linked). Please use code blocks (the <> icon in the editor) when posting code. Alternatively, use Gist/Pastebin. I did, I mean in the loot table class.
May 18, 20178 yr 2 minutes ago, TheRPGAdventurer said: I did, I mean in the loot table class. I'm talking about the loot table JSON file, not the class that registers the loot tables. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 18, 20178 yr Author Just now, Choonster said: I'm talking about the loot table JSON file, not the class that registers the loot tables. So there's nothing wrong in the class I made?
May 18, 20178 yr 5 minutes ago, TheRPGAdventurer said: So there's nothing wrong in the class I made? The class looks correct, but make sure you call RealmOfTheDragonsLootTables.registerLootTables in preInit. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 18, 20178 yr Author Just now, Choonster said: The class looks correct, but make sure you call RealmOfTheDragonsLootTables.registerLootTables in preInit. I did
May 18, 20178 yr Author Here is one of the loot tables JSON, I made 5 per breed, https://pastebin.com/E1BkEF05
May 18, 20178 yr 24 minutes ago, TheRPGAdventurer said: Here is one of the loot tables JSON, I made 5 per breed, https://pastebin.com/E1BkEF05 You didn't name the second pool. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 18, 20178 yr 4 minutes ago, TheRPGAdventurer said: what second pool? There are two loot pools in that file, one that includes an entry for the rotd:amethsyt_dragon_scales item and one that includes an entry for the rotd:entities loot table. Only the first has a name. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 18, 20178 yr Author Just now, Choonster said: There are two loot pools in that file, one that includes an entry for the rotd:amethsyt_dragon_scales item and one that includes an entry for the rotd:entities loot table. Only the first has a name. Wait, you don't need to register it just like minecraft's loottablelist and the location is in the JSON itself?
May 18, 20178 yr 36 minutes ago, TheRPGAdventurer said: Wait, you don't need to register it just like minecraft's loottablelist and the location is in the JSON itself? You're registering the loot table correctly, but it's the contents of the JSON file that need to fixed. Each loot pool in the loot table JSON file needs to have a "name" property with a unique value. Currently only the first of the two loot pools has a "name" property. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
May 18, 20178 yr Author Just now, Choonster said: You're registering the loot table correctly, but it's the contents of the JSON file that need to fixed. Each loot pool in the loot table JSON file needs to have a "name" property with a unique value. Currently only the first of the two loot pools has a "name" property. Just now, Choonster said: You're registering the loot table correctly, but it's the contents of the JSON file that need to fixed. Each loot pool in the loot table JSON file needs to have a "name" property with a unique value. Currently only the first of the two loot pools has a "name" property. I actually based on the sheep's the second pool never existed and what probably causing the bug.
May 19, 20178 yr Author Just now, Choonster said: You're registering the loot table correctly, but it's the contents of the JSON file that need to fixed. Each loot pool in the loot table JSON file needs to have a "name" property with a unique value. Currently only the first of the two loot pools has a "name" property. I updated it but it still doesn't drop anything can you see what's wrong with it?https://pastebin.com/HAKGmKp3
May 19, 20178 yr 8 minutes ago, TheRPGAdventurer said: I updated it but it still doesn't drop anything can you see what's wrong with it?https://pastebin.com/HAKGmKp3 That looks correct. Are there any errors in the log? Post your loot table registration class and your entity class. Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.