mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
Merge branch 'stable'
# Conflicts: # resources/vanilla # src/pocketmine/inventory/ArmorInventory.php
This commit is contained in:
commit
cda565ba8c
@ -841,7 +841,11 @@ class NetworkSession{
|
||||
public function onMobArmorChange(Living $mob) : void{
|
||||
$pk = new MobArmorEquipmentPacket();
|
||||
$pk->entityRuntimeId = $mob->getId();
|
||||
$pk->slots = $mob->getArmorInventory()->getContents(true); //beware this order might change in the future
|
||||
$inv = $mob->getArmorInventory();
|
||||
$pk->head = $inv->getHelmet();
|
||||
$pk->chest = $inv->getChestplate();
|
||||
$pk->legs = $inv->getLeggings();
|
||||
$pk->feet = $inv->getBoots();
|
||||
$this->sendDataPacket($pk);
|
||||
}
|
||||
|
||||
|
@ -34,21 +34,32 @@ class MobArmorEquipmentPacket extends DataPacket implements ClientboundPacket, S
|
||||
|
||||
/** @var int */
|
||||
public $entityRuntimeId;
|
||||
/** @var Item[] */
|
||||
public $slots = [];
|
||||
|
||||
//this intentionally doesn't use an array because we don't want any implicit dependencies on internal order
|
||||
|
||||
/** @var Item */
|
||||
public $head;
|
||||
/** @var Item */
|
||||
public $chest;
|
||||
/** @var Item */
|
||||
public $legs;
|
||||
/** @var Item */
|
||||
public $feet;
|
||||
|
||||
protected function decodePayload() : void{
|
||||
$this->entityRuntimeId = $this->getEntityRuntimeId();
|
||||
for($i = 0; $i < 4; ++$i){
|
||||
$this->slots[$i] = $this->getSlot();
|
||||
}
|
||||
$this->head = $this->getSlot();
|
||||
$this->chest = $this->getSlot();
|
||||
$this->legs = $this->getSlot();
|
||||
$this->feet = $this->getSlot();
|
||||
}
|
||||
|
||||
protected function encodePayload() : void{
|
||||
$this->putEntityRuntimeId($this->entityRuntimeId);
|
||||
for($i = 0; $i < 4; ++$i){
|
||||
$this->putSlot($this->slots[$i]);
|
||||
}
|
||||
$this->putSlot($this->head);
|
||||
$this->putSlot($this->chest);
|
||||
$this->putSlot($this->legs);
|
||||
$this->putSlot($this->feet);
|
||||
}
|
||||
|
||||
public function handle(SessionHandler $handler) : bool{
|
||||
|
Loading…
x
Reference in New Issue
Block a user