mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Inventory: Split up armor and player inventory (#1957)
* Inventory: Split up PlayerInventory and armour handling * Fixed other players don't see armour changes. This bug also exists on master.
This commit is contained in:
@ -426,11 +426,7 @@ abstract class BaseInventory implements Inventory{
|
||||
}
|
||||
|
||||
$pk = new InventoryContentPacket();
|
||||
|
||||
//Using getSize() here allows PlayerInventory to report that it's 4 slots smaller than it actually is (armor hack)
|
||||
for($i = 0, $size = $this->getSize(); $i < $size; ++$i){
|
||||
$pk->items[$i] = $this->getItem($i);
|
||||
}
|
||||
$pk->items = $this->getContents(true);
|
||||
|
||||
foreach($target as $player){
|
||||
if(($id = $player->getWindowId($this)) === ContainerIds::NONE){
|
||||
@ -466,6 +462,6 @@ abstract class BaseInventory implements Inventory{
|
||||
}
|
||||
|
||||
public function slotExists(int $slot) : bool{
|
||||
return $slot >= 0 and $slot < $this->slots->getSize(); //use actual slots size to allow PlayerInventory to lie
|
||||
return $slot >= 0 and $slot < $this->slots->getSize();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user