Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

  • Author
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

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.

  • Author
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 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.