Mojira Archive
MC-96198

Boats / rafts move into blocks when landing in less than one block deep water

The bug

A boat will glitch / sink through blocks when it falls onto shallow water (see screenshot for setup to reproduce glitch or 3 Glitches with Boats- 1.12 Vanilla Survival)

How to reproduce

  1. Grab a boat
  2. Create setup shown in screenshot
  3. Speed up using 'W' and move towards the waterfall. once you fall on the floor below, you will sink/glitch through the ground, as shown in the video here: https://www.youtube.com/watch?v=Q8mtxsNCOAE

Code analysis

Based on 1.12.2 decompiled using MCP 9.40

It appears the call to Entity.setPosition(double, double, double) in the method net.minecraft.entity.item.EntityBoat.updateMotion() is causing this:

if (this.previousStatus == EntityBoat.Status.IN_AIR && this.status != EntityBoat.Status.IN_AIR && this.status != EntityBoat.Status.ON_LAND)
{
    this.waterLevel = this.getEntityBoundingBox().minY + (double)this.height;
    // The following line appears to be causing the bug
    this.setPosition(this.posX, (double)(this.getWaterLevelAbove() - this.height) + 0.101D, this.posZ);
    this.motionY = 0.0D;
    this.lastYd = 0.0D;
    this.status = EntityBoat.Status.IN_WATER;
}

It is unknown if leaving this out solves this bug without causing any other problems.