Jump to content

Recommended Posts

Posted

Not sure if I can still request for support for 1.10.2 in this forum, but if not, any advice on 1.12.2 would surely help:  I don't really understand what is a Loot Pool or a Loot Entry.   I am getting a crash on startup on the line #addPool which I have placed into my EventHandler:

"Attempted to add a Duplicate Pool to loot table"

 

This could be a simple error or related to all the steps I have missed such as registering my custom chest?? I am simply trying to add loot items to both custom chest I have created and existing Vanilla chests.

What should I do?  I could use some help solving the error, understanding how the Loot system works, and steps I need to accomplish adding my custom loot items and Vanilla items to both the custom chests and Vanilla chests?  

  Reveal hidden contents

 

 

Posted (edited)

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.

Posted
  On 3/20/2018 at 5:09 PM, Draco18s said:
Expand  

I appreciate the help, however, I do not understand your usage.  Could you possibly help me understand my error as well then your help would make a lot more sense to me?  :

1)What should the string values be for "Additive Entry" or "Additive Pool"  -- would that be the name of your json file for your pool? 

2) Or would the "Additive Entry" String be the json for your item you are adding? 

3) Why do I get a message "Attempted to add duplicate pool" anyway ?  

4) I still need to register this but is that even related?

 

Posted (edited)
  On 3/22/2018 at 1:22 PM, Glistre said:

I appreciate the help, however, I do not understand your usage.  Could you possibly help me understand my error as well then your help would make a lot more sense to me?  :

1)What should the string values be for "Additive Entry" or "Additive Pool"  -- would that be the name of your json file for your pool? 

2) Or would the "Additive Entry" String be the json for your item you are adding? 

Expand  

The name is irrelevant, it just needs to be unique within the Table. It's so other mods can fetch the table/pool by name.

  Quote

3) Why do I get a message "Attempted to add duplicate pool" anyway ?  

Expand  

If the name is the same, you will get that message

  Quote

4) I still need to register this but is that even related?

Expand  

Register what how?

Edited by Draco18s

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.

Posted
  On 3/22/2018 at 6:08 PM, Draco18s said:
  Quote

3) Why do I get a message "Attempted to add duplicate pool" anyway ?  

Expand  

If the name is the same, you will get that message

Expand  

The same as what?  I have tried putting all sorts of different entries for the String "Additional Entry" and "Additional Pool"  I have put the name of the item, random names, the name of the json file for the pool, nothing works.  I get the same error "Attempted to add duplicate pool"  plus the name of whatever I put for that string.  I don't get it.  seems like no one else has had this issue

Posted

Show your usage code.

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.

Posted
  Reveal hidden contents

That's what i have I rewrote again it still give errors on "glistremod:custom_chest_loot"  ="Attempt to add duplicate to pool...: glistremod:custom_chest_loot

Loot table:

  Reveal hidden contents

Json:

  Reveal hidden contents

 

Posted

Your loot table load event if-check will (just about) always be true.

 

You're checking if(not-A || is-B)

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.

Posted
  On 3/22/2018 at 11:28 PM, Draco18s said:

Your loot table load event if-check will (just about) always be true.

 

You're checking if(not-A || is-B)

Expand  

Deleted !  Same error plus additional error: com.google.gson.JsonSyntaxException: Expected name to be an item, was unknown string 'glistremod:ancient_book'

  Reveal hidden contents

 

Posted

Not sure off the top of my head.

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.

Posted
  On 3/22/2018 at 11:46 PM, Glistre said:

com.google.gson.JsonSyntaxException: Expected name to be an item, was unknown string 'glistremod:ancient_book'

Expand  

 

There's no Item registered with this name, are you sure you typed it correctly?

 

  On 3/22/2018 at 11:46 PM, Glistre said:

java.lang.RuntimeException: Attempted to add a duplicate entry to pool: glistremod:custom_chest_loot

Expand  

 

Forge requires that each LootEntry in a LootPool has a unique entry name. The entry name defaults to the name of entry's item or loot table, but you can specify a custom entry name through JSON or the LootEntry subclass constructor if you want to have multiple entries for the same item/loot table.

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.

