From 90fb3c5e12f83f7e6adbba271a13286680d3529d Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Tue, 19 Sep 2017 19:57:22 +0100 Subject: [PATCH] Moved getNetworkType() to ContainerInventory since it's not used anywhere else --- src/pocketmine/inventory/BaseInventory.php | 8 -------- src/pocketmine/inventory/ContainerInventory.php | 6 ++++++ src/pocketmine/inventory/PlayerCursorInventory.php | 6 ------ src/pocketmine/inventory/PlayerInventory.php | 5 ----- 4 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/pocketmine/inventory/BaseInventory.php b/src/pocketmine/inventory/BaseInventory.php index 2a976aa83d..8214fb64ea 100644 --- a/src/pocketmine/inventory/BaseInventory.php +++ b/src/pocketmine/inventory/BaseInventory.php @@ -70,14 +70,6 @@ abstract class BaseInventory implements Inventory{ return $this->title; } - /** - * Returns the Minecraft PE inventory type used to show the inventory window to clients. - * @return int - */ - public function getNetworkType() : int{ - return ContainerIds::NONE; - } - /** * Returns the size of the inventory. * @return int diff --git a/src/pocketmine/inventory/ContainerInventory.php b/src/pocketmine/inventory/ContainerInventory.php index a79af8618d..a57fcb6396 100644 --- a/src/pocketmine/inventory/ContainerInventory.php +++ b/src/pocketmine/inventory/ContainerInventory.php @@ -54,4 +54,10 @@ abstract class ContainerInventory extends BaseInventory{ $who->dataPacket($pk); parent::onClose($who); } + + /** + * Returns the Minecraft PE inventory type used to show the inventory window to clients. + * @return int + */ + abstract public function getNetworkType() : int; } \ No newline at end of file diff --git a/src/pocketmine/inventory/PlayerCursorInventory.php b/src/pocketmine/inventory/PlayerCursorInventory.php index dd41ec10c5..2d2961761b 100644 --- a/src/pocketmine/inventory/PlayerCursorInventory.php +++ b/src/pocketmine/inventory/PlayerCursorInventory.php @@ -24,8 +24,6 @@ declare(strict_types=1); namespace pocketmine\inventory; use pocketmine\network\mcpe\protocol\InventorySlotPacket; -use pocketmine\network\mcpe\protocol\types\ContainerIds; -use pocketmine\network\mcpe\protocol\types\WindowTypes; use pocketmine\Player; class PlayerCursorInventory extends BaseInventory{ @@ -48,10 +46,6 @@ class PlayerCursorInventory extends BaseInventory{ throw new \BadMethodCallException("Cursor can only carry one item at a time"); } - public function getNetworkType() : int{ - return WindowTypes::INVENTORY; //This should never be spawned to clients - } - /** * This override is here for documentation and code completion purposes only. * @return Player diff --git a/src/pocketmine/inventory/PlayerInventory.php b/src/pocketmine/inventory/PlayerInventory.php index f6dee847a2..6dc098971a 100644 --- a/src/pocketmine/inventory/PlayerInventory.php +++ b/src/pocketmine/inventory/PlayerInventory.php @@ -35,7 +35,6 @@ use pocketmine\network\mcpe\protocol\MobArmorEquipmentPacket; use pocketmine\network\mcpe\protocol\MobEquipmentPacket; use pocketmine\network\mcpe\protocol\PlayerHotbarPacket; use pocketmine\network\mcpe\protocol\types\ContainerIds; -use pocketmine\network\mcpe\protocol\types\WindowTypes; use pocketmine\Player; use pocketmine\Server; @@ -54,10 +53,6 @@ class PlayerInventory extends BaseInventory{ parent::__construct($player); } - public function getNetworkType() : int{ - return WindowTypes::INVENTORY; - } - public function getName() : string{ return "Player"; }