1
0
mirror of https://github.com/pmmp/PocketMine-MP.git synced 2025-06-01 17:53:41 +00:00

Refactor InventoryNetworkIds as WindowTypes

This commit is contained in:
Dylan K. Taylor 2017-03-13 11:30:40 +00:00
parent 9e341f74d8
commit c344caaf78
3 changed files with 13 additions and 13 deletions
src/pocketmine

@ -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
];
}

@ -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;

@ -23,7 +23,7 @@
namespace pocketmine\network\mcpe\protocol\types;
interface InventoryNetworkIds{
interface WindowTypes{
const INVENTORY = -1;
const CONTAINER = 0;