Remove useless $items parameter from inventory constructors

This commit is contained in:
Dylan K. Taylor 2019-06-25 15:43:55 +01:00
parent 94ee33e47b
commit 8ec25b59a3
5 changed files with 9 additions and 14 deletions

View File

@ -44,13 +44,10 @@ abstract class BaseInventory implements Inventory{
protected $listeners = [];
/**
* @param int $size
* @param Item[] $items
* @param int $size
*/
public function __construct(int $size, array $items = []){
public function __construct(int $size){
$this->slots = new \SplFixedArray($size);
$this->setContents($items, false);
}
/**

View File

@ -29,9 +29,9 @@ abstract class BlockInventory extends BaseInventory{
/** @var Vector3 */
protected $holder;
public function __construct(Vector3 $holder, int $size, array $items = []){
public function __construct(Vector3 $holder, int $size){
$this->holder = $holder;
parent::__construct($size, $items);
parent::__construct($size);
}
/**

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
class BrewingStandInventory extends BlockInventory{
public function __construct(Vector3 $holder, int $size = 5, array $items = []){
parent::__construct($holder, $size, $items);
public function __construct(Vector3 $holder, int $size = 5){
parent::__construct($holder, $size);
}
}

View File

@ -26,7 +26,6 @@ namespace pocketmine\inventory;
use pocketmine\block\tile\Chest;
use pocketmine\item\Item;
use pocketmine\player\Player;
use function array_merge;
use function count;
class DoubleChestInventory extends ChestInventory implements InventoryHolder{
@ -38,8 +37,7 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
public function __construct(Chest $left, Chest $right){
$this->left = $left->getRealInventory();
$this->right = $right->getRealInventory();
$items = array_merge($this->left->getContents(true), $this->right->getContents(true));
BaseInventory::__construct($this->left->getSize() + $this->right->getSize(), $items);
BaseInventory::__construct($this->left->getSize() + $this->right->getSize());
}
public function getInventory(){

View File

@ -27,7 +27,7 @@ use pocketmine\math\Vector3;
class HopperInventory extends BlockInventory{
public function __construct(Vector3 $holder, int $size = 5, array $items = []){
parent::__construct($holder, $size, $items);
public function __construct(Vector3 $holder, int $size = 5){
parent::__construct($holder, $size);
}
}