From 7f5073476c5d3d76e4165058ae12a4674f087a9e Mon Sep 17 00:00:00 2001 From: Gerrygames Date: Sat, 15 Dec 2018 20:57:17 +0100 Subject: [PATCH] fix book signing and opening in 18w50a --- .../packets/InventoryPackets.java | 5 +++++ .../protocol1_14to1_13_2/packets/PlayerPackets.java | 13 +++++++++++++ 2 files changed, 18 insertions(+) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/InventoryPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/InventoryPackets.java index 0820eaf9e..09d2b9553 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/InventoryPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/InventoryPackets.java @@ -85,6 +85,11 @@ public class InventoryPackets { wrapper.passthrough(Type.INT); // Number of tools uses wrapper.passthrough(Type.INT); // Maximum number of trade uses } + } else if (channel.equals("minecraft:book_open") || channel.equals("book_open")) { + int hand = wrapper.read(Type.VAR_INT); + wrapper.clearPacket(); + wrapper.setId(0x2C); + wrapper.write(Type.VAR_INT, hand); } } }); diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/PlayerPackets.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/PlayerPackets.java index 6d04c680c..a64f482c2 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/PlayerPackets.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_14to1_13_2/packets/PlayerPackets.java @@ -28,6 +28,19 @@ public class PlayerPackets { } }); + // Edit Book + protocol.registerIncoming(State.PLAY, 0x0B, 0x0B, new PacketRemapper() { + @Override + public void registerMap() { + handler(new PacketHandler() { + @Override + public void handle(PacketWrapper wrapper) throws Exception { + InventoryPackets.toServer(wrapper.passthrough(Type.FLAT_VAR_INT_ITEM)); + } + }); + } + }); + // Player Digging protocol.registerIncoming(State.PLAY, 0x18, 0x18, new PacketRemapper() { @Override