-
Bug
-
Resolution: Unresolved
-
None
-
Minecraft 1.11.2, Minecraft 1.12, Minecraft 1.13.1, Minecraft 19w02a, Minecraft 19w03a, 1.15.2, 1.16.3, 20w46a, 21w03a, 1.16.5, 21w05b, 21w06a, 21w08b, 21w11a, 21w17a, 1.17, 1.17.1, 21w38a, 21w42a, 21w43a, 1.18 Pre-release 1, 1.18, 1.18.1, 22w03a, 22w05a, 22w06a, 22w07a, 1.18.2 Release Candidate 1, 1.18.2, 22w17a, 22w18a, 1.19, 1.19.2, 22w43a, 1.19.3, 1.19.4, 1.20, 1.20.1, 1.20.4, 23w51b, 1.20.6, 1.21, 1.21.3, 1.21.4
-
None
-
Confirmed
-
Combat
The Bug:
You cannot perform sweeping attacks while riding entities.
Steps to Reproduce:
- Place down a rail and a minecart and summon a husk that has its "NoAI" NBT tag set to "1b" by using the command provided below.
/summon minecraft:husk ~ ~ ~ {NoAI:1b}
- Get inside of the minecart and obtain a sword.
- Attempt to damage the husk by using a sweeping attack.
- Take note as to whether or not you can perform sweeping attacks while riding entities.
Observed Behavior:
The sweeping attack doesn't work.
Expected Behavior:
The sweeping attack would work.
Code Analysis:
Code analysis by Avoma and Neko can be found below.
The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.
public abstract class Player extends LivingEntity { ... public void attack(Entity p_36347_) { ... double d0 = (double)(this.walkDist - this.walkDistO); if (flag && !flag2 && !flag1 && this.onGround && d0 < (double)this.getSpeed()) { ItemStack itemstack = this.getItemInHand(InteractionHand.MAIN_HAND); if (itemstack.getItem() instanceof SwordItem) { flag3 = true; } } ...
//flag = Full weapon cooldown //flag1 = Sprint/Knockback attack //flag2 = Critical attack //flag3 = Sweeping attack
In order to perform a sweeping attack, a check is carried out to ensure that the player is on the ground. If the player isn't on the ground, no sweeping attack can be executed. This is evident through the following line of code:
if (flag && !flag2 && !flag1 && this.onGround && d0 < (double)this.getSpeed()) {
When the player is riding an entity, the value of their onGround boolean is set to false, and because of this, a sweeping attack cannot be performed.
- is duplicated by
-
MC-201997 No sweeping edge in minecart
- Resolved
- relates to
-
MC-142180 You cannot perform sweeping attacks while swimming
- Open
-
MC-269202 Unable to perform a critical hit while riding an entity that is falling.
- Open
-
MC-102611 Can't use sweep attack while in air
- Resolved
-
MC-269736 It's not possible to start sprinting while riding an entity, which complicates performing knockback attacks
- Resolved