|
39 | 39 | import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket; |
40 | 40 | import org.geysermc.geyser.entity.EntityDefinitions; |
41 | 41 | import org.geysermc.geyser.entity.attribute.GeyserAttributeType; |
| 42 | +import org.geysermc.geyser.entity.type.BoatEntity; |
| 43 | +import org.geysermc.geyser.entity.type.Entity; |
42 | 44 | import org.geysermc.geyser.inventory.GeyserItemStack; |
43 | 45 | import org.geysermc.geyser.item.Items; |
44 | 46 | import org.geysermc.geyser.level.BedrockDimension; |
@@ -425,6 +427,28 @@ public void setVehicleJumpStrength(int vehicleJumpStrength) { |
425 | 427 | this.vehicleJumpStrength = MathUtils.constrain(vehicleJumpStrength, 0, 100); |
426 | 428 | } |
427 | 429 |
|
| 430 | + @Override |
| 431 | + public void setVehicle(Entity entity) { |
| 432 | + // For boats, we send width = 0.6 and height = 1.6 since there is otherwise a problem with player "clipping" into the boat when standing on it or running into it. |
| 433 | + // Having a wide bounding box fixed that, however, it is technically incorrect and creates certain problems |
| 434 | + // when you're actually riding the boat (https://github.com/GeyserMC/Geyser/issues/3106), since the box is way too big |
| 435 | + // the boat's motion stops right before the block is hit and doesn't let the actual bounding clip collide into the block, |
| 436 | + // causing the issues. So to fix this, everytime player enter a boat we send the java bounding box and only send the |
| 437 | + // definition box when player is not riding the boat. |
| 438 | + if (entity instanceof BoatEntity) { |
| 439 | + // These bounding box values are based off 1.21.7 |
| 440 | + entity.setBoundingBoxWidth(1.375F); |
| 441 | + entity.setBoundingBoxHeight(0.5625F); |
| 442 | + entity.updateBedrockMetadata(); |
| 443 | + } else if (entity == null && this.vehicle instanceof BoatEntity) { |
| 444 | + this.vehicle.setBoundingBoxWidth(this.vehicle.getDefinition().width()); |
| 445 | + this.vehicle.setBoundingBoxHeight(this.vehicle.getDefinition().height()); |
| 446 | + this.vehicle.updateBedrockMetadata(); |
| 447 | + } |
| 448 | + |
| 449 | + super.setVehicle(entity); |
| 450 | + } |
| 451 | + |
428 | 452 | private boolean isBelowVoidFloor() { |
429 | 453 | return position.getY() < voidFloorPosition(); |
430 | 454 | } |
|
0 commit comments