From 57931e7231215a473edea1f88bc2614b7b7645d5 Mon Sep 17 00:00:00 2001 From: Myles Date: Mon, 21 Mar 2016 22:28:11 +0000 Subject: [PATCH] Patch inventory shield bug --- .../transformers/IncomingTransformer.java | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java b/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java index 3a91b088c..75acf3441 100644 --- a/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java +++ b/src/main/java/us/myles/ViaVersion/transformers/IncomingTransformer.java @@ -45,7 +45,7 @@ public class IncomingTransformer { } // Handle movement increment // Update idle status (player, position, look, positionandlook) - if(packet == PacketType.PLAY_PLAYER || packet == PacketType.PLAY_PLAYER_POSITION_REQUEST || packet == PacketType.PLAY_PLAYER_LOOK_REQUEST || packet == PacketType.PLAY_PLAYER_POSITION_LOOK_REQUEST) { + if (packet == PacketType.PLAY_PLAYER || packet == PacketType.PLAY_PLAYER_POSITION_REQUEST || packet == PacketType.PLAY_PLAYER_LOOK_REQUEST || packet == PacketType.PLAY_PLAYER_POSITION_LOOK_REQUEST) { info.incrementIdlePacket(); } PacketUtil.writeVarInt(packetID, output); @@ -163,6 +163,18 @@ public class IncomingTransformer { if (packet == PacketType.PLAY_CLOSE_WINDOW_REQUEST) { info.closeWindow(); } + if (packet == PacketType.PLAY_CLIENT_STATUS) { + int action = PacketUtil.readVarInt(input); + PacketUtil.writeVarInt(action, input); + + if (action == 2) { + // cancel any blocking >.> + if (startedBlocking) { + sendSecondHandItem(null); + startedBlocking = false; + } + } + } if (packet == PacketType.PLAY_CLIENT_SETTINGS) { String locale = PacketUtil.readString(input); PacketUtil.writeString(locale, output); @@ -281,13 +293,13 @@ public class IncomingTransformer { } catch (Exception e) { e.printStackTrace(); } - short curX = input.readUnsignedByte(); - output.writeByte(curX); - short curY = input.readUnsignedByte(); - output.writeByte(curY); - short curZ = input.readUnsignedByte(); - output.writeByte(curZ); - return; + short curX = input.readUnsignedByte(); + output.writeByte(curX); + short curY = input.readUnsignedByte(); + output.writeByte(curY); + short curZ = input.readUnsignedByte(); + output.writeByte(curZ); + return; } if (packet == PacketType.PLAY_USE_ITEM) { int hand = PacketUtil.readVarInt(input);