Fix: Don't include player offset when querying player position in the api (#5168)

This commit is contained in:
chris 2024-11-27 22:51:59 +08:00 committed by GitHub
parent 47b68f8140
commit c145c3f495
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View file

@ -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();
}

View file

@ -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());
}
}