From f0e01ab1c9427d7028ede5574a3a712a4e826710 Mon Sep 17 00:00:00 2001 From: RednedEpic Date: Tue, 25 Feb 2020 18:50:09 -0600 Subject: [PATCH] Fix getting stuck in wall bug Due to java doubles being somewhat more "precise" and bedrock positions being sent in floats instead, this caused bedrock players to get stuck in blocks when jumping or running near them in a certain way, thus causing the server to try and correct their position, potentially flagging anticheats and causing the server to print a "moved wrongly" message in console. See: https://stackoverflow.com/questions/322749/retain-precision-with-double-in-java --- .../translators/bedrock/BedrockMovePlayerTranslator.java | 4 ++-- .../player/JavaPlayerPositionRotationTranslator.java | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMovePlayerTranslator.java b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMovePlayerTranslator.java index d89060f6a..12e61de55 100644 --- a/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMovePlayerTranslator.java +++ b/connector/src/main/java/org/geysermc/connector/network/translators/bedrock/BedrockMovePlayerTranslator.java @@ -26,6 +26,7 @@ package org.geysermc.connector.network.translators.bedrock; import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlayerPositionRotationPacket; +import com.nukkitx.math.GenericMath; import com.nukkitx.math.vector.Vector3f; import com.nukkitx.protocol.bedrock.packet.MoveEntityAbsolutePacket; import com.nukkitx.protocol.bedrock.packet.MovePlayerPacket; @@ -63,8 +64,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator 1.5 || (yDis < 1.45 || yDis > (session.isJumping() ? 4.3 : (session.isSprinting() ? 2.5 : 1.9))) || zDis > 1.5) { entity.moveAbsolute(session, Vector3f.from(packet.getX(), packet.getY(), packet.getZ()), packet.getYaw(), packet.getPitch(), true); }