From 04a692022aad6b627fe310625b7578f935152a42 Mon Sep 17 00:00:00 2001 From: EnZaXD Date: Thu, 7 Nov 2024 09:11:38 +0100 Subject: [PATCH] Move config option check for player face fix into packet handlers (#913) --- .../rewriter/EntityPacketRewriter1_13.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/EntityPacketRewriter1_13.java b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/EntityPacketRewriter1_13.java index a1e8cf27..38b1bbf7 100644 --- a/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/EntityPacketRewriter1_13.java +++ b/common/src/main/java/com/viaversion/viabackwards/protocol/v1_13to1_12_2/rewriter/EntityPacketRewriter1_13.java @@ -237,17 +237,18 @@ public class EntityPacketRewriter1_13 extends LegacyEntityRewriter { - final double x = wrapper.passthrough(Types.DOUBLE); - final double y = wrapper.passthrough(Types.DOUBLE); - final double z = wrapper.passthrough(Types.DOUBLE); - wrapper.user().get(PlayerPositionStorage1_13.class).setPosition(x, y, z); - }; - protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_PLAYER_POS, movementRemapper); // Player Position - protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_PLAYER_POS_ROT, movementRemapper); // Player Position And Look (serverbound) - protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_VEHICLE, movementRemapper); // Vehicle Move (serverbound) - } + PacketHandler movementRemapper = wrapper -> { + if (!ViaBackwards.getConfig().isFix1_13FacePlayer()) { + return; + } + final double x = wrapper.passthrough(Types.DOUBLE); + final double y = wrapper.passthrough(Types.DOUBLE); + final double z = wrapper.passthrough(Types.DOUBLE); + wrapper.user().get(PlayerPositionStorage1_13.class).setPosition(x, y, z); + }; + protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_PLAYER_POS, movementRemapper); // Player Position + protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_PLAYER_POS_ROT, movementRemapper); // Player Position And Look (serverbound) + protocol.registerServerbound(ServerboundPackets1_12_1.MOVE_VEHICLE, movementRemapper); // Vehicle Move (serverbound) } @Override