From 8ec25b59a361dca282375ab4413f9e67fe940062 Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 25 Jun 2019 15:43:55 +0100 Subject: [PATCH] Remove useless $items parameter from inventory constructors --- src/pocketmine/inventory/BaseInventory.php | 7 ++----- src/pocketmine/inventory/BlockInventory.php | 4 ++-- src/pocketmine/inventory/BrewingStandInventory.php | 4 ++-- src/pocketmine/inventory/DoubleChestInventory.php | 4 +--- src/pocketmine/inventory/HopperInventory.php | 4 ++-- 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/pocketmine/inventory/BaseInventory.php b/src/pocketmine/inventory/BaseInventory.php index d8d918ae4..1b9e5d298 100644 --- a/src/pocketmine/inventory/BaseInventory.php +++ b/src/pocketmine/inventory/BaseInventory.php @@ -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); } /** diff --git a/src/pocketmine/inventory/BlockInventory.php b/src/pocketmine/inventory/BlockInventory.php index 7c464ecda..7f420aca5 100644 --- a/src/pocketmine/inventory/BlockInventory.php +++ b/src/pocketmine/inventory/BlockInventory.php @@ -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); } /** diff --git a/src/pocketmine/inventory/BrewingStandInventory.php b/src/pocketmine/inventory/BrewingStandInventory.php index e6a3e6b5b..238cf99d7 100644 --- a/src/pocketmine/inventory/BrewingStandInventory.php +++ b/src/pocketmine/inventory/BrewingStandInventory.php @@ -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); } } diff --git a/src/pocketmine/inventory/DoubleChestInventory.php b/src/pocketmine/inventory/DoubleChestInventory.php index a4861a290..f600cf0b4 100644 --- a/src/pocketmine/inventory/DoubleChestInventory.php +++ b/src/pocketmine/inventory/DoubleChestInventory.php @@ -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(){ diff --git a/src/pocketmine/inventory/HopperInventory.php b/src/pocketmine/inventory/HopperInventory.php index de9337645..af77a7a45 100644 --- a/src/pocketmine/inventory/HopperInventory.php +++ b/src/pocketmine/inventory/HopperInventory.php @@ -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); } }