The bug
So apparently if you switch from a "short cooldown" item, such as the Hoe, to a "high or medium cool down" item, such as the Sword, both bars, crosshair and hotbar, seems to be buggy. (This does work even if you switch from the hand to a weapon).
By "buggy" i mean that the cool down bar at first seems to charge but it instantly refreshes and re-charge from the beginning. ( If you go into the game you will certainly notice it).
Code analysis
Based on 1.11.2 decompiled using MCP 9.35 rc1
It looks like the value of the field net.minecraft.entity.EntityLivingBase.ticksSinceLastSwing
is reset client-side, however attributes like net.minecraft.entity.SharedMonsterAttributes.ATTACK_SPEED
are set server-side. Therefor the client probably starts increasing ticksSinceLastSwing
with the old attack speed and then receives the attack speed for the new item from the server which makes the recharge progress appear to jump.
Linked issues
is duplicated by 5
Attachments
Comments 22
I mean that the cool down bar resets after a bit of charging (when you switch from "short cooldown" to "high cooldown")
I think this has been in 1.9 for months. I can confirm this and I'll re-word the problem. When switching from a 'low cooldown' item (such as an empty hand) to a 'high cooldown' item (such as a Diamond Sword switching from an empty hand, for example) when that higher cooldown item first starts charging, it goes about a quarter way then starts charging again, the in-hand animation also shows this according to the state of charge.
I've uploaded a video of the issue here: https://youtu.be/YPTi_gjIh4s
You can see how when you switch from the empty hand (low cooldown) to the Diamond Sword (high cooldown) the Diamond Sword charges to about a quarter way, then restarts charging.
(I can confirm for 1.9 (pre-3)). I forgot to mention that sometimes that when this happens the in-hand animation doesn't show accordingly to the hotbar charge meter (for example the third time changing from empty hand to Diamond Sword in the video).
Can confirm in 24w14a. I would like to request ownership of this issue, specifically because of it's lack of upkeep since 1.17.1.
Here is a video demonstrating the issue:
[media]
@Jiingy yes please fix this. I have just discovered this issue on my PvP server and it is entirely game balance breaking. Client side mods can easily abuse this to turn slow swinging weapons/tools into near-instant cooldown weapons. Feel free to contact me for bug testing/fixing.
What do you mean by buggy? Please explain the issue in more detail and provide exact steps to reproduce.