-
Bug
-
Resolution: Fixed
-
Snapshot 13w16a, Snapshot 13w17a, Snapshot 13w18a, Snapshot 13w18b, Snapshot 13w19a, Snapshot 13w21a, Snapshot 13w21b, Minecraft 1.6.1, Minecraft 1.6.2, Minecraft 1.7.4, Minecraft 14w05b, Minecraft 14w06b, Minecraft 14w07a, Minecraft 14w08a, Minecraft 1.7.5, Minecraft 1.8-pre1, Minecraft 1.8-pre3, Minecraft 1.8, Minecraft 1.8.1, Minecraft 1.8.3, Minecraft 1.9.1, Minecraft 1.9.2, Minecraft 1.10.2, Minecraft 16w43a, Minecraft 1.11.2, Minecraft 17w06a, Minecraft 1.12 Pre-Release 6, Minecraft 1.12.1, Minecraft 1.12.2, Minecraft 18w20c, Minecraft 18w22a, Minecraft 1.13.1, Minecraft 1.13.2, Minecraft 19w09a, Minecraft 19w13b, 1.14.4, 19w36a, 1.15.2, 20w20a, 1.16 Pre-release 2, 1.16.1, 20w27a, 20w28a, 20w29a, 1.16.2 Pre-release 1, 1.16.2 Release Candidate 2, 1.16.2, 1.16.3, 1.16.4, 20w46a, 20w51a, 21w03a, 1.16.5, 21w05b, 21w06a, 21w07a, 21w11a, 21w17a, 1.17.1, 21w40a, 21w41a, 21w42a, 21w43a, 21w44a, 1.18 Pre-release 1, 1.18 Pre-release 2, 1.18 Pre-release 4, 1.18 Pre-release 5, 1.18 Pre-release 6, 1.18 Pre-release 8, 1.18 Release Candidate 3, 1.18, 1.18.1 Release Candidate 1, 1.18.1 Release Candidate 2, 1.18.1, 22w03a, 22w05a, 22w06a, 22w07a, 1.18.2, 22w11a, 22w12a, 22w15a, 22w17a, 22w19a, 1.19 Pre-release 1, 1.19 Pre-release 3, 1.19.1 Pre-release 5, 1.19.1 Release Candidate 2, 1.19.2
-
Confirmed
-
Mob behaviour
-
Normal
The Bug
Suspending mobs from leashes in the air then moving the fence post with a piston causes the mob to die when they hit the ground regardless of the height they fall.
I expected the mob to survive a fall of 1-3 blocks in height, but to die from long falls.
Instead the mob dies even if it only falls one block to the ground.
- Put a fence post up in the air at least high enough that it holds the mob off the ground by one or more blocks.
- Put a piston up against the fence post.
- Attach a mob to the fence post with a leash.
- Activate the piston moving the post.
- The leash will break.
- The mob will die.
- Additionally a player riding a saddled mob will die too (from
MC-100443)
- Additionally a player riding a saddled mob will die too (from
This works at any fall height of 1 or greater.
Code analysis and fix
Code analysis and fix by PR0CESS in this comment.
The problem lies in the method checkFallDamage() in net.minecraft.world.entity.Entity.java:
protected void checkFallDamage(double heightDifference, boolean onGround, BlockState landedState, BlockPos landedPosition) { if (onGround) { ... } this.resetFallDistance(); } else if (heightDifference < 0.0) { this.fallDistance = (float)((double)this.fallDistance - heightDifference); } }
Fixed code:
protected void checkFallDamage(...) { if (onGround) { ... } this.resetFallDistance(); } else if (heightDifference < 0.0D) { this.fallDistance = (float)((double)this.fallDistance - heightDifference); } else if (heightDifference > 0.0D) { //Add back in the heightDifference if going upwards this.fallDistance = Math.max((float)((double) this.fallDistance - heightDifference),0); } }
- is duplicated by
-
MC-14897 mobs take fall damage on a lead
- Resolved
-
MC-15078 mobs will die when land on ground after hung in air by lead
- Resolved
-
MC-17112 Mobs being "launched" into the air when hanging from leads.
- Resolved
-
MC-17195 Leashed mob take fall damage as it were in air
- Resolved
-
MC-17801 Mobs Suspended by lead mid-air gain velocity
- Resolved
-
MC-19643 Mobs Instantly Die After Falling From a Lead.
- Resolved
-
MC-20268 Flying Horses
- Resolved
-
MC-21097 Bug with horses and lead
- Resolved
-
MC-22635 Horses on leads in creative
- Resolved
-
MC-22822 Animals leashed in the air accumulate fall damage
- Resolved
-
MC-26654 Animals held in air by lead take fall damage when lowered to ground
- Resolved
-
MC-28117 Leads and fall damage
- Resolved
-
MC-31561 Mobs on leads dissapearing
- Resolved
-
MC-60134 Rabbits jump when in the air by a lead.
- Resolved
-
MC-96248 When mobs are suspended in the air by a lead, attached to a fence, they spring up and down.
- Resolved
-
MC-100443 Riding "Hanging" pigs causes excessive damage
- Resolved
-
MC-121741 animal Mobs can fly when on a lead
- Resolved
-
MC-170474 When a hung mob lands very smoothly on the ground if it is in mid-air for too much, it takes fall damage depending on how long it was in mid-air
- Resolved
-
MC-183837 Instant kill with horse
- Resolved
- relates to
-
MC-44622 Physics bug with animals on leash bouncing on slime blocks
- Reopened
-
MC-30790 particle blast on landing based on fall distance rather than fall speed
- Resolved
-
MC-108063 Falling death/hurt, when player riding pig or horse / boat to the top shulker box and open it
- Resolved