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

Sweep attack doesn't work when sitting in a minecart

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Resolution: Unresolved
    • Affects Version/s: Minecraft 1.11.2, Minecraft 1.12, Minecraft 1.13.1, Minecraft 19w02a, Minecraft 19w03a
    • Fix Version/s: None
    • Confirmation Status:
      Confirmed
    • Category:
      (Unassigned)

      Description

      The bug

      When sitting/driving in a minecart and then hitting Mobs with a sword, the sweep attack doesn't seem to work.

      Code analysis

      The following is from the method net.minecraft.entity.EntityPlayer.attackTargetEntityWithCurrentItem(Entity targetEntity).

      In order to sweep attack, the code checks that the player is on the ground. When a player is in a minecart, the boolean onGround is false.

      double d0 = (double)(this.distanceWalkedModified - this.prevDistanceWalkedModified);
      
      //flag  = full weapon cooldown
      //flag1 = sprint/knockback attack
      //flag2 = crit ?
      //flag3 = sweep attack
      
      if (flag && !flag2 && !flag1 && this.onGround && d0 < (double)this.getAIMoveSpeed())
      {
          ItemStack itemstack = this.getHeldItem(EnumHand.MAIN_HAND);
      
          if (itemstack.getItem() instanceof ItemSword)
          {
                 flag3 = true;
          }
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                Lennart247 Lennart Post
              • Votes:
                3 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  CHK: