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

Always able to use sword sweep attack while walking

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reopened
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 16w03a, Minecraft 1.11.2, Minecraft 1.12.2, Minecraft 18w05a, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 19w05a, Minecraft 19w06a, Minecraft 19w07a
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The bug

      The sword "special attack" will work, even when moving, as long as the attack meter is full.

      [Mojang] Jeb (Jens Bergensten):
      More MC combat shenanigans... Crit and knockback attack types are now separate, and there will be a third type if you move slowly

      Source

      Code analysis

      Based on 1.11.2 decompiled using MCP 9.35 rc1

      The method net.minecraft.entity.player.EntityPlayer.attackTargetEntityWithCurrentItem(Entity) has besides other ones the following condition to perform a sweep attack:

      this.distanceWalkedModified - this.prevDistanceWalkedModified < this.getAIMoveSpeed()
      

      The problem seems to be that for the server most of the time this.distanceWalkedModified and this.prevDistanceWalkedModified have the same value. Maybe because the client sends packets with its position instead of its motion and therefor this method is not called when the player walks server-side.

        Attachments

        1. bug.gif
          8.52 MB
          Markus Dam

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              TheMagzuz Markus Dam
            • Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                CHK: