Merge branch 'master' into api3/network

This commit is contained in:
Dylan K. Taylor
2017-03-09 18:12:37 +00:00
10 changed files with 167 additions and 34 deletions

View File

@ -21,10 +21,14 @@
namespace pocketmine\inventory;
use pocketmine\network\mcpe\protocol\types\InventoryNetworkIds;
/**
* Saves all the information regarding default inventory sizes and types
*/
class InventoryType{
//NOTE: Do not confuse these with the network IDs.
const CHEST = 0;
const DOUBLE_CHEST = 1;
const PLAYER = 2;
@ -56,19 +60,19 @@ class InventoryType{
return;
}
static::$default[static::CHEST] = new InventoryType(27, "Chest", 0);
static::$default[static::DOUBLE_CHEST] = new InventoryType(27 + 27, "Double Chest", 0);
static::$default[static::PLAYER] = new InventoryType(36 + 4, "Player", 0); //36 CONTAINER, 4 ARMOR
static::$default[static::CRAFTING] = new InventoryType(5, "Crafting", 1); //4 CRAFTING slots, 1 RESULT
static::$default[static::WORKBENCH] = new InventoryType(10, "Crafting", 1); //9 CRAFTING slots, 1 RESULT
static::$default[static::FURNACE] = new InventoryType(3, "Furnace", 2); //2 INPUT, 1 OUTPUT
static::$default[static::ENCHANT_TABLE] = new InventoryType(2, "Enchant", 3); //1 INPUT/OUTPUT, 1 LAPIS
static::$default[static::BREWING_STAND] = new InventoryType(4, "Brewing", 4); //1 INPUT, 3 POTION
static::$default[static::ANVIL] = new InventoryType(3, "Anvil", 5); //2 INPUT, 1 OUTPUT
//TODO: add the below
//6: dispenser
//7: dropper
//8: hopper
//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
];
}
/**