19w13b and workaround for chunks not loading near to world border on 1.13.2 on join

This commit is contained in:
creeper123123321 2019-03-30 09:26:31 -03:00
parent acee33aae6
commit 475fb97730
No known key found for this signature in database
GPG Key ID: 0AC57D54786721D1
12 changed files with 46 additions and 11 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-19w13a</version> <version>2.0.0-19w13b</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-19w13a</version> <version>2.0.0-19w13b</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-19w13a</version> <version>2.0.0-19w13b</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -67,7 +67,7 @@ public class ProtocolVersion {
register(v1_13 = new ProtocolVersion(393, "1.13")); register(v1_13 = new ProtocolVersion(393, "1.13"));
register(v1_13_1 = new ProtocolVersion(401, "1.13.1")); register(v1_13_1 = new ProtocolVersion(401, "1.13.1"));
register(v1_13_2 = new ProtocolVersion(404, "1.13.2")); register(v1_13_2 = new ProtocolVersion(404, "1.13.2"));
register(v1_14 = new ProtocolVersion(468, "1.14")); register(v1_14 = new ProtocolVersion(469, "1.14"));
register(unknown = new ProtocolVersion(-1, "UNKNOWN")); register(unknown = new ProtocolVersion(-1, "UNKNOWN"));
} }

View File

@ -34,7 +34,19 @@ public class Protocol1_14To1_13_2 extends Protocol {
registerOutgoing(State.PLAY, 0x2F, 0x30); registerOutgoing(State.PLAY, 0x2F, 0x30);
registerOutgoing(State.PLAY, 0x30, 0x31); registerOutgoing(State.PLAY, 0x30, 0x31);
registerOutgoing(State.PLAY, 0x31, 0x32); registerOutgoing(State.PLAY, 0x31, 0x32);
registerOutgoing(State.PLAY, 0x32, 0x33); // Position and look
registerOutgoing(State.PLAY, 0x32, 0x33, 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);
}
});
}
});
//TODO remove if packet ids stay unchanged in 1.14 release //TODO remove if packet ids stay unchanged in 1.14 release
registerOutgoing(State.PLAY, 0x34, 0x34); registerOutgoing(State.PLAY, 0x34, 0x34);

View File

@ -189,7 +189,25 @@ public class WorldPackets {
buf.release(); buf.release();
lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0])); lightPacket.write(Type.BYTE_ARRAY, Bytes.asList(data).toArray(new Byte[0]));
} }
lightPacket.send(Protocol1_14To1_13_2.class);
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(0x33);
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);
} }
}); });
} }

View File

@ -1,6 +1,8 @@
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;
@ -11,6 +13,9 @@ 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);

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-19w13a</version> <version>2.0.0-19w13b</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<name>viaversion-jar</name> <name>viaversion-jar</name>

View File

@ -6,7 +6,7 @@
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<version>2.0.0-19w13a</version> <version>2.0.0-19w13b</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>viaversion-parent</name> <name>viaversion-parent</name>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-19w13a</version> <version>2.0.0-19w13b</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-19w13a</version> <version>2.0.0-19w13b</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

View File

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>viaversion-parent</artifactId> <artifactId>viaversion-parent</artifactId>
<groupId>us.myles</groupId> <groupId>us.myles</groupId>
<version>2.0.0-19w13a</version> <version>2.0.0-19w13b</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>