let boats not sink down, use less choppy (but faster) animation (#3949)

* let boats not sink down, use less choppy (but faster) animation

* remove passenger check since that always returns true
This commit is contained in:
chris 2023-07-08 00:14:38 +02:00 committed by GitHub
parent 78e788dca0
commit 872d7e3bb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -66,7 +66,7 @@ public class BoatEntity extends Entity {
private int variant;
// Looks too fast and too choppy with 0.1f, which is how I believe the Microsoftian client handles it
private final float ROWING_SPEED = 0.05f;
private final float ROWING_SPEED = 0.1f;
public BoatEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, EntityDefinition<?> definition, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw) {
// Initial rotation is incorrect

View File

@ -36,7 +36,7 @@ import org.geysermc.geyser.translator.protocol.PacketTranslator;
import org.geysermc.geyser.translator.protocol.Translator;
/**
* Sent by the client when moving a horse.
* Sent by the client when moving a horse or boat.
*/
@Translator(packet = MoveEntityAbsolutePacket.class)
public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator<MoveEntityAbsolutePacket> {
@ -64,7 +64,7 @@ public class BedrockMoveEntityAbsoluteTranslator extends PacketTranslator<MoveEn
}
float y = packet.getPosition().getY();
if (ridingEntity instanceof BoatEntity) {
if (ridingEntity instanceof BoatEntity && !ridingEntity.isOnGround()) {
// Remove the offset to prevents boats from looking like they're floating in water
y -= EntityDefinitions.BOAT.offset();
}

View File

@ -74,7 +74,7 @@ public class BedrockPlayerInputTranslator extends PacketTranslator<PlayerInputPa
if (timeSinceVehicleMove >= 100) {
Vector3f vehiclePosition = vehicle.getPosition();
if (vehicle instanceof BoatEntity) {
if (vehicle instanceof BoatEntity && !vehicle.isOnGround()) {
// Remove some Y position to prevents boats flying up
vehiclePosition = vehiclePosition.down(EntityDefinitions.BOAT.offset());
}