3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-26 16:12:42 +01:00

Use set center chunk packet

Dieser Commit ist enthalten in:
creeper123123321 2019-04-05 17:13:26 -03:00
Ursprung 33cd80da7e
Commit d9e057eb4f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0AC57D54786721D1
3 geänderte Dateien mit 5 neuen und 33 gelöschten Zeilen

Datei anzeigen

@ -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);

Datei anzeigen

@ -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);
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); 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);
} }

Datei anzeigen

@ -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);