From 3298cdbc3cb444e3f505361316e0d45feedcd924 Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Sun, 3 Nov 2024 03:23:00 +0800 Subject: [PATCH] Small fixes; start on new rotation packet why is bedrock weird with player rotation --- .../type/player/SessionPlayerEntity.java | 14 ++++++- .../JavaFinishConfigurationTranslator.java | 4 +- .../player/JavaCookieRequestTranslator.java | 2 +- .../player/JavaPlayerPositionTranslator.java | 14 +++++-- .../player/JavaPlayerRotationTranslator.java | 42 +++++++++++++++++++ 5 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 core/src/main/java/org/geysermc/geyser/translator/protocol/java/entity/player/JavaPlayerRotationTranslator.java diff --git a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java index a8b0765f3..5db47a34a 100644 --- a/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java +++ b/core/src/main/java/org/geysermc/geyser/entity/type/player/SessionPlayerEntity.java @@ -34,12 +34,13 @@ import org.cloudburstmc.math.vector.Vector3f; import org.cloudburstmc.protocol.bedrock.data.AttributeData; import org.cloudburstmc.protocol.bedrock.data.entity.EntityDataTypes; import org.cloudburstmc.protocol.bedrock.data.entity.EntityFlag; +import org.cloudburstmc.protocol.bedrock.packet.MoveEntityAbsolutePacket; import org.cloudburstmc.protocol.bedrock.packet.MovePlayerPacket; import org.cloudburstmc.protocol.bedrock.packet.UpdateAttributesPacket; import org.geysermc.geyser.entity.attribute.GeyserAttributeType; import org.geysermc.geyser.item.Items; -import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.level.BedrockDimension; +import org.geysermc.geyser.network.GameProtocol; import org.geysermc.geyser.session.GeyserSession; import org.geysermc.geyser.util.AttributeUtils; import org.geysermc.geyser.util.DimensionUtils; @@ -338,6 +339,17 @@ public class SessionPlayerEntity extends PlayerEntity { this.vehicleJumpStrength = MathUtils.constrain(vehicleJumpStrength, 0, 100); } + public void forceRotationUpdate() { + MoveEntityAbsolutePacket absolutePacket = new MoveEntityAbsolutePacket(); + absolutePacket.setPosition(this.getPosition()); + absolutePacket.setRotation(this.getBedrockRotation()); + absolutePacket.setRuntimeEntityId(this.getGeyserId()); + absolutePacket.setForceMove(true); + absolutePacket.setOnGround(this.isOnGround()); + + session.sendUpstreamPacket(absolutePacket); + } + private boolean isBelowVoidFloor() { return position.getY() < voidFloorPosition(); } diff --git a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaFinishConfigurationTranslator.java b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaFinishConfigurationTranslator.java index d73c2e2ed..0c5dcf31b 100644 --- a/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaFinishConfigurationTranslator.java +++ b/core/src/main/java/org/geysermc/geyser/translator/protocol/java/JavaFinishConfigurationTranslator.java @@ -70,7 +70,9 @@ public class JavaFinishConfigurationTranslator extends PacketTranslator { @@ -76,6 +76,12 @@ public class JavaPlayerPositionTranslator extends PacketTranslator { + + @Override + public void translate(GeyserSession session, ClientboundPlayerRotationPacket packet) { + GeyserImpl.getInstance().getLogger().info(packet.toString()); + // TODO + } +}