Rewrite cClientHandle::HandleRightClick (#4089)
* Add hand parameter to distinguish main hand/off hand. * Add a new function cClientHandle::HandleUseItem to separate the functionality of using an item without a target block. This matches the protocol with client version >= 1.9 * Always actively update the status of a block if the placement fails (by out of reach or rejected by plugin). * Do not call plugin callback CallHookPlayerRightClick(-1, 255, -1, -1, 0, 0, 0) when using item. The CallHookPlayerUsingItem will still be called. Now at most one of CallHookPlayerRightClick, CallHookPlayerUsingBlock, CallHookPlayerUsingItem and CallHookPlayerEating will be called based on the type of action (not including the used version of callbacks). * Do not count using item as BlockInteractionsRate check (Using item takes time). * Now we can open chests(etc.) when sneaking as long as the player's hand is empty. This is what vanilla server does.
This commit is contained in:
+2
-1
@@ -356,7 +356,7 @@ public: // tolua_export
|
||||
|
||||
void HandlePluginMessage (const AString & a_Channel, const AString & a_Message);
|
||||
void HandleRespawn (void);
|
||||
void HandleRightClick (int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, const cItem & a_HeldItem);
|
||||
void HandleRightClick (int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, eHand a_Hand);
|
||||
void HandleSlotSelected (Int16 a_SlotNum);
|
||||
void HandleSpectate (const cUUID & a_PlayerUUID);
|
||||
void HandleSteerVehicle (float Forward, float Sideways);
|
||||
@@ -368,6 +368,7 @@ public: // tolua_export
|
||||
);
|
||||
void HandleUnmount (void);
|
||||
void HandleUseEntity (UInt32 a_TargetEntityID, bool a_IsLeftClick);
|
||||
void HandleUseItem (eHand a_Hand);
|
||||
void HandleWindowClick (UInt8 a_WindowID, Int16 a_SlotNum, eClickAction a_ClickAction, const cItem & a_HeldItem);
|
||||
void HandleWindowClose (UInt8 a_WindowID);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user