From 7606448b05d657e4f8bcb56f1830d25ff0b58274 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Beltr=C3=A1n?= Date: Mon, 3 Jul 2017 09:37:38 +0200 Subject: [PATCH] Fixes double right click on entities till off-hand actions gets implemented (#3821) --- src/Protocol/Protocol_1_9.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Protocol/Protocol_1_9.cpp b/src/Protocol/Protocol_1_9.cpp index d1b717bd0..5c3be674f 100644 --- a/src/Protocol/Protocol_1_9.cpp +++ b/src/Protocol/Protocol_1_9.cpp @@ -63,6 +63,9 @@ Implements the 1.9 protocol classes: /** The slot number that the client uses to indicate "outside the window". */ static const Int16 SLOT_NUM_OUTSIDE = -999; +/** Value for main hand in Hand parameter for Protocol 1.9. */ +static const UInt32 MAIN_HAND = 0; + @@ -2665,8 +2668,11 @@ void cProtocol_1_9_0::HandlePacketUseEntity(cByteBuffer & a_ByteBuffer) { case 0: { - HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, Hand) - m_Client->HandleUseEntity(EntityID, false); + HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, Hand); + if (Hand == MAIN_HAND) // TODO: implement handling of off-hand actions; ignore them for now to avoid processing actions twice + { + m_Client->HandleUseEntity(EntityID, false); + } break; } case 1: