From d9e057eb4ff2dc13f5015914b4129fc286e2ecd7 Mon Sep 17 00:00:00 2001 From: creeper123123321 Date: Fri, 5 Apr 2019 17:13:26 -0300 Subject: [PATCH] Use set center chunk packet --- .../Protocol1_14To1_13_2.java | 13 +----------- .../packets/WorldPackets.java | 20 ++++--------------- .../storage/EntityTracker.java | 5 ----- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java index a1f961d4e..79be0c42f 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/Protocol1_14To1_13_2.java @@ -52,18 +52,7 @@ public class Protocol1_14To1_13_2 extends Protocol { registerOutgoing(State.PLAY, 0x30, 0x33); registerOutgoing(State.PLAY, 0x31, 0x34); // Position and look - registerOutgoing(State.PLAY, 0x32, 0x35, new PacketRemapper() { - @Override - public void registerMap() { - handler(new PacketHandler() { - @Override - public void handle(PacketWrapper wrapper) throws Exception { - EntityTracker tracker = wrapper.user().get(EntityTracker.class); - tracker.setSentPosAndLook(true); - } - }); - } - }); + registerOutgoing(State.PLAY, 0x32, 0x35); registerOutgoing(State.PLAY, 0x34, 0x36); diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java index 9df7d6e74..83f8e0ae6 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/WorldPackets.java @@ -190,22 +190,10 @@ public class WorldPackets { lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0])); } - double chunkBlockX = chunk.getX() << 4; - double chunkBlockZ = chunk.getZ() << 4; - - EntityTracker tracker = wrapper.user().get(EntityTracker.class); - if (!tracker.isSentPosAndLook()) { // Workaround for 1.13.2 not loading chunks near to world border on join - PacketWrapper fakePosLook = wrapper.create(0x35); - fakePosLook.write(Type.DOUBLE, chunkBlockX); - fakePosLook.write(Type.DOUBLE, 0d); // Y - fakePosLook.write(Type.DOUBLE, chunkBlockZ); - fakePosLook.write(Type.FLOAT, 0f); // Yaw - fakePosLook.write(Type.FLOAT, 0f); // Pitch - fakePosLook.write(Type.BYTE, (byte) 0); // All - fakePosLook.write(Type.VAR_INT, -1); // Confirmation id - fakePosLook.send(Protocol1_14To1_13_2.class, true, true); - tracker.setSentPosAndLook(true); - } + PacketWrapper fakePosLook = wrapper.create(0x40); // Set center chunk + fakePosLook.write(Type.VAR_INT, chunk.getX()); + fakePosLook.write(Type.VAR_INT, chunk.getZ()); + fakePosLook.send(Protocol1_14To1_13_2.class, true, true); lightPacket.send(Protocol1_14To1_13_2.class, true, false); } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/storage/EntityTracker.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/storage/EntityTracker.java index 8abef1ae6..da3c0e057 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/storage/EntityTracker.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/storage/EntityTracker.java @@ -1,8 +1,6 @@ package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage; import com.google.common.base.Optional; -import lombok.Getter; -import lombok.Setter; import us.myles.ViaVersion.api.data.StoredObject; import us.myles.ViaVersion.api.data.UserConnection; import us.myles.ViaVersion.api.entities.Entity1_14Types; @@ -13,9 +11,6 @@ import java.util.concurrent.ConcurrentHashMap; public class EntityTracker extends StoredObject { private final Map clientEntityTypes = new ConcurrentHashMap<>(); - @Getter - @Setter - private boolean sentPosAndLook; public EntityTracker(UserConnection user) { super(user);