Fabric Waystones

Fabric Waystones

16M Downloads

[Bug] Sometimes using a waystone destroys an off-hand item

Tomatobird8 opened this issue ยท 3 comments

commented

Video: https://streamable.com/s6slkn
Destorys shields and bows for example,

commented

Have noticed this as well. Happening to multiple people on our server. Mod Version 2.0.1, Minecraft Version 1.17

EDIT: After some testing we determined that it was due to the Config file on the server not matching the clientside Config files. Make sure your files match 100%.

EDIT 2: Nevermind, the "fix" only worked for a short time. This is still a bug.

commented

This is most likely caused by this piece of code, note that in the example video, the main hand was actually empty:

if (playerEntity.getMainHandStack().isEmpty()) {
playerEntity.setStackInHand(playerEntity.getActiveHand(), ItemStack.EMPTY);
}

playerEntity.getActiveHand() can return Hand.OFF_HAND when the OFF_HAND_ACTIVE_FLAG flag of LIVING_FLAGS is set.

I think using an offhand item like a shield will set this flag and since you right click to use the item but also to open the GUI, maybe the flag gets set when opening the GUI and is only reset once it's closed again, or the "use offhand item" action goes through once the GUI is closed - something like that.

The bug should be fixed by either replacing playerEntity.getActiveHand() with Hand.MAIN_HAND or replacing getMainHandStack() with... getActiveItem() or getStackInHand(getActiveHand())?

The real question is though: What is this piece of code is even for?

Meanwhile, as a workaround: Hold an item in your main hand!

commented

Will this be backported to 1.16.5?