Support swap item between main hand and offhand by press key "F" (#4241)
Hi, I found cuberite don't support to press key "F" to swap items on main hand and offhand, so I implemented this feature. Best regards Changyong
This commit is contained in:
committed by
peterbell10
parent
24603a7640
commit
2d3013d1d3
@@ -1188,7 +1188,14 @@ void cClientHandle::HandleLeftClick(int a_BlockX, int a_BlockY, int a_BlockZ, eB
|
||||
|
||||
case DIG_STATUS_SWAP_ITEM_IN_HAND:
|
||||
{
|
||||
// TODO: Not yet implemented
|
||||
|
||||
cItem EquippedItem = m_Player->GetEquippedItem();
|
||||
cItem OffhandItem = m_Player->GetOffHandEquipedItem();
|
||||
|
||||
cInventory & Intentory = m_Player->GetInventory();
|
||||
Intentory.SetShieldSlot(EquippedItem);
|
||||
Intentory.SetHotbarSlot(Intentory.GetEquippedSlotNum(), OffhandItem);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user