Jump to content

1.12.2 How do you add a custom pool to vanilla chest loot tables?


poopoodice

Recommended Posts

As title

 

    @SubscribeEvent
    public void lootLoad(LootTableLoadEvent evt) 
    {
        if (evt.getName().toString().equals("minecraft:chests/simple_dungeon")) 
        {
            evt.getTable().addPool(new LootPool(null, null, null, null, null)));
        }
    }

 

for the arguments of LootPool, they should be 

 
net.minecraft.world.storage.loot.LootPool.LootPool(LootEntry[] lootEntriesIn, LootCondition[] poolConditionsIn, RandomValueRange rollsIn, RandomValueRange bonusRollsIn, String name)
 
But I don't really understand what the arguments means and what they should be.
Any reply will be appreciated :)
Edited by poopoodice
Link to comment
Share on other sites

I don't remember exactly. Use this:

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/util/LootUtils.java

It already handles 99% of use cases with intelligently named parameters and will offer sensible alternatives when you just need to do something simple (such as not needing an ILootCondition or ILootFunction). If you have more specific questions, just ask. There's some examples of usage in my code (mostly in Harder Farming's EventHandler class).

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Sorry but I still dont quite get it.

Should I import a json file with pool or simply returns items in the function?

 

Here is the forge documentation =>https://mcforge.readthedocs.io/en/latest/items/loot_tables/#modifying-vanilla-loot

It says 

@SubscribeEvent
public void lootLoad(LootTableLoadEvent evt) {
    if (evt.getName().toString().equals("minecraft:chests/simple_dungeon")) {
        // do stuff with evt.getTable()
    }
}

What specific thing I need to do with it?

Link to comment
Share on other sites

14 hours ago, Draco18s said:

I don't remember exactly. Use this:

https://github.com/Draco18s/ReasonableRealism/blob/1.12.1/src/main/java/com/draco18s/hardlib/util/LootUtils.java

It already handles 99% of use cases with intelligently named parameters and will offer sensible alternatives when you just need to do something simple (such as not needing an ILootCondition or ILootFunction). If you have more specific questions, just ask. There's some examples of usage in my code (mostly in Harder Farming's EventHandler class).

Nvm, I sort it out! Thank you for your reply : )

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.