Ambience - Extras (Music Mod)

Ambience - Extras (Music Mod)

1M Downloads

[BUG] Unnamed LootPool strikes back

Aizistral opened this issue ยท 0 comments

commented

Bug description:
Basically this line of code:

event.getTable().addPool(event.getLootTableManager().getLootTableFromLocation(new ResourceLocation("ambience:chests/simple_dungeon")).getPool("simpleDungeon"));

...and all alike. The problem I suspect is that getPool returns pool with null name. Injecting unnamed LootPools causes an error state if any other mod attempts to inject to the same table, which in turn leads to no loot being generated from affected loot table.

Whether playing in Singleplayer or Multiplayer?

  • Relevant in both cases.

To reproduce:
Steps to reproduce the behavior:

  1. Have this mod in your modpack;
  2. Have some other mod that attempts to modify same loot tables as this mod;
  3. Load it up;
  4. Behold no loot being generated from tables in question.

Expected behavior:
Not this.

Screenshots
Not applicable.

Mods used:

  • Ambience - Extras;
  • Enigmatic Legacy;

Mod version used:

  • 1.16.4-1.0.1

Log files:
Unnecessary.

Additional context:
I'd suggest to change your implementation and use something like this one here, from what I can recall as immediate example:
https://github.com/Shoxie12/MCDJ/blob/019ca2e6dbbc7035db5dc7dfbf8700a8cf1838f0/src/main/java/com/shoxie/mcdj/EventsHandler.java#L32-L34

Since LootPool.Builder has name method which allows you to set that name to whatever, using that builder and setting name to something other than null should solve the issue.

For reference, you can check out this issue: Aizistral-Studios/Enigmatic-Legacy#132
Also, this is the original report to my repository, from user who used Enigmatic Legacy to debug the issue: Aizistral-Studios/Enigmatic-Legacy#150

Also, its important to note that problem cause by unnamed LootPools was fixed by this Forge PR: MinecraftForge/MinecraftForge#7605
...but it of course remains relevant to older versions of Forge, and thus to all Minecraft versions older than 1.16.5.