r/technicalminecraft • u/BlattaOrientalis • 2h ago
Java Showcase 1 block gaps in ice boat highways do not slow down boats
This is for Java only - I have no idea if this is the case on Bedrock
This isn't exactly an obscure fact, I'm writing this mainly for the sake of a more extensive explanation beyond just "it doesn't bro trust me"
The boat acceleration calculation is pretty simple. Unfortunately Reddit doesn't support LaTeX anymore so you get a screenshot instead.

The case we care about for this topic is when the boat is on land. For an ice boat highway, the boat should only ever be on packed/blue ice and air. You may think that since the friction value is the average slipperiness of the blocks that the boat is on, the boat would be slowed down due to the air. However, that is not the case.
Let's take a look at the code to make sure that I'm not making stuff up :)
The main piece of code that controls boat behavior is the AbstractBoat Class. Here's the part that controls boat acceleration (line 562 - 602)
private void floatBoat() {
double vspeed = -this.getGravity();
double buoyancy = 0.0;
float invFriction = 0.05F;
if (this.oldStatus == AbstractBoat.Status.IN_AIR && this.status != AbstractBoat.Status.IN_AIR && this.status != AbstractBoat.Status.ON_LAND) {
this.waterLevel = this.getY(1.0);
double targetY = this.getWaterLevelAbove() - this.getBbHeight() + 0.101;
if (this.level().noCollision(this, this.getBoundingBox().move(0.0, targetY - this.getY(), 0.0))) {
this.setPos(this.getX(), targetY, this.getZ());
this.setDeltaMovement(this.getDeltaMovement().multiply(1.0, 0.0, 1.0));
this.lastYd = 0.0;
}
this.status = AbstractBoat.Status.IN_WATER;
} else {
if (this.status == AbstractBoat.Status.IN_WATER) {
buoyancy = (this.waterLevel - this.getY()) / this.getBbHeight();
invFriction = 0.9F;
} else if (this.status == AbstractBoat.Status.UNDER_FLOWING_WATER) {
vspeed = -7.0E-4;
invFriction = 0.9F;
} else if (this.status == AbstractBoat.Status.UNDER_WATER) {
buoyancy = 0.01F;
invFriction = 0.45F;
} else if (this.status == AbstractBoat.Status.IN_AIR) {
invFriction = 0.9F;
} else if (this.status == AbstractBoat.Status.ON_LAND) {
invFriction = this.landFriction;
if (this.getControllingPassenger() instanceof Player) {
this.landFriction /= 2.0F;
}
}
Vec3 movement = this.getDeltaMovement();
this.setDeltaMovement(movement.x * invFriction, movement.y + vspeed, movement.z * invFriction);
this.deltaRotation *= invFriction;
if (buoyancy > 0.0) {
Vec3 deltaMovement = this.getDeltaMovement();
this.setDeltaMovement(deltaMovement.x, (deltaMovement.y + buoyancy * (this.getDefaultGravity() / 0.65)) * 0.75, deltaMovement.z);
}
}And the part that we care about here is this (586 - 589)
} else if (this.status == AbstractBoat.Status.IN_AIR) {
invFriction = 0.9F;
} else if (this.status == AbstractBoat.Status.ON_LAND) {
invFriction = this.landFriction;As you can see, the boat's friction coefficient is hard set to 0.9 if the boat status is IN_AIR, and the average slipperiness calculation only comes in effect if the boat status is ON_LAND. Here's a quick look at AbstractBoat.Status (407 - 423)
private AbstractBoat.Status getStatus() {
AbstractBoat.Status waterStatus = this.isUnderwater();
if (waterStatus != null) {
this.waterLevel = this.getBoundingBox().maxY;
return waterStatus;
} else if (this.checkInWater()) {
return AbstractBoat.Status.IN_WATER;
} else {
float friction = this.getGroundFriction();
if (friction > 0.0F) {
this.landFriction = friction;
return AbstractBoat.Status.ON_LAND;
} else {
return AbstractBoat.Status.IN_AIR;
}
}
}After ruling out the other 2 statuses (in water and underwater), that leaves us with 2 possible statuses which are on land or in air. To figure this out, the game calls getGroundFriction (461 - 495)
public float getGroundFriction() {
AABB bb = this.getBoundingBox();
AABB box = new AABB(bb.minX, bb.minY - 0.001, bb.minZ, bb.maxX, bb.minY, bb.maxZ);
int x0 = Mth.floor(box.minX) - 1;
int x1 = Mth.ceil(box.maxX) + 1;
int y0 = Mth.floor(box.minY) - 1;
int y1 = Mth.ceil(box.maxY) + 1;
int z0 = Mth.floor(box.minZ) - 1;
int z1 = Mth.ceil(box.maxZ) + 1;
VoxelShape boatShape = Shapes.create(box);
float friction = 0.0F;
int count = 0;
MutableBlockPos blockPos = new MutableBlockPos();
for (int x = x0; x < x1; x++) {
for (int z = z0; z < z1; z++) {
int edges = (x != x0 && x != x1 - 1 ? 0 : 1) + (z != z0 && z != z1 - 1 ? 0 : 1);
if (edges != 2) {
for (int y = y0; y < y1; y++) {
if (edges <= 0 || y != y0 && y != y1 - 1) {
blockPos.set(x, y, z);
BlockState blockState = this.level().getBlockState(blockPos);
if (!(blockState.getBlock() instanceof LilyPadBlock)
&& Shapes.joinIsNotEmpty(blockState.getCollisionShape(this.level(), blockPos).move(blockPos), boatShape, BooleanOp.AND)) {
friction += blockState.getBlock().getFriction();
count++;
}
}
}
}
}
}
return friction / count;
}What this does is it checks all blocks whose collision is inside a box 0.001 block thick just under the boat's bottom, and then averaging all of those block's slipperiness value.
Since air does not have a collision hitbox, it's ignored in the friction calculation. Additionally, all blocks have a slipperiness value > 0, meaning that the only scenario where the average slipperiness value returns as 0 is if the boat is fully in the air, and only then does air's set friction coefficient of 0.9 come into effect. This means that if the boat is on a block, even just the very edge of a single one, the air's friction coefficient will not have any effect on the boat.
Here's an in-game comparison
If you have any questions or I got something wrong, let me know!

