diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16_4to1_16_3/Protocol1_16_4To1_16_3.java b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16_4to1_16_3/Protocol1_16_4To1_16_3.java index 008e2572f..ce98bb909 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16_4to1_16_3/Protocol1_16_4To1_16_3.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/protocol1_16_4to1_16_3/Protocol1_16_4To1_16_3.java @@ -1,13 +1,29 @@ package us.myles.ViaVersion.protocols.protocol1_16_4to1_16_3; import us.myles.ViaVersion.api.protocol.Protocol; +import us.myles.ViaVersion.api.remapper.PacketRemapper; +import us.myles.ViaVersion.api.type.Type; import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ClientboundPackets1_16_2; import us.myles.ViaVersion.protocols.protocol1_16_2to1_16_1.ServerboundPackets1_16_2; public class Protocol1_16_4To1_16_3 extends Protocol { + public Protocol1_16_4To1_16_3() { + super(ClientboundPackets1_16_2.class, ClientboundPackets1_16_2.class, ServerboundPackets1_16_2.class, ServerboundPackets1_16_2.class); + } + @Override protected void registerPackets() { - + registerIncoming(ServerboundPackets1_16_2.EDIT_BOOK, new PacketRemapper() { + @Override + public void registerMap() { + map(Type.FLAT_VAR_INT_ITEM); + map(Type.BOOLEAN); + handler(wrapper -> { + int slot = wrapper.read(Type.VAR_INT); + wrapper.write(Type.VAR_INT, slot == 40 ? 1 : 0); // 40 = offhand, everything else assumed as mainhand + }); + } + }); } }