The Bug:
If a player were to fall from a high distance and enter a bed before hitting the ground, fall damage would only be dealt after exiting the bed.
Steps to Reproduce:
Build the setup shown in the attachment below.
Set the time to "night", stand on the diamond block, and switch into survival mode.
Jump off the tower but before you hit the ground, quickly enter the bed.
Take note as to whether or not sleeping in beds delays fall damage.
Observed Behavior:
Fall damage is delayed and instead inflicted when waking up.
Expected Behavior:
Fall damage wouldn't be delayed.
Code Analysis:
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 6
relates to 2
Attachments
Comments 22
Is this still an issue in the most recent versions (currently that is 1.10.2, or 16w42a) of Minecraft? If so, please update the affected versions and help us keeping this ticket updated from time to time.
Still in 1.17 pre-1
Code Analysis: (Fabric Mappings)
Within LivingEntity.class
public void sleep(BlockPos pos) {
if (this.hasVehicle()) {
this.stopRiding();
}
BlockState blockState = this.world.getBlockState(pos);
if (blockState.getBlock() instanceof BedBlock) {
this.world.setBlockState(pos, (BlockState)blockState.with(BedBlock.OCCUPIED, true), 3);
}
this.setPose(EntityPose.SLEEPING);
this.setPositionInBed(pos);
this.setSleepingPosition(pos);
this.setVelocity(Vec3d.ZERO);
this.velocityDirty = true;
}
This is what sets the player to sleep. The reason you take the fall damage is since
this.fallDistance
is not set to 0 as well as Velocity
Is this still a concern in the current Minecraft version? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.