diff --git a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java index d07ecc96528..65972267554 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java +++ b/connector/src/main/java/org/geysermc/connector/entity/BoatEntity.java @@ -29,6 +29,7 @@ import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.data.entity.EntityData; import com.nukkitx.protocol.bedrock.packet.AnimatePacket; +import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.network.session.GeyserSession; @@ -65,7 +66,19 @@ public BoatEntity(long entityId, long geyserId, EntityType entityType, Vector3f @Override public void moveAbsolute(GeyserSession session, Vector3f position, Vector3f rotation, boolean isOnGround, boolean teleported) { // We don't include the rotation (y) as it causes the boat to appear sideways - super.moveAbsolute(session, position.add(0d, this.entityType.getOffset(), 0d), Vector3f.from(rotation.getX() + 90, 0, rotation.getX() + 90), isOnGround, teleported); + setPosition(position.add(0d, this.entityType.getOffset(), 0d)); + setRotation(Vector3f.from(rotation.getX() + 90, 0, rotation.getX() + 90)); + setOnGround(isOnGround); + + MoveEntityAbsolutePacket moveEntityPacket = new MoveEntityAbsolutePacket(); + moveEntityPacket.setRuntimeEntityId(geyserId); + // Minimal glitching when ServerVehicleMovePacket is sent + moveEntityPacket.setPosition(session.getRidingVehicleEntity() == this ? position.up(EntityType.PLAYER.getOffset() - this.entityType.getOffset()) : this.position); + moveEntityPacket.setRotation(getBedrockRotation()); + moveEntityPacket.setOnGround(isOnGround); + moveEntityPacket.setTeleported(teleported); + + session.sendUpstreamPacket(moveEntityPacket); } @Override @@ -85,7 +98,6 @@ public void updateRotation(GeyserSession session, float yaw, float pitch, boolea @Override public void updateBedrockMetadata(EntityMetadata entityMetadata, GeyserSession session) { - // Time since last hit if (entityMetadata.getId() == 7) { metadata.put(EntityData.HURT_TIME, entityMetadata.getValue()); diff --git a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java index cf169a20971..afcdb7e03d5 100644 --- a/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java +++ b/connector/src/main/java/org/geysermc/connector/entity/type/EntityType.java @@ -130,7 +130,7 @@ public enum EntityType { THROWN_ENDERPEARL(ThrowableEntity.class, 87, 0.25f, 0.25f, 0.25f, 0f, "minecraft:ender_pearl"), LEASH_KNOT(LeashKnotEntity.class, 88, 0.5f, 0.375f), WITHER_SKULL(WitherSkullEntity.class, 89, 0.3125f), - BOAT(BoatEntity.class, 90, 0.7f, 1.6f, 1.6f, 0.35f), + BOAT(BoatEntity.class, 90, 0.6f, 1.6f, 1.6f, 0.35f), WITHER_SKULL_DANGEROUS(WitherSkullEntity.class, 91, 0f), LIGHTNING_BOLT(Entity.class, 93, 0f), SMALL_FIREBALL(ItemedFireballEntity.class, 94, 0.3125f), diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java index b053a204c6c..fbfaafb43f4 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMoveEntityAbsoluteTranslator.java @@ -45,9 +45,8 @@ public void translate(MoveEntityAbsolutePacket packet, GeyserSession session) { float y = packet.getPosition().getY(); if (session.getRidingVehicleEntity() instanceof BoatEntity) { - // Remove some Y position to prevents boats from looking like they're floating in water - // Not by the full boat offset because 1.16.100 complains and that's probably not good for the future - y -= (EntityType.BOAT.getOffset() - 0.5f); + // Remove the offset to prevents boats from looking like they're floating in water + y -= EntityType.BOAT.getOffset(); } ClientVehicleMovePacket clientVehicleMovePacket = new ClientVehicleMovePacket( packet.getPosition().getX(), y, packet.getPosition().getZ(), diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java index 4ae0d7c656f..013c503d084 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/java/world/JavaVehicleMoveTranslator.java @@ -40,7 +40,6 @@ public void translate(ServerVehicleMovePacket packet, GeyserSession session) { Entity entity = session.getRidingVehicleEntity(); if (entity == null) return; - entity.moveAbsolute(session, Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), false, false); - + entity.moveAbsolute(session, Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), false, true); } }