From c145c3f495b1e9f05e15b65da8c813b2e9a5f11f Mon Sep 17 00:00:00 2001 From: chris Date: Wed, 27 Nov 2024 22:51:59 +0800 Subject: [PATCH] Fix: Don't include player offset when querying player position in the api (#5168) --- .../geyser/api/entity/type/player/GeyserPlayerEntity.java | 4 ++-- .../geysermc/geyser/entity/type/player/PlayerEntity.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/src/main/java/org/geysermc/geyser/api/entity/type/player/GeyserPlayerEntity.java b/api/src/main/java/org/geysermc/geyser/api/entity/type/player/GeyserPlayerEntity.java index bba4dbf3e..d31def996 100644 --- a/api/src/main/java/org/geysermc/geyser/api/entity/type/player/GeyserPlayerEntity.java +++ b/api/src/main/java/org/geysermc/geyser/api/entity/type/player/GeyserPlayerEntity.java @@ -31,9 +31,9 @@ import org.geysermc.geyser.api.entity.type.GeyserEntity; public interface GeyserPlayerEntity extends GeyserEntity { /** - * Gets the position of the player. + * Gets the position of the player, as it is known to the Java server. * - * @return the position of the player. + * @return the player's position */ Vector3f position(); } diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java index 7e747e33d..7a443d6e8 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/PlayerEntity.java @@ -97,11 +97,11 @@ public class PlayerEntity extends LivingEntity implements GeyserPlayerEntity { /** * Saves the parrot currently on the player's left shoulder; otherwise null */ - private ParrotEntity leftParrot; + private @Nullable ParrotEntity leftParrot; /** * Saves the parrot currently on the player's right shoulder; otherwise null */ - private ParrotEntity rightParrot; + private @Nullable ParrotEntity rightParrot; public PlayerEntity(GeyserSession session, int entityId, long geyserId, UUID uuid, Vector3f position, Vector3f motion, float yaw, float pitch, float headYaw, String username, @Nullable String texturesProperty) { @@ -450,6 +450,6 @@ public class PlayerEntity extends LivingEntity implements GeyserPlayerEntity { @Override public Vector3f position() { - return this.position.clone(); + return this.position.down(definition.offset()); } }