[1.10.2] <ERROR> in tooltip with Tinkers tools
Nargath opened this issue ยท 13 comments
Thanks for the report!
This is caused by that Tinkers Construct have recently added support for that certain tools can mine blocks from your off hand.
I will talk to Squeek about what the best approach to fix this is :)
@GirafiStudios I'll be unavailable on IRC until Sunday, so let's discuss the possible solutions here. Do you know where the error is coming from exactly?
Yeah. It is the harvest level. https://github.com/squeek502/WailaHarvestability/blob/1.10.x/java/squeek/wailaharvestability/WailaHandler.java#L119 , ToolHelper.canToolHarvestLevel
That's just a proxy method that calls ForgeHooks.canToolHarvestBlock(blockAccess, blockPos, tool)
, so somehow that's erroring?
It is because of the itemHeld parameter, which only checks for "player.getHeldItemMainhand()". Tinkers Construct checks both hands.
Here is the error it throws: https://gist.github.com/GirafiStudios/cfceaacb90e0dcd614e4722601047ba0 , so it is a bit easier to track down :)
I'm pretty sure this is intended behaviour from TiCons side, since some of their tools now can harvest the block in the off hand.
Do you mean "it's now possible" or "you HAVE to harvest using the offhand". If it's the former, then this is a TiC bug. If it's the latter, then it should still be fixed on TiC's end (throwing an error is not the way to handle this).
EDIT: Mixed up former/latter
It is now possible for some tools. The warning is actually thrown because of some Waila code: http://prntscr.com/cl4u0p
Right, it's just catching errors so they don't crash the game.
Reporting this on TiC's tracker; we should always be able to expect ForgeHooks.canToolHarvestBlock to be safe to call with the item in the main hand.
So turns out that this is caused by ForgeHooks.canToolHarvestBlock giving a null player object when calling Item.getHarvestLevel, and TiC not doing a null check on it.
However, we should probably not use that Forge function and instead write our own version (it's a pretty simple function) that does use the the player parameter, as that could give more accurate results (although this sort of mainhand/offhand stuff might get confusing).
There we go :)
Did a few other minor things while I were at it, listed them in the commit message.
Is there any other places to contact you @squeek502, when you don't have access to IRC ? :)