mojira.dev
MC-19830

Sleeping in beds delays fall damage

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:

  1. Build the setup shown in the attachment below.

[media]
  1. Set the time to "night", stand on the diamond block, and switch into survival mode.

  2. Jump off the tower but before you hit the ground, quickly enter the bed.

  3. 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

Attachments

Comments 22

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.

No response in 4 months, assuming no longer an issue.

This happens in Minecraft 1.8.8, should I open a new issue, as this one is really old and closed?

No. Reopend, thanks.

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.

12 more comments

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

Can confirm in 1.17.

Can confirm in 22w15a.

@unknown, we only update reports with the latest snapshot or release versions as of the current moment in time. 🙂 1.12.2 is an outdated and archived affect version.

Diego Oliveira

Avoma

(Unassigned)

Confirmed

Platform

Low

Player

bed

Minecraft 1.6.2, Minecraft 1.8.8, Minecraft 1.12, Minecraft 1.13.1, Minecraft 18w43c, ..., 1.21.4, 25w08a, 1.21.5, 1.21.6, 1.21.7

Minecraft 1.10.2

Retrieved