mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Inventory: Removed need for Inventory to have an InventoryHolder
Inventory holders are now freed from BaseInventory. They are now declared by subclasses by convention, but are not required in most cases. Ideally, this would be followed by the removal of the need for inventories to know their holders at all. They should just be simple containers of items. This fixes #1560 by removing FakeBlockMenu.
This commit is contained in:
@ -45,18 +45,13 @@ abstract class BaseInventory implements Inventory{
|
||||
protected $slots = [];
|
||||
/** @var Player[] */
|
||||
protected $viewers = [];
|
||||
/** @var InventoryHolder */
|
||||
protected $holder;
|
||||
|
||||
/**
|
||||
* @param InventoryHolder $holder
|
||||
* @param Item[] $items
|
||||
* @param int $size
|
||||
* @param string $title
|
||||
* @param Item[] $items
|
||||
* @param int $size
|
||||
* @param string $title
|
||||
*/
|
||||
public function __construct(InventoryHolder $holder, array $items = [], int $size = null, string $title = null){
|
||||
$this->holder = $holder;
|
||||
|
||||
public function __construct(array $items = [], int $size = null, string $title = null){
|
||||
$this->slots = new \SplFixedArray($size ?? $this->getDefaultSize());
|
||||
$this->title = $title ?? $this->getName();
|
||||
|
||||
@ -379,10 +374,6 @@ abstract class BaseInventory implements Inventory{
|
||||
}
|
||||
}
|
||||
|
||||
public function getHolder(){
|
||||
return $this->holder;
|
||||
}
|
||||
|
||||
public function setMaxStackSize(int $size) : void{
|
||||
$this->maxStackSize = $size;
|
||||
}
|
||||
|
Reference in New Issue
Block a user