From 597ddc7f82c913e73e6fe2736417d228b84d3e5e Mon Sep 17 00:00:00 2001 From: Mats Date: Tue, 15 Mar 2016 20:37:45 +0100 Subject: [PATCH] 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);