viniciusgf2 / Ambience

Your music in minecraft
Other
15 stars 12 forks source link

[BUG] Unnamed LootPool strikes back #67

Open Aizistral opened 3 years ago

Aizistral commented 3 years ago

Bug description: Basically this line of code: https://github.com/viniciusgf2/Ambience/blob/450cc3e5ee9baec08d8ff2ded1f8e661ca8e0292/src/main/java/vazkii/ambience/Util/Handlers/EventHandlers.java#L125 ...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?

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:

Mod version used:

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: https://github.com/Aizistral-Studios/Enigmatic-Legacy/issues/132 Also, this is the original report to my repository, from user who used Enigmatic Legacy to debug the issue: https://github.com/Aizistral-Studios/Enigmatic-Legacy/issues/150

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