Jump to content

[SOLVED] Can't get LootTable loading event to fire.


Recommended Posts

Posted (edited)

[SOLVED]

I know this will probably seem like a dumb question.  I'm trying to modify the vanilla loot table to make bats drop a custom item.

I am following the tutorial at mcforge.readthedocs, and it says...

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

Well... that doesn't work.  I originally put it in its own class called LootTables, and tried adding `@Mod.EventBusSubscriber`, but then I moved it to the main class to better troubleshoot it, so I could be sure it wasn't because the class wasn't being grabbed.

 

I've looked at a lot of various tutorials and Q/A sites regarding this topic, and none of the layouts they have have worked for me.  I'm trying to figure out what I'm doing wrong.

I've attached (and put in the spoiler below) my main class file.  The one where the `@EventHandler` on the preInit and postInit and init functions definitely work.  None of the `@SubscribeEvent` things I try work.  The logger does not log anything from those SubscribeEvent pieces, so I assume that the methods have not fired.

  Reveal hidden contents

I'm using Minecraft/Forge version 1.12.2-14.23.4.2705 and mappings version stable_39

 

 

Apothecary.javaFetching info...

Edited by Dartania
Problem Solved
Posted

Oh my gods!  Thank you!

None of my methods were static.  I went and updated them to be static.

 

All five of these event methods triggered (like a thousand times)

[20:26:46] [Server thread/WARN] [apothecary]: loadLootTable
[20:26:46] [Server thread/WARN] [apothecary]: lootLoad
[20:26:46] [Server thread/WARN] [apothecary]: lootLoadEvent
[20:26:46] [Server thread/WARN] [apothecary]: onLootTableLoaded
[20:26:46] [Server thread/WARN] [apothecary]: onLootTableLoadedEvent

I was using `@SubscribeEvent`, btw.

  • Like 1

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.