GTNewHorizons / Hodgepodge

A HodgePodge of patches
GNU Lesser General Public License v3.0
39 stars 62 forks source link

Added transformer for onUsingTick in EntityPlayer #414

Closed RecursivePineapple closed 3 months ago

RecursivePineapple commented 3 months ago

EntityPlayer does not call onUsingTick properly on the server because it uses a == instead of a proper ItemStack.areItemStacksEqual call. Another piece of code constantly copies the itemInUse stack, so this condition is never true. This transformer changes the == to call ItemStack.areItemStacksEqual instead. This isn't a mixin because mixins can't change expressions like this.

RecursivePineapple commented 3 months ago

I've been testing this for a few weeks and it works well. I enabled the transformer on both sides (client & server) even though it's not necessary because the client only works by happenstance.

Alexdoru commented 3 months ago

Another piece of code constantly copies the itemInUse stack

what other piece of code ?

Alexdoru commented 3 months ago

this introduces a bug where if you have 2 of the same items in your hotbar for example 2 bows, you can draw your first bow and then switch the the second one and it will be fully draw, same with eating the same food

We should instead find what code changes the items while they are being used which prevents the vanilla code == from being true