Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-87227

Switching a weapon with "low cooldown" to a weapon "high cooldown" resets cool down bar after a bit of charging

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 15w35b, Minecraft 15w44b, Minecraft 15w50a, Minecraft 1.9 Pre-Release 3, Minecraft 16w42a, Minecraft 1.11 Pre-Release 1, Minecraft 1.11, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 17w15a, Minecraft 17w18b, Minecraft 1.12 Pre-Release 1, Minecraft 1.12 Pre-Release 2, Minecraft 1.12 Pre-Release 6, Minecraft 1.12, Minecraft 17w43b, Minecraft 18w07c, Minecraft 1.13.1, 1.15.1, 1.16.1, 20w30a, 1.16.3, 1.16.4, 21w14a, 1.17.1, 1.20.5 Pre-Release 1, 1.20.5
    • Confirmed
    • Combat
    • Low
    • Gameplay

      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.

            Unassigned Unassigned
            Jingy Jiingy
            Votes:
            16 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              CHK: