mojira.dev
MC-108948

Boats / boats with chest on top of slime blocks hover over block

The bug

When a boat is falling while over a slime block, once it gets to about 5 blocks on top of the slime block, the boat will start rising and falling very slowly. As of 22w12a, this also occurs with boats with chests. As of 1.21.2 Pre-Release 2, the effect is not as large and does not occur with every bounce, but still happens.

How to reproduce

Video demonstrating the issue: https://gfycat.com/PrestigiousDistantGardensnake

Code analysis

Code analysis by @unknown can be found in this comment.

Related issues

Attachments

Comments

migrated
[media][media][media][media]
migrated

Confirmed for 1.12

Actually the boat movements seems to get softened, and that makes it visually bounce on the air when it hits the slime block server-side and it goes up again before it hits the ground client-side.

MC-111271 describes it better, and the gif in this issue is still relevant for 1.12.

EDIT: on a side note, slime blocks pushed by pistons sometimes fail to launch a boat in the air and only push it a few blocks. Is that a different issue?

JUE13

Confirmed for 1.12-pre6

migrated
migrated

A possible cause could be an interference with how the game extrapolates positions of a moving object and with collision detection. A similar behavior is seen in MC-110648 (possibly the same cause, different issue though). This issue is also in 18w08b.

migrated

Confirmed for 1.13.1.

migrated

Confirmed for 1.13.2-pre2.

BCNOFNeNaMg

Confirmed for 19w34a.

SPGoding

@unknown, 1.15 is already added in the Affected Versions.

migrated

Confirmed for 20w18a.

migrated

Confirmed for 20w45a, but also the boat now breaks after a couple of bounces.

[media]
migrated

What does this look like with hitboxes enabled f3+b?

migrated

Marty McFly, the hitbox of the boat follows the boat. If the question is about it breaking, it still happens when in the center of a 3x3; making it not specific to being over the block. And it also breaks with mobs in it.

migrated

I was thinking it could be a rending issue. Minecarts have tons of similar issues MC-158169 where the hitbox is in the correct place, but not the entity. Based on your reply this does not seem to be the case.

migrated

Relates to MC-119369

Avoma

Can confirm in 20w48a.

Avoma

Can confirm in 21w03a.

Avoma

Can confirm in 1.18 Pre-release 1.

[media][media]
PR0CESS

Code Analysis (Yarn - 1.18.1)

The issue here is that the client does not run the same calculations as the server.

BoatEntity.java

public void tick() {
   //...
   if (this.isLogicalSideForUpdatingMovement()) {
      if (!(this.getFirstPassenger() instanceof PlayerEntity)) {
         this.setPaddleMovings(false, false);
      }

      this.updateVelocity();
      if (this.world.isClient) {
         this.updatePaddles();
         this.world.sendPacket(new BoatPaddleStateC2SPacket());
      }

      this.move(MovementType.SELF, this.getVelocity());
   } else {
      this.setVelocity(Vec3d.ZERO);
   }
   //...
}

isLogicalSideForUpdatingMovement() returns true if the client is running the code and the client player is controlling the boat, or if the server is running the code.

Basically, when you are not controlling the boat, the client will run this.setVelocity(Vec3d.ZERO); instead of running the actual physics.
Resulting in de-sync of the client & server.

Proposed Fix:

public void tick() {
   //...
   if (!(this.getFirstPassenger() instanceof PlayerEntity)) {
      this.setPaddleMovings(false, false);
   }

   this.updateVelocity();
   if (this.world.isClient && this.isLogicalSideForUpdatingMovement()) {
      this.updatePaddles();
      this.world.sendPacket(new BoatPaddleStateC2SPacket());
   }

   this.move(MovementType.SELF, this.getVelocity());
   //...
}

This has been tested and works perfectly. It will simply allow the client to run the physics while still limiting the updating & packets for when it's being controlled.

isXander

Wouldn't it be

if (this.world.isClient && this.isLogicalSideForUpdatingMovement())
Avoma

Can confirm in 1.18.2 and 22w16b.

Avoma

Can confirm in 1.19.2.

BCNOFNeNaMg

(Unassigned)

Confirmed

Gameplay

Normal

Entities

boat, boat-with-chest, slime_block

Minecraft 1.10.2, Minecraft 16w41a, Minecraft 16w42a, Minecraft 1.11.2, Minecraft 1.12 Pre-Release 6, ..., 1.20.1, 1.20.3 Pre-Release 2, 1.21, 24w34a, 1.21.2 Pre-Release 2

Retrieved