From d3f92ce9b81a0bef89c407f29a6f7a7e5e783268 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 26 Nov 2024 17:34:57 +0100 Subject: [PATCH] Don't swap teleport accept and move packets for 1.21.4 clients They changed it again. Probably missing the same swap in 1.21.4<->1.21.2 now --- .../protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java | 11 ++++++++--- .../rewriter/EntityPacketRewriter1_21_2.java | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java index 51dd1628a..7dc6c761a 100644 --- a/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java +++ b/common/src/main/java/com/viaversion/viaversion/protocols/v1_21to1_21_2/Protocol1_21To1_21_2.java @@ -172,7 +172,8 @@ public final class Protocol1_21To1_21_2 extends AbstractProtocol wrapper.user().get(BundleStateTracker.class).toggleBundling()); registerServerbound(ServerboundPackets1_21_2.PONG, wrapper -> { final int id = wrapper.passthrough(Types.INT); // id - if (wrapper.user().get(PlayerPositionStorage.class).checkPong(id)) { + final PlayerPositionStorage playerPositionStorage = wrapper.user().get(PlayerPositionStorage.class); + if (playerPositionStorage != null && playerPositionStorage.checkPong(id)) { wrapper.cancel(); } }); @@ -234,13 +235,17 @@ public final class Protocol1_21To1_21_2 extends AbstractProtocol { final PlayerPositionStorage playerPositionStorage = wrapper.user().get(PlayerPositionStorage.class); - if (playerPositionStorage.checkHasPlayerPosition()) { + if (playerPositionStorage != null && playerPositionStorage.checkHasPlayerPosition()) { // Send move player after accept teleportation wrapper.sendToServer(Protocol1_21To1_21_2.class); wrapper.cancel();