Rough OffHand implementation

this doesn't do stuff like taking arrows from offhand yet.
This commit is contained in:
Dylan K. Taylor
2021-05-05 14:46:51 +01:00
parent e8cb49f7ae
commit 652de2632a
9 changed files with 101 additions and 11 deletions

View File

@ -463,11 +463,17 @@ class InGamePacketHandler extends PacketHandler{
}
public function handleMobEquipment(MobEquipmentPacket $packet) : bool{
$this->session->getInvManager()->onClientSelectHotbarSlot($packet->hotbarSlot);
if(!$this->player->selectHotbarSlot($packet->hotbarSlot)){
$this->session->getInvManager()->syncSelectedHotbarSlot();
if($packet->windowId === ContainerIds::OFFHAND){
return true; //this happens when we put an item into the offhand
}
return true;
if($packet->windowId === ContainerIds::INVENTORY){
$this->session->getInvManager()->onClientSelectHotbarSlot($packet->hotbarSlot);
if(!$this->player->selectHotbarSlot($packet->hotbarSlot)){
$this->session->getInvManager()->syncSelectedHotbarSlot();
}
return true;
}
return false;
}
public function handleMobArmorEquipment(MobArmorEquipmentPacket $packet) : bool{