From d44ecaabf737b5ac6c4e5d72b10a5be05f02742c Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Wed, 13 Mar 2019 19:03:22 +0100 Subject: [PATCH] send difficulty instead of ignoring it --- .../protocol1_14to1_13_2/packets/WorldPackets.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) 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 2c45a5c51..6da9918cc 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 @@ -26,7 +26,7 @@ public class WorldPackets { private static final int VOID_AIR = MappingData.blockStateMappings.getNewBlock(8591); private static final int CAVE_AIR = MappingData.blockStateMappings.getNewBlock(8592); - public static void register(Protocol protocol) { + public static void register(final Protocol protocol) { // Block Break Animation protocol.registerOutgoing(State.PLAY, 0x08, 0x08, new PacketRemapper() { @@ -294,7 +294,11 @@ public class WorldPackets { handler(new PacketHandler() { @Override public void handle(PacketWrapper wrapper) throws Exception { - wrapper.read(Type.UNSIGNED_BYTE); // 19w11a removed difficulty from join game + short difficulty = wrapper.read(Type.UNSIGNED_BYTE); // 19w11a removed difficulty from join game + PacketWrapper difficultyPacket = wrapper.create(0x0D); + difficultyPacket.write(Type.UNSIGNED_BYTE, difficulty); + difficultyPacket.write(Type.BOOLEAN, false); // Unknown value added in 19w11a + difficultyPacket.send(protocol.getClass()); } }); } @@ -332,7 +336,11 @@ public class WorldPackets { handler(new PacketHandler() { @Override public void handle(PacketWrapper wrapper) throws Exception { - wrapper.read(Type.UNSIGNED_BYTE); // 19w11 remobed difficulty from respawn + short difficulty = wrapper.read(Type.UNSIGNED_BYTE); // 19w11a removed difficulty from respawn + PacketWrapper difficultyPacket = wrapper.create(0x0D); + difficultyPacket.write(Type.UNSIGNED_BYTE, difficulty); + difficultyPacket.write(Type.BOOLEAN, false); // Unknown value added in 19w11a + difficultyPacket.send(protocol.getClass()); } }); }