From ef5125e972d4fad62efcedb8883d1c162f0b9c54 Mon Sep 17 00:00:00 2001 From: Marco Neuhaus Date: Wed, 23 Jan 2019 15:02:55 +0100 Subject: [PATCH] fix rewrite --- .../packets/BlockItemPackets1_13.java | 21 +++++++++++++++---- .../packets/EntityPackets1_13.java | 3 ++- .../packets/PlayerPacket1_13.java | 12 ++++------- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java index d9ecd5ec..3df10655 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/BlockItemPackets1_13.java @@ -190,9 +190,9 @@ public class BlockItemPackets1_13 extends BlockItemRewriter { // Rewrite items else if (typeId == 6) { meta.setMetaType(MetaType1_12.Slot); - getProtocol().getBlockItemPackets().handleItemToClient((Item) meta.getValue()); + Item item = (Item) meta.getValue(); + meta.setValue(getProtocol().getBlockItemPackets().handleItemToClient(item)); } // Discontinue particles diff --git a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java index 44edf8ff..6137d1ee 100644 --- a/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java +++ b/core/src/main/java/nl/matsv/viabackwards/protocol/protocol1_12_2to1_13/packets/PlayerPacket1_13.java @@ -34,19 +34,16 @@ public class PlayerPacket1_13 extends Rewriter { for (int i = 0; i < size; i++) { //Input Item Item input = wrapper.read(Type.FLAT_ITEM); - getProtocol().getBlockItemPackets().handleItemToClient(input); - wrapper.write(Type.ITEM, input); + wrapper.write(Type.ITEM, getProtocol().getBlockItemPackets().handleItemToClient(input)); //Output Item Item output = wrapper.read(Type.FLAT_ITEM); - getProtocol().getBlockItemPackets().handleItemToClient(output); - wrapper.write(Type.ITEM, output); + wrapper.write(Type.ITEM, getProtocol().getBlockItemPackets().handleItemToClient(output)); boolean secondItem = wrapper.passthrough(Type.BOOLEAN); //Has second item if (secondItem) { //Second Item Item second = wrapper.read(Type.FLAT_ITEM); - getProtocol().getBlockItemPackets().handleItemToClient(second); - wrapper.write(Type.ITEM, second); + wrapper.write(Type.ITEM, getProtocol().getBlockItemPackets().handleItemToClient(second)); } wrapper.passthrough(Type.BOOLEAN); //Trade disabled @@ -207,8 +204,7 @@ public class PlayerPacket1_13 extends Rewriter { if (channel.equals("MC|BSign") || channel.equals("MC|BEdit")) { wrapper.setId(0x0B); Item book = wrapper.read(Type.ITEM); - getProtocol().getBlockItemPackets().handleItemToServer(book); - wrapper.write(Type.FLAT_ITEM, book); + wrapper.write(Type.FLAT_ITEM, getProtocol().getBlockItemPackets().handleItemToServer(book)); boolean signing = channel.equals("MC|BSign"); wrapper.write(Type.BOOLEAN, signing); } else if (channel.equals("MC|ItemName")) {