From d0a2f6ac2782c0f6f1fc2e3bceb73081349d867a Mon Sep 17 00:00:00 2001 From: ForceUpdate1 Date: Mon, 4 May 2020 08:06:08 +0200 Subject: [PATCH] Fix movement issues #466 (#473) --- .../geysermc/connector/network/session/GeyserSession.java | 7 ++----- .../connector/network/session/cache/TeleportCache.java | 3 ++- .../translators/bedrock/BedrockMovePlayerTranslator.java | 5 +++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java index 623e385d..51cc0923 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/GeyserSession.java @@ -40,10 +40,7 @@ import com.github.steveice10.packetlib.packet.Packet; import com.github.steveice10.packetlib.tcp.TcpSessionFactory; import com.nukkitx.math.GenericMath; import com.nukkitx.math.TrigMath; -import com.nukkitx.math.vector.Vector2f; -import com.nukkitx.math.vector.Vector2i; -import com.nukkitx.math.vector.Vector3f; -import com.nukkitx.math.vector.Vector3i; +import com.nukkitx.math.vector.*; import com.nukkitx.protocol.bedrock.BedrockServerSession; import com.nukkitx.protocol.bedrock.data.ContainerId; import com.nukkitx.protocol.bedrock.data.GamePublishSetting; @@ -474,7 +471,7 @@ public class GeyserSession implements CommandSender { upstream.sendPacket(startGamePacket); } - public boolean confirmTeleport(Vector3f position) { + public boolean confirmTeleport(Vector3d position) { if (teleportCache != null) { if (!teleportCache.canConfirm(position)) { GeyserConnector.getInstance().getLogger().debug("Unconfirmed Teleport " + teleportCache.getTeleportConfirmId() diff --git a/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java b/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java index 55b7e6fa..475630db 100644 --- a/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java +++ b/connector/src/main/java/org/geysermc/connector/network/session/cache/TeleportCache.java @@ -25,6 +25,7 @@ package org.geysermc.connector.network.session.cache; +import com.nukkitx.math.vector.Vector3d; import com.nukkitx.math.vector.Vector3f; import lombok.AllArgsConstructor; import lombok.Data; @@ -39,7 +40,7 @@ public class TeleportCache { private double x, y, z; private int teleportConfirmId; - public boolean canConfirm(Vector3f position) { + public boolean canConfirm(Vector3d position) { return (Math.abs(this.x - position.getX()) < ERROR && Math.abs(this.y - position.getY()) < ERROR_Y && Math.abs(this.z - position.getZ()) < ERROR); 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 be158746..49b0b7fc 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 @@ -25,6 +25,7 @@ package org.geysermc.connector.network.translators.bedrock; +import com.nukkitx.math.vector.Vector3d; import org.geysermc.common.ChatColor; import org.geysermc.connector.entity.Entity; import org.geysermc.connector.entity.PlayerEntity; @@ -63,7 +64,7 @@ public class BedrockMovePlayerTranslator extends PacketTranslator