Jump to content

Access to LootTableManager from LootTableLoadEvent


jcranky

Recommended Posts

Hi,

 

Is there a way to access a `LootTableManager` when a `LootTableLoadEvent` is fired? I wanted to replace a `LootTable`, but wanted to use `lootTableManager.getLootTableFromLocation(...)` instead of having to manually build the whole `lootTable` object.

 

thanks!

 

[]s,

just you wait! ;)

Link to comment
Share on other sites

It doesn't look you have access to the LootTableManager from LootTableLoadEvent. Since the event gives you the option of replacing the LootTable with another one, it probably should give you access to the LootTableManager.

 

You could suggest this be changed, but in the mean time you can remove the LootTable's existing LootPools and then add a new one with a LootEntryTable in it that references the replacement LootTable.

Edited by Choonster
Typo

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

Just now, jcranky said:

Thanks, I'll investigate a bit more around the first option. The second one would still mean that I have to manually create the loot table, right? Which is what I'm trying to avoid, since I want to use a loot table defined in a json file.

 

No, LootEntryTable takes the ResourceLocation of a LootTable and loads it from the LootTableManager when loot is generated from the containing LootTable.

 

I use LootEntryTable to add one LootTable to another here.

  • Like 1

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

Ah, I missed that fact. So basically this is an entry that is itself a whole table, and in this case the trick is to make sure it is the only entry in the loot table being replaced? Feels a bit like a hack, but solves the problem - I'll start in that direction for now :)

 

Thanks for the code sample, it helped a lot!

just you wait! ;)

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.