mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-07 11:09:57 +01:00
Merge pull request #1245 from creeper123123321/dev2
Use set center chunk packet
This commit is contained in:
commit
5333c38972
@ -52,18 +52,7 @@ public class Protocol1_14To1_13_2 extends Protocol {
|
|||||||
registerOutgoing(State.PLAY, 0x30, 0x33);
|
registerOutgoing(State.PLAY, 0x30, 0x33);
|
||||||
registerOutgoing(State.PLAY, 0x31, 0x34);
|
registerOutgoing(State.PLAY, 0x31, 0x34);
|
||||||
// Position and look
|
// Position and look
|
||||||
registerOutgoing(State.PLAY, 0x32, 0x35, new PacketRemapper() {
|
registerOutgoing(State.PLAY, 0x32, 0x35);
|
||||||
@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, 0x34, 0x36);
|
registerOutgoing(State.PLAY, 0x34, 0x36);
|
||||||
|
|
||||||
|
@ -190,22 +190,10 @@ public class WorldPackets {
|
|||||||
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0]));
|
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
double chunkBlockX = chunk.getX() << 4;
|
PacketWrapper fakePosLook = wrapper.create(0x40); // Set center chunk
|
||||||
double chunkBlockZ = chunk.getZ() << 4;
|
fakePosLook.write(Type.VAR_INT, chunk.getX());
|
||||||
|
fakePosLook.write(Type.VAR_INT, chunk.getZ());
|
||||||
EntityTracker tracker = wrapper.user().get(EntityTracker.class);
|
fakePosLook.send(Protocol1_14To1_13_2.class, true, true);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
lightPacket.send(Protocol1_14To1_13_2.class, true, false);
|
lightPacket.send(Protocol1_14To1_13_2.class, true, false);
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage;
|
package us.myles.ViaVersion.protocols.protocol1_14to1_13_2.storage;
|
||||||
|
|
||||||
import com.google.common.base.Optional;
|
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.StoredObject;
|
||||||
import us.myles.ViaVersion.api.data.UserConnection;
|
import us.myles.ViaVersion.api.data.UserConnection;
|
||||||
import us.myles.ViaVersion.api.entities.Entity1_14Types;
|
import us.myles.ViaVersion.api.entities.Entity1_14Types;
|
||||||
@ -13,9 +11,6 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
|
|
||||||
public class EntityTracker extends StoredObject {
|
public class EntityTracker extends StoredObject {
|
||||||
private final Map<Integer, Entity1_14Types.EntityType> clientEntityTypes = new ConcurrentHashMap<>();
|
private final Map<Integer, Entity1_14Types.EntityType> clientEntityTypes = new ConcurrentHashMap<>();
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
private boolean sentPosAndLook;
|
|
||||||
|
|
||||||
public EntityTracker(UserConnection user) {
|
public EntityTracker(UserConnection user) {
|
||||||
super(user);
|
super(user);
|
||||||
|
Loading…
Reference in New Issue
Block a user