From 5c5c1ed40211fefc97b8013ae00cb42669cc0837 Mon Sep 17 00:00:00 2001 From: KennyTV Date: Wed, 13 May 2020 18:08:33 +0200 Subject: [PATCH] 20w20a --- .../api/protocol/ProtocolVersion.java | 2 +- .../packets/EntityPackets.java | 31 +++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java index 8f80de3dd..94aa6dc20 100644 --- a/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java +++ b/common/src/main/java/us/myles/ViaVersion/api/protocol/ProtocolVersion.java @@ -80,7 +80,7 @@ public class ProtocolVersion { register(v1_15 = new ProtocolVersion(573, "1.15")); register(v1_15_1 = new ProtocolVersion(575, "1.15.1")); register(v1_15_2 = new ProtocolVersion(578, "1.15.2")); - register(v1_16 = new ProtocolVersion(715, "1.16")); + register(v1_16 = new ProtocolVersion(716, "1.16")); register(unknown = new ProtocolVersion(-1, "UNKNOWN")); } diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/packets/EntityPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/packets/EntityPackets.java index 206e2f62b..8ed8eaccf 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/packets/EntityPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16to1_15_2/packets/EntityPackets.java @@ -10,6 +10,7 @@ import us.myles.ViaVersion.packets.State; import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.Protocol1_16To1_15_2; import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.data.MappingData; import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.metadata.MetadataRewriter1_16To1_15_2; +import us.myles.ViaVersion.protocols.protocol1_16to1_15_2.storage.EntityTracker1_16; import us.myles.ViaVersion.protocols.protocol1_9_3to1_9_1_2.storage.ClientWorld; public class EntityPackets { @@ -39,19 +40,45 @@ public class EntityPackets { map(Type.INT); map(Type.LONG); map(Type.BYTE); - map(Type.STRING); handler(wrapper -> { ClientWorld clientWorld = wrapper.user().get(ClientWorld.class); int dimensionId = wrapper.get(Type.INT, 0); clientWorld.setEnvironment(dimensionId); + String levelType = wrapper.read(Type.STRING); + wrapper.write(Type.BOOLEAN, false); // debug + wrapper.write(Type.BOOLEAN, levelType.equals("flat")); wrapper.write(Type.BOOLEAN, true); // keep all playerdata }); } }); // Join Game - metadataRewriter.registerJoinGame(0x26, 0x26, Entity1_16Types.EntityType.PLAYER); + protocol.registerOutgoing(State.PLAY, 0x26, 0x26, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.INT); // Entity ID + map(Type.UNSIGNED_BYTE); // Gamemode + map(Type.INT); // Dimension + map(Type.LONG); // Seed + map(Type.UNSIGNED_BYTE); // Max players + handler(wrapper -> { + ClientWorld clientChunks = wrapper.user().get(ClientWorld.class); + int dimensionId = wrapper.get(Type.INT, 1); + clientChunks.setEnvironment(dimensionId); + + wrapper.user().get(EntityTracker1_16.class).addEntity(wrapper.get(Type.INT, 0), Entity1_16Types.EntityType.PLAYER); + + final String type = wrapper.read(Type.STRING);// level type + wrapper.passthrough(Type.VAR_INT); // View distance + wrapper.passthrough(Type.BOOLEAN); // Reduced debug info + wrapper.passthrough(Type.BOOLEAN); // Show death screen + + wrapper.write(Type.BOOLEAN, false); // Debug + wrapper.write(Type.BOOLEAN, type.equals("flat")); + }); + } + }); // Entity Properties protocol.registerOutgoing(State.PLAY, 0x59, 0x59, new PacketRemapper() {