From c344caaf78bf834ef3cfed1ffde95d5797ea725f Mon Sep 17 00:00:00 2001 From: "Dylan K. Taylor" Date: Mon, 13 Mar 2017 11:30:40 +0000 Subject: [PATCH] Refactor InventoryNetworkIds as WindowTypes --- src/pocketmine/inventory/InventoryType.php | 20 +++++++++---------- .../mcpe/protocol/UpdateTradePacket.php | 4 ++-- ...nventoryNetworkIds.php => WindowTypes.php} | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) rename src/pocketmine/network/mcpe/protocol/types/{InventoryNetworkIds.php => WindowTypes.php} (97%) diff --git a/src/pocketmine/inventory/InventoryType.php b/src/pocketmine/inventory/InventoryType.php index 86d1a3ddd..4b97db2e9 100644 --- a/src/pocketmine/inventory/InventoryType.php +++ b/src/pocketmine/inventory/InventoryType.php @@ -21,7 +21,7 @@ namespace pocketmine\inventory; -use pocketmine\network\mcpe\protocol\types\InventoryNetworkIds; +use pocketmine\network\mcpe\protocol\types\WindowTypes; /** * Saves all the information regarding default inventory sizes and types @@ -63,15 +63,15 @@ class InventoryType{ //TODO: move network stuff out of here //TODO: move inventory data to json static::$default = [ - static::CHEST => new InventoryType(27, "Chest", InventoryNetworkIds::CONTAINER), - static::DOUBLE_CHEST => new InventoryType(27 + 27, "Double Chest", InventoryNetworkIds::CONTAINER), - static::PLAYER => new InventoryType(36 + 4, "Player", InventoryNetworkIds::INVENTORY), //36 CONTAINER, 4 ARMOR - static::CRAFTING => new InventoryType(5, "Crafting", InventoryNetworkIds::INVENTORY), //yes, the use of INVENTORY is intended! 4 CRAFTING slots, 1 RESULT - static::WORKBENCH => new InventoryType(10, "Crafting", InventoryNetworkIds::WORKBENCH), //9 CRAFTING slots, 1 RESULT - static::FURNACE => new InventoryType(3, "Furnace", InventoryNetworkIds::FURNACE), //2 INPUT, 1 OUTPUT - static::ENCHANT_TABLE => new InventoryType(2, "Enchant", InventoryNetworkIds::ENCHANTMENT), //1 INPUT/OUTPUT, 1 LAPIS - static::BREWING_STAND => new InventoryType(4, "Brewing", InventoryNetworkIds::BREWING_STAND), //1 INPUT, 3 POTION - static::ANVIL => new InventoryType(3, "Anvil", InventoryNetworkIds::ANVIL) //2 INPUT, 1 OUTP + static::CHEST => new InventoryType(27, "Chest", WindowTypes::CONTAINER), + static::DOUBLE_CHEST => new InventoryType(27 + 27, "Double Chest", WindowTypes::CONTAINER), + static::PLAYER => new InventoryType(36 + 4, "Player", WindowTypes::INVENTORY), //36 CONTAINER, 4 ARMOR + static::CRAFTING => new InventoryType(5, "Crafting", WindowTypes::INVENTORY), //yes, the use of INVENTORY is intended! 4 CRAFTING slots, 1 RESULT + static::WORKBENCH => new InventoryType(10, "Crafting", WindowTypes::WORKBENCH), //9 CRAFTING slots, 1 RESULT + static::FURNACE => new InventoryType(3, "Furnace", WindowTypes::FURNACE), //2 INPUT, 1 OUTPUT + static::ENCHANT_TABLE => new InventoryType(2, "Enchant", WindowTypes::ENCHANTMENT), //1 INPUT/OUTPUT, 1 LAPIS + static::BREWING_STAND => new InventoryType(4, "Brewing", WindowTypes::BREWING_STAND), //1 INPUT, 3 POTION + static::ANVIL => new InventoryType(3, "Anvil", WindowTypes::ANVIL) //2 INPUT, 1 OUTP ]; } diff --git a/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php b/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php index 319a34e76..6a8f76e2e 100644 --- a/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php +++ b/src/pocketmine/network/mcpe/protocol/UpdateTradePacket.php @@ -26,14 +26,14 @@ namespace pocketmine\network\mcpe\protocol; use pocketmine\network\mcpe\NetworkSession; -use pocketmine\network\mcpe\protocol\types\InventoryNetworkIds; +use pocketmine\network\mcpe\protocol\types\WindowTypes; class UpdateTradePacket extends DataPacket{ const NETWORK_ID = ProtocolInfo::UPDATE_TRADE_PACKET; //TODO: find fields public $windowId; - public $windowType = InventoryNetworkIds::TRADING; //Mojang hardcoded this -_- + public $windowType = WindowTypes::TRADING; //Mojang hardcoded this -_- public $varint1; public $varint2; public $isWilling; diff --git a/src/pocketmine/network/mcpe/protocol/types/InventoryNetworkIds.php b/src/pocketmine/network/mcpe/protocol/types/WindowTypes.php similarity index 97% rename from src/pocketmine/network/mcpe/protocol/types/InventoryNetworkIds.php rename to src/pocketmine/network/mcpe/protocol/types/WindowTypes.php index be64b880c..667b69674 100644 --- a/src/pocketmine/network/mcpe/protocol/types/InventoryNetworkIds.php +++ b/src/pocketmine/network/mcpe/protocol/types/WindowTypes.php @@ -23,7 +23,7 @@ namespace pocketmine\network\mcpe\protocol\types; -interface InventoryNetworkIds{ +interface WindowTypes{ const INVENTORY = -1; const CONTAINER = 0;