rwtema / Extra-Utilities-2-Source

Sourcecode for Extra Utilities
Other
108 stars 75 forks source link

Extra Utilities "search nearby inventories" feature fails if Bibliocraft Armor Stand is in range. #209

Open IcedLance opened 6 years ago

IcedLance commented 6 years ago

Minecraft 1.12.2 EU2 1.9.5 Bibliocraft 2.4.5

If a Bibliocraft Oak Armor Stand is within 16 blocks, pressing the "T" does nothing.

enricotagliavini commented 6 years ago

Could this be related to https://github.com/Nuchaz/BiblioCraft/issues/601 ? Do you see the same error in the server console?

d0ob commented 5 years ago

Oh okay I see, when trying the "find item" utilities key I recieve an error message saying bibliocraft crashed. Now I know why !

Meegooo commented 4 years ago

This has been bothering me for a while, so I decided to try and fix the issue. Here is what I found.

  1. It seems to work in deobfuscated dev environment. So, the problem here is obfuscation. Specifically, method getStackInSlot, which has SRG name func_70301_a.
  2. There is an interface in Forge called IItemHandler. Every class that implements this interface can store items. This interface has method getStackInSlot that EU2 relies on for this function.
  3. Here comes Bibliocraft. Its storage blocks also implement this interface. However, they also implement IInventory from Minecraft, which also has getStackInSlot method. And because of that, they got obfuscated. So for example, instead of getStackInSlot it has func_70301_a.
  4. So EU2 tries to getStackInSlot for BiblioCraft chest, but Bibliocraft doesn't have that method implemented. It only got func_70301_a. So now (thanks to obfuscation) it's an abstract method. And when EU2 tries to get the item, it fails.

So, how to fix this? Without access to Bibliocraft source code, you can't. Or I mean you can, but it's too time consuming. But you can wrap call to getStackInSlot into try-catch and ignore the slot if getStackInSlot is not implemented.

If you are feeling adventureous and don't want to wait for a fix, you can edit EU2 bytecode and add it in.

PS. Here is the same issue Bibliocraft has.

ShaggyMummy commented 3 years ago

AHA!!! i was tying to figure out why "search nearby inventories" stopped working in my base, and turns out Bibliocraft book cases were the culprit, after reading this thread I tried removing the book cases and the search function worked instantly, THANKS!

Kiefy commented 3 years ago

Cooking for Blockheads breaks the find item feature too.