From 597ddc7f82c913e73e6fe2736417d228b84d3e5e Mon Sep 17 00:00:00 2001 From: Mats Date: Tue, 15 Mar 2016 20:37:45 +0100 Subject: [PATCH 1/2] Throw items when you try to put things in your second hand in creative. --- .../ViaVersion/transformers/IncomingTransformer.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java b/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java index e3b5c5699..2f15b5596 100644 --- a/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java +++ b/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java @@ -329,8 +329,18 @@ public class IncomingTransformer { } if (packet == PacketType.PLAY_CREATIVE_INVENTORY_ACTION) { short slot = input.readShort(); + System.out.println(slot); + if (slot == 45) { + ByteBuf buf = info.getChannel().alloc().buffer(); + PacketUtil.writeVarInt(PacketType.PLAY_SET_SLOT.getNewPacketID(), buf); + buf.writeByte(0); + buf.writeShort(slot); + buf.writeShort(-1); // empty + info.sendRawPacket(buf); + // Continue the packet simulating throw + slot = -999; + } output.writeShort(slot); - ItemSlotRewriter.rewrite1_9To1_8(input, output); } output.writeBytes(input); From ba5a44d2d2338d191b1c7276788e62f095d40c68 Mon Sep 17 00:00:00 2001 From: Mats Date: Tue, 15 Mar 2016 20:40:26 +0100 Subject: [PATCH 2/2] Remove debug message --- .../us/myles/ViaVersion/transformers/IncomingTransformer.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java b/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java index 2f15b5596..3a91b088c 100644 --- a/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java +++ b/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java @@ -329,7 +329,6 @@ public class IncomingTransformer { } if (packet == PacketType.PLAY_CREATIVE_INVENTORY_ACTION) { short slot = input.readShort(); - System.out.println(slot); if (slot == 45) { ByteBuf buf = info.getChannel().alloc().buffer(); PacketUtil.writeVarInt(PacketType.PLAY_SET_SLOT.getNewPacketID(), buf);