Jump to content

[1.10.2] Loot pool #addPool --


Glistre

Recommended Posts

22 hours ago, Choonster said:

 

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.

I really appreciate your patience with me on this and all the help.

 

I am trying to simplify this, 1) the glistremod:glistre_chest_gold  is just a custom chest --it does not extend LootTableEntry.  So, I just eliminated that part of the if statement completely, as I can try to add loot to it later,  and that leaves  just LootTableList.CHEST_SPAWN_BONUS_CHEST.

2) I eliminated both LootTableRegistry and GlistreLootTables class where I had mistakenly tried to write the class to register "custom_chest_loot" twice.

So, instead I just call LootTableList.register(new ResourceLocation(Reference.MODID, "custom_chest_loot"));  in the preInit.

 

And here is my simplified version of the event, which seems like it would work but gives the error "Attempted to add a duplicate entry to pool: glistremod:ancient_book"

I am sorry I did not post the full error my folder was moved to a subdrive I could not locate the full crash log. In any event, I am just beginning troubleshooting and have 1018 json model errors

 

This is what I have now:

Spoiler

    @SubscribeEvent
    public void lootLoad(LootTableLoadEvent evt)

    {        
        if (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");
    
    LootPool main = evt.getTable().getPool("main");
    main.addEntry(entry1);
}

}

and I have

 

LootTableList.register(new ResourceLocation(Reference.MODID, "custom_chest_loot"))

 

in preInit in my main mod / @Mod class

 

Edited by Glistre
Link to comment
Share on other sites

The code you posted doesn't compile, because entry1 is declared inside the if statement but referenced outside of it (because it doesn't have braces). Please post a working Git repository of your mod so I can debug this.

 

See my mod and its .gitignore file for an example of the repository structure to use and which files to include. This .gitingore file tells Git to ignore everything (the first line) except the files that are actually required (the lines starting with an exclamation mark).

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.

Link to comment
Share on other sites

18 hours ago, Choonster said:

The code you posted doesn't compile, because entry1 is declared inside the if statement but referenced outside of it (because it doesn't have braces). Please post a working Git repository of your mod so I can debug this.

 

See my mod and its .gitignore file for an example of the repository structure to use and which files to include. This .gitingore file tells Git to ignore everything (the first line) except the files that are actually required (the lines starting with an exclamation mark).

Sorry I left that brace out!!!! uggh.  Still I get the error "Attempt to add duplicate ....to pool : glistremod:ancient_book" error.  I will look at your mod and its .gitignore file for your example and post my Git repository soon as I can.  I have lots of errors in this mod and just beginning to debug but I really, really appreciate your help I have tried so many ways of doing this 

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.

Announcements



×
×
  • Create New...

Important Information

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