Posted

I have this json named custom_chest_loot located in src/main/resources/assets/glistremod/loot_tables  ; my json for ancient_book is located in src/main/resources/assets/glistremod/item

  Reveal hidden contents

 

Posted

Post the GlistreModEventHooks class, the class where you register your items and the class of the ancient book item.

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.

Posted
  On 4/1/2018 at 5:03 PM, Choonster said:

Post the GlistreModEventHooks class, the class where you register your items and the class of the ancient book item.

Expand  

Before posting that, looking at my ItemRegistry it does not look like I have correctly registered the ancient book item.  I will attempt to fix that first and then see what happens then post result

Posted (edited)
  On 4/1/2018 at 5:03 PM, Choonster said:

Post the GlistreModEventHooks class, the class where you register your items and the class of the ancient book item.

Expand  

GlistreModEventHooks class:

  Reveal hidden contents

ItemRegistry class:

  Reveal hidden contents

ItemAncientBook class:

  Reveal hidden contents

Cannot find what's wrong -- same error "Attempt to add a duplicate entry to pool: glistremod:ancient_book"  

 

Aside:  Also, my GUI screen does not display when I right click

Edited by Glistre
typo
Posted
  On 4/1/2018 at 8:22 PM, Glistre said:
 if (evt.getName().toString().equals(Reference.MODID + ":glistre_chest_gold") || evt.getName().equals(LootTableList.CHESTS_SPAWN_BONUS_CHEST))
    {


    LootEntry entry1 = new LootEntryItem(ItemRegistry.ancient_book, 90, 60, new LootFunction[0], new LootCondition[0], Reference.MODID + ":ancient_book");

--> evt.getTable().getPool("main").addEntry(entry1);    
    
    LootPool p1 = new LootPool(new LootEntry[]{entry1}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0,1), "glistremod/loot_tables:custom_chest_loot");

--> evt.getTable().getPool("main").addEntry(entry1);
Expand  

 

You're adding entry1 to the event's LootTable twice, both times to the "main" LootPool. You never add p1 to the event's LootTable.

 

No two loot entries in a loot pool can have the same name (and any loot entry will always have the same name as itself), so this is what causes the error.

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.

Posted
  On 4/1/2018 at 11:34 PM, Choonster said:

 

You're adding entry1 to the event's LootTable twice, both times to the "main" LootPool. You never add p1 to the event's LootTable.

 

No two loot entries in a loot pool can have the same name (and any loot entry will always have the same name as itself), so this is what causes the error.

Expand  

So should I change "main" to "p1" for the second "main"?  When I do I get an NPE on that line of code

: [18:50:55] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.LootTableLoadEvent@2cb84442:
java.lang.NullPointerException
    at com.glistre.glistremod.events.GlistreModEventHooks.lootLoad(GlistreModEventHooks.java:82) ~[GlistreModEventHooks.class:?]

 

  Reveal hidden contents

 

Posted
  On 4/1/2018 at 11:56 PM, Glistre said:

So should I change "main" to "p1" for the second "main"?  When I do I get an NPE on that line of code

: [18:50:55] [Server thread/ERROR] [FML]: Exception caught during firing event net.minecraftforge.event.LootTableLoadEvent@2cb84442:
java.lang.NullPointerException
    at com.glistre.glistremod.events.GlistreModEventHooks.lootLoad(GlistreModEventHooks.java:82) ~[GlistreModEventHooks.class:?]

 

  Reveal hidden contents

 

Expand  

 

As I said before, you never add p1 to the event's LootTable; so LootTable#getPool will return null when called with "p1".

 

You're already adding entry1 to p1 in the LootPool constructor, so there's no need to add it again on the next line. You need to call LootTable#addPool to add p1 to the event's LootTable.

 

That said, are you sure you want to have the same entry for the ancient book in both the "main" pool and the "p1" 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.

Posted
  On 4/2/2018 at 12:53 AM, Choonster said:

