KnightMiner / Inspirations

Mod adding various smaller features to Minecraft
MIT License
44 stars 18 forks source link

[Bug?] JEI integration for anvil falling and block metadata #41

Closed DylanGK closed 6 years ago

DylanGK commented 6 years ago

Hi there!

In a personal pack, I've added 2 anvil falling interactions with blocks from the Erebus mod, namely, smashing Umberstone into Umbercobble and Umbercobble into Umbergravel.

These are the lines I added:

Erebus

        erebus:umberstone:0->erebus:umberstone:1
        erebus:umberstone:1->erebus:umbergravel

With the latter, JEI shows the correct recipe. With the former, however, both sides of the equation show Umbercobble (erebus:umberstone:1).

While in-game behaviour is as expected and properly respects metadata (only umberstone:0 can be smashed into umberstone:1, umberstone:2 through 6 are unaffected), the recipe shown in JEI is incorrect and thus, does not show up when looking at uses for umberstone:0, while that block is in fact the one that has an interaction with the falling anvil.

Hardly a big issue, especially since it does not break anything in-game, just a minor thing I noticed. Hopefully my explanation was sufficiently clear!

KnightMiner commented 6 years ago

Looks like it's due to how I grab the metadata for the result. I currently use damageDropped, but it must change to drop cobblestone. I do wonder why I'm not using getPickBlock or so edging related, I'll mess around with it to see if I can find an easy function to call.

KnightMiner commented 6 years ago

Looking into this, the fix is not as easy as I hoped. It seems getPickBlock requires world access, so I had to use getSilkTouchDrop. getSilkTouchDrop is protected though so I went with reflection and a fallback to the old method in case it fails.

KnightMiner commented 6 years ago

Should hopefully work in 0.1.4.