As I said before, you never add p1 to the event's LootTable; so LootTable#getPool will return null when called with "p1".

 

You're already adding entry1 to p1 in the LootPool constructor, so there's no need to add it again on the next line. You need to call LootTable#addPool to add p1 to the event's LootTable.

 

That said, are you sure you want to have the same entry for the ancient book in both the "main" pool and the "p1" pool?

Expand  

Okay not really  needed in both pools.  So if I delete everything from LootPool and leave "evt.getTable().getPool("main").addEntry(entry1);"  I get the error still "Attempt to add duplicate item to pool"

 

But if I delete "evt.getTable().getPool("main").addEntry(entry1);"

 

and change the LootPool part to this:

 

    LootPool p1 = new LootPool(new LootEntry[]{entry1}, new LootCondition[0], new RandomValueRange(1), new RandomValueRange(0,1), "glistremod/loot_tables:custom_chest_loot");

    evt.getTable().addPool(p1);

 

Then I get the error "Attempt to add duplicate pool to loot table: glistremod/loot_tables:custom_chest_loot

 

I am not understanding this yet

 

 

Posted

Post your latest loot table file (the one you're adding this entry to), loot table event handler and the full error.

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.

Posted (edited)
  On 4/2/2018 at 2:26 AM, Choonster said:

Post your latest loot table file (the one you're adding this entry to), loot table event handler and the full error.

Expand  

I am not sure I even have those files? I thought the entry gets added to "main" or "p1"

 

This is what I have -- which incidently I copied /edited from your github examples 

GlistreLootTables:

  Reveal hidden contents

And the loot table load event in GlistreModEventHooks:

  Reveal hidden contents

and LootTableRegistry which I call in preInit by      LootTableRegistry.init();
     LootTableRegistry.register() ...could this be a problem --am I registering twice?? :

  Reveal hidden contents

 

Edited by Glistre
Posted

You didn't post the full error.

 

  On 4/2/2018 at 12:07 PM, Glistre said:

I am not sure I even have those files? I thought the entry gets added to "main" or "p1"

Expand  

 

Those are the loot pools. The loot table I want to see is glistremod:glistre_chest_gold.

 

  On 4/2/2018 at 12:07 PM, Glistre said:

public static void GlistreMod(){
        init();
        register();
    }
    
    public static void init(){
        
    }
    
    public static void register(){
        
    }

Expand  

 

None of these three methods actually do anything. It's only the initialiser of the Custom_Chest_Loot field that registers the loot table.

 

The field initialisers should only create the ResourceLocations, the actual registration of the loot table names should be done in preInit.

 

There's no need to have separate init and register methods.

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.

Posted
  On 4/2/2018 at 1:21 PM, Choonster said:

You didn't post the full error.

 

 

Those are the loot pools. The loot table I want to see is glistremod:glistre_chest_gold.

 

 

None of these three methods actually do anything. It's only the initialiser of the Custom_Chest_Loot field that registers the loot table.

 

The field initialisers should only create the ResourceLocations, the actual registration of the loot table names should be done in preInit.

 

There's no need to have separate init and register methods.

Expand  

Let me try to fix that I am registering nothing since I am calling LootRegistry.register in preInit?  This is really an ignorant noobish question that will bring me hate but how would I correctly add the loot table names in preInit?

Posted
  On 4/2/2018 at 1:26 PM, Glistre said:

Let me try to fix that I am registering nothing since I am calling LootRegistry.register in preInit?  This is really an ignorant noobish question that will bring me hate but how would I correctly add the loot table names in preInit?

Expand  

 

The first paragraph ("None of these three method actually do anything") was describing what your code currently does, the second paragraph ("The field initialisers should only create the ResourceLocations") was describing what your code should do.

 

What you need to do is as follows:

  • In the field initialisers: Create the ResourceLocation for each loot table
  • In a method called from your @Mod class in preInit: Call LootTableList.register for each ResourceLocation

 

You seem to have two classes (LootTableRegistry and GlistreLootTables) that store and register your loot tables, you should only have one.

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.

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.

Announcements



×
×
  • Create New...

Important Information

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