Merged master into php7 to support 0.13.1

This commit is contained in:
Intyre 2016-01-22 17:36:45 +01:00
commit a2734f6dc0
No known key found for this signature in database
GPG Key ID: B06D41D26935005A
117 changed files with 2732 additions and 393 deletions

View File

@ -0,0 +1,35 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine;
abstract class Collectable extends \Threaded implements \Collectable{
private $isGarbage = false;
public function isGarbage() : bool{
return $this->isGarbage;
}
public function setGarbage(){
$this->isGarbage = true;
}
}

View File

@ -69,7 +69,6 @@ use pocketmine\event\TranslationContainer;
use pocketmine\inventory\BaseTransaction; use pocketmine\inventory\BaseTransaction;
use pocketmine\inventory\BigShapedRecipe; use pocketmine\inventory\BigShapedRecipe;
use pocketmine\inventory\BigShapelessRecipe; use pocketmine\inventory\BigShapelessRecipe;
use pocketmine\inventory\CraftingTransactionGroup;
use pocketmine\inventory\FurnaceInventory; use pocketmine\inventory\FurnaceInventory;
use pocketmine\inventory\Inventory; use pocketmine\inventory\Inventory;
use pocketmine\inventory\InventoryHolder; use pocketmine\inventory\InventoryHolder;
@ -114,6 +113,7 @@ use pocketmine\network\protocol\Info as ProtocolInfo;
use pocketmine\network\protocol\PlayerActionPacket; use pocketmine\network\protocol\PlayerActionPacket;
use pocketmine\network\protocol\PlayStatusPacket; use pocketmine\network\protocol\PlayStatusPacket;
use pocketmine\network\protocol\RespawnPacket; use pocketmine\network\protocol\RespawnPacket;
use pocketmine\network\protocol\SetPlayerGameTypePacket;
use pocketmine\network\protocol\TextPacket; use pocketmine\network\protocol\TextPacket;
use pocketmine\network\protocol\MovePlayerPacket; use pocketmine\network\protocol\MovePlayerPacket;
@ -565,14 +565,14 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
public function setDisplayName($name){ public function setDisplayName($name){
$this->displayName = $name; $this->displayName = $name;
if($this->spawned){ if($this->spawned){
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $this->isSkinSlim(), $this->getSkinData()); $this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $this->getSkinName(), $this->getSkinData());
} }
} }
public function setSkin($str, $isSlim = false){ public function setSkin($str, $skinName){
parent::setSkin($str, $isSlim); parent::setSkin($str, $skinName);
if($this->spawned){ if($this->spawned){
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $isSlim, $str); $this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $skinName, $str);
} }
} }
@ -707,7 +707,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
} }
unset($this->loadQueue[$index]); unset($this->loadQueue[$index]);
$this->level->requestChunk($X, $Z, $this, LevelProvider::ORDER_ZXY); $this->level->requestChunk($X, $Z, $this);
} }
if($this->chunkLoadCount >= $this->spawnThreshold and $this->spawned === false and $this->teleportPosition === null){ if($this->chunkLoadCount >= $this->spawnThreshold and $this->spawned === false and $this->teleportPosition === null){
@ -1076,7 +1076,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
return false; return false;
} }
$this->gamemode = $gm; $this->gamemode = $gm;
$this->allowFlight = $this->isCreative(); $this->allowFlight = $this->isCreative();
@ -1089,19 +1088,8 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$this->namedtag->playerGameType = new IntTag("playerGameType", $this->gamemode); $this->namedtag->playerGameType = new IntTag("playerGameType", $this->gamemode);
$spawnPosition = $this->getSpawn(); $pk = new SetPlayerGameTypePacket();
$pk = new StartGamePacket();
$pk->seed = -1;
$pk->x = $this->x;
$pk->y = $this->y;
$pk->z = $this->z;
$pk->spawnX = (int) $spawnPosition->x;
$pk->spawnY = (int) $spawnPosition->y;
$pk->spawnZ = (int) $spawnPosition->z;
$pk->generator = 1; //0 old, 1 infinite, 2 flat
$pk->gamemode = $this->gamemode & 0x01; $pk->gamemode = $this->gamemode & 0x01;
$pk->eid = 0;
$this->dataPacket($pk); $this->dataPacket($pk);
$this->sendSettings(); $this->sendSettings();
@ -1842,7 +1830,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
break; break;
} }
$this->setSkin($packet->skin, $packet->slim); $this->setSkin($packet->skin, $packet->skinName);
$this->server->getPluginManager()->callEvent($ev = new PlayerPreLoginEvent($this, "Plugin reason")); $this->server->getPluginManager()->callEvent($ev = new PlayerPreLoginEvent($this, "Plugin reason"));
if($ev->isCancelled()){ if($ev->isCancelled()){
@ -1865,7 +1853,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
} }
if($this->teleportPosition !== null or ($this->forceMovement instanceof Vector3 and (($dist = $newPos->distanceSquared($this->forceMovement)) > 0.1 or $revert))){ if($this->teleportPosition !== null or ($this->forceMovement instanceof Vector3 and (($dist = $newPos->distanceSquared($this->forceMovement)) > 0.1 or $revert))){
$this->sendPosition($this->forceMovement, $packet->yaw, $packet->pitch); $this->sendPosition($this->teleportPosition === null ? $this->forceMovement : $this->teleportPosition, $packet->yaw, $packet->pitch);
}else{ }else{
$packet->yaw %= 360; $packet->yaw %= 360;
$packet->pitch %= 360; $packet->pitch %= 360;
@ -1974,7 +1962,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
//TODO: Implement adventure mode checks //TODO: Implement adventure mode checks
if($this->level->useItemOn($blockVector, $item, $packet->face, $packet->fx, $packet->fy, $packet->fz, $this)){ if($this->level->useItemOn($blockVector, $item, $packet->face, $packet->fx, $packet->fy, $packet->fz, $this)){
if(!$item->deepEquals($oldItem) or $item->getCount() !== $oldItem->getCount()){ if(!$item->deepEquals($oldItem) or $item->getCount() !== $oldItem->getCount()){
$this->inventory->setItemInHand($item, $this); $this->inventory->setItemInHand($item);
$this->inventory->sendHeldItem($this->hasSpawned); $this->inventory->sendHeldItem($this->hasSpawned);
} }
break; break;
@ -2155,7 +2143,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$pk = new EntityEventPacket(); $pk = new EntityEventPacket();
$pk->eid = $this->getId(); $pk->eid = $this->getId();
$pk->event = EntityEventPacket::USE_ITEM; $pk->event = EntityEventPacket::USE_ITEM;
$pk;
$this->dataPacket($pk); $this->dataPacket($pk);
Server::broadcastPacket($this->getViewers(), $pk); Server::broadcastPacket($this->getViewers(), $pk);
@ -2274,7 +2261,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
if($this->canInteract($vector->add(0.5, 0.5, 0.5), $this->isCreative() ? 13 : 6) and $this->level->useBreakOn($vector, $item, $this)){ if($this->canInteract($vector->add(0.5, 0.5, 0.5), $this->isCreative() ? 13 : 6) and $this->level->useBreakOn($vector, $item, $this)){
if($this->isSurvival()){ if($this->isSurvival()){
if(!$item->deepEquals($oldItem) or $item->getCount() !== $oldItem->getCount()){ if(!$item->deepEquals($oldItem) or $item->getCount() !== $oldItem->getCount()){
$this->inventory->setItemInHand($item, $this); $this->inventory->setItemInHand($item);
$this->inventory->sendHeldItem($this->hasSpawned); $this->inventory->sendHeldItem($this->hasSpawned);
} }
} }
@ -2498,12 +2485,12 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$this->heal($ev->getAmount(), $ev); $this->heal($ev->getAmount(), $ev);
--$slot->count; --$slot->count;
$this->inventory->setItemInHand($slot, $this); $this->inventory->setItemInHand($slot);
if($slot->getId() === Item::MUSHROOM_STEW or $slot->getId() === Item::BEETROOT_SOUP){ if($slot->getId() === Item::MUSHROOM_STEW or $slot->getId() === Item::BEETROOT_SOUP){
$this->inventory->addItem(Item::get(Item::BOWL, 0, 1)); $this->inventory->addItem(Item::get(Item::BOWL, 0, 1));
}elseif($slot->getId() === Item::RAW_FISH and $slot->getDamage() === 3){ //Pufferfish }elseif($slot->getId() === Item::RAW_FISH and $slot->getDamage() === 3){ //Pufferfish
$this->addEffect(Effect::getEffect(Effect::HUNGER)->setAmplifier(2)->setDuration(15 * 20)); //$this->addEffect(Effect::getEffect(Effect::HUNGER)->setAmplifier(2)->setDuration(15 * 20));
//$this->addEffect(Effect::getEffect(Effect::NAUSEA)->setAmplifier(1)->setDuration(15 * 20)); $this->addEffect(Effect::getEffect(Effect::NAUSEA)->setAmplifier(1)->setDuration(15 * 20));
$this->addEffect(Effect::getEffect(Effect::POISON)->setAmplifier(3)->setDuration(60 * 20)); $this->addEffect(Effect::getEffect(Effect::POISON)->setAmplifier(3)->setDuration(60 * 20));
} }
} }
@ -2522,7 +2509,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
break; break;
} }
$this->inventory->setItemInHand(Item::get(Item::AIR, 0, 1), $this); $this->inventory->setItemInHand(Item::get(Item::AIR, 0, 1));
$motion = $this->getDirectionVector()->multiply(0.4); $motion = $this->getDirectionVector()->multiply(0.4);
$this->level->dropItem($this->add(0, 1.3, 0), $item, $motion, 40); $this->level->dropItem($this->add(0, 1.3, 0), $item, $motion, 40);
@ -2612,15 +2599,11 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
for($y = 0; $y < 3; ++$y){ for($y = 0; $y < 3; ++$y){
$item = $packet->input[$y * 3 + $x]; $item = $packet->input[$y * 3 + $x];
$ingredient = $recipe->getIngredient($x, $y); $ingredient = $recipe->getIngredient($x, $y);
if($item->getCount() > 0 and $item->getId() > 0){ if($item->getCount() > 0){
if($ingredient === null or !$ingredient->deepEquals($item, $ingredient->getDamage() !== null, $ingredient->getCompoundTag() !== null)){ if($ingredient === null or !$ingredient->deepEquals($item, $ingredient->getDamage() !== null, $ingredient->getCompoundTag() !== null)){
$canCraft = false; $canCraft = false;
break; break;
} }
}elseif($ingredient !== null and $ingredient->getId() !== 0){
$canCraft = false;
break;
} }
} }
} }
@ -2838,7 +2821,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
} }
break; break;
case ProtocolInfo::TILE_ENTITY_DATA_PACKET: case ProtocolInfo::BLOCK_ENTITY_DATA_PACKET:
if($this->spawned === false or $this->blocked === true or !$this->isAlive()){ if($this->spawned === false or $this->blocked === true or !$this->isAlive()){
break; break;
} }
@ -2900,7 +2883,11 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage())); $this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage()));
if(!$ev->isCancelled()){ if(!$ev->isCancelled()){
if($isAdmin){ if($isAdmin){
if(!$this->isBanned()) {
$message = "Kicked by admin." . ($reason !== "" ? " Reason: " . $reason : ""); $message = "Kicked by admin." . ($reason !== "" ? " Reason: " . $reason : "");
}else{
$message = $reason;
}
}else{ }else{
if($reason === ""){ if($reason === ""){
$message = "disconnectionScreen.noReason"; $message = "disconnectionScreen.noReason";
@ -3366,9 +3353,16 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
return true; return true;
} }
/**
* @param Vector3|Position|Location $pos
* @param float $yaw
* @param float $pitch
*
* @return bool
*/
public function teleport(Vector3 $pos, $yaw = null, $pitch = null){ public function teleport(Vector3 $pos, $yaw = null, $pitch = null){
if(!$this->isOnline()){ if(!$this->isOnline()){
return; return false;
} }
$oldPos = $this->getPosition(); $oldPos = $this->getPosition();
@ -3389,11 +3383,12 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$this->spawnToAll(); $this->spawnToAll();
} }
$this->resetFallDistance(); $this->resetFallDistance();
$this->nextChunkOrderRun = 0; $this->nextChunkOrderRun = 0;
$this->newPosition = null; $this->newPosition = null;
return true;
} }
return false;
} }
/** /**
@ -3540,7 +3535,6 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$batch = new BatchPacket(); $batch = new BatchPacket();
$batch->payload = zlib_encode(Binary::writeInt(strlen($pk->getBuffer())) . $pk->getBuffer(), ZLIB_ENCODING_DEFLATE, Server::getInstance()->networkCompressionLevel); $batch->payload = zlib_encode(Binary::writeInt(strlen($pk->getBuffer())) . $pk->getBuffer(), ZLIB_ENCODING_DEFLATE, Server::getInstance()->networkCompressionLevel);
$batch;
$batch->encode(); $batch->encode();
$batch->isEncoded = true; $batch->isEncoded = true;
return $batch; return $batch;

View File

@ -75,8 +75,8 @@ namespace pocketmine {
const VERSION = "1.6dev"; const VERSION = "1.6dev";
const API_VERSION = "2.0.0"; const API_VERSION = "2.0.0";
const CODENAME = "[REDACTED]"; const CODENAME = "[REDACTED]";
const MINECRAFT_VERSION = "v0.12.1 alpha"; const MINECRAFT_VERSION = "v0.13.1 alpha";
const MINECRAFT_VERSION_NETWORK = "0.12.1"; const MINECRAFT_VERSION_NETWORK = "0.13.1";
/* /*
* Startup code. Do not look at it, it may harm you. * Startup code. Do not look at it, it may harm you.
@ -170,11 +170,13 @@ namespace pocketmine {
* This is here so that people don't come to us complaining and fill up the issue tracker when they put * This is here so that people don't come to us complaining and fill up the issue tracker when they put
* an incorrect timezone abbreviation in php.ini apparently. * an incorrect timezone abbreviation in php.ini apparently.
*/ */
$default_timezone = date_default_timezone_get(); $timezone = ini_get("date.timezone");
if(strpos($default_timezone, "/") === false){ if(strpos($timezone, "/") === false){
$default_timezone = timezone_name_from_abbr($default_timezone); $default_timezone = timezone_name_from_abbr($timezone);
ini_set("date.timezone", $default_timezone); ini_set("date.timezone", $default_timezone);
date_default_timezone_set($default_timezone); date_default_timezone_set($default_timezone);
} else {
date_default_timezone_set($timezone);
} }
} }
@ -394,8 +396,8 @@ namespace pocketmine {
if(substr_count($pthreads_version, ".") < 2){ if(substr_count($pthreads_version, ".") < 2){
$pthreads_version = "0.$pthreads_version"; $pthreads_version = "0.$pthreads_version";
} }
if(version_compare($pthreads_version, "3.0.7") < 0){ if(version_compare($pthreads_version, "3.1.5") < 0){
$logger->critical("pthreads >= 3.0.7 is required, while you have $pthreads_version."); $logger->critical("pthreads >= 3.1.5 is required, while you have $pthreads_version.");
++$errors; ++$errors;
} }

View File

@ -2175,7 +2175,7 @@ class Server{
public function addOnlinePlayer(Player $player){ public function addOnlinePlayer(Player $player){
$this->playerList[$player->getRawUniqueId()] = $player; $this->playerList[$player->getRawUniqueId()] = $player;
$this->updatePlayerListData($player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->isSkinSlim(), $player->getSkinData()); $this->updatePlayerListData($player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->getSkinName(), $player->getSkinData());
} }
public function removeOnlinePlayer(Player $player){ public function removeOnlinePlayer(Player $player){
@ -2189,10 +2189,10 @@ class Server{
} }
} }
public function updatePlayerListData(UUID $uuid, $entityId, $name, $isSlim, $skinData, array $players = null){ public function updatePlayerListData(UUID $uuid, $entityId, $name, $skinName, $skinData, array $players = null){
$pk = new PlayerListPacket(); $pk = new PlayerListPacket();
$pk->type = PlayerListPacket::TYPE_ADD; $pk->type = PlayerListPacket::TYPE_ADD;
$pk->entries[] = [$uuid, $entityId, $name, $isSlim, $skinData]; $pk->entries[] = [$uuid, $entityId, $name, $skinName, $skinData];
Server::broadcastPacket($players === null ? $this->playerList : $players, $pk); Server::broadcastPacket($players === null ? $this->playerList : $players, $pk);
} }
@ -2207,7 +2207,7 @@ class Server{
$pk = new PlayerListPacket(); $pk = new PlayerListPacket();
$pk->type = PlayerListPacket::TYPE_ADD; $pk->type = PlayerListPacket::TYPE_ADD;
foreach($this->playerList as $player){ foreach($this->playerList as $player){
$pk->entries[] = [$player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->isSkinSlim(), $player->getSkinData()]; $pk->entries[] = [$player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->getSkinName(), $player->getSkinData()];
} }
$p->dataPacket($pk); $p->dataPacket($pk);

View File

@ -71,7 +71,7 @@ class Anvil extends Fallable{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[$this->id, 0, 1], //TODO break level [$this->id, 0, 1], //TODO break level
]; ];

View File

@ -181,13 +181,13 @@ class Block extends Position implements Metadatable{
const LILY_PAD = 111; const LILY_PAD = 111;
const NETHER_BRICKS = 112; const NETHER_BRICKS = 112;
const NETHER_BRICK_BLOCK = 112; const NETHER_BRICK_BLOCK = 112;
const NETHER_BRICK_FENCE = 113;
const NETHER_BRICKS_STAIRS = 114; const NETHER_BRICKS_STAIRS = 114;
const ENCHANTING_TABLE = 116; const ENCHANTING_TABLE = 116;
const ENCHANT_TABLE = 116; const ENCHANT_TABLE = 116;
const ENCHANTMENT_TABLE = 116; const ENCHANTMENT_TABLE = 116;
const BREWING_STAND = 117;
const END_PORTAL_FRAME = 120; const END_PORTAL_FRAME = 120;
const END_STONE = 121; const END_STONE = 121;
@ -205,11 +205,12 @@ class Block extends Position implements Metadatable{
const COBBLE_WALL = 139; const COBBLE_WALL = 139;
const STONE_WALL = 139; const STONE_WALL = 139;
const COBBLESTONE_WALL = 139; const COBBLESTONE_WALL = 139;
const FLOWER_POT_BLOCK = 140;
const CARROT_BLOCK = 141; const CARROT_BLOCK = 141;
const POTATO_BLOCK = 142; const POTATO_BLOCK = 142;
const ANVIL = 145; const ANVIL = 145;
const TRAPPED_CHEST = 146;
const REDSTONE_BLOCK = 152; const REDSTONE_BLOCK = 152;
@ -236,11 +237,12 @@ class Block extends Position implements Metadatable{
const DARK_OAK_WOOD_STAIRS = 164; const DARK_OAK_WOOD_STAIRS = 164;
const DARK_OAK_WOODEN_STAIRS = 164; const DARK_OAK_WOODEN_STAIRS = 164;
const IRON_TRAPDOOR = 167;
const HAY_BALE = 170; const HAY_BALE = 170;
const CARPET = 171; const CARPET = 171;
const HARDENED_CLAY = 172; const HARDENED_CLAY = 172;
const COAL_BLOCK = 173; const COAL_BLOCK = 173;
const PACKED_ICE = 174;
const DOUBLE_PLANT = 175; const DOUBLE_PLANT = 175;
const FENCE_GATE_SPRUCE = 183; const FENCE_GATE_SPRUCE = 183;
@ -255,7 +257,6 @@ class Block extends Position implements Metadatable{
const BEETROOT_BLOCK = 244; const BEETROOT_BLOCK = 244;
const STONECUTTER = 245; const STONECUTTER = 245;
const GLOWING_OBSIDIAN = 246; const GLOWING_OBSIDIAN = 246;
const NETHER_REACTOR = 247;
/** @var \SplFixedArray */ /** @var \SplFixedArray */
public static $list = null; public static $list = null;
@ -387,11 +388,11 @@ class Block extends Position implements Metadatable{
self::$list[self::MYCELIUM] = Mycelium::class; self::$list[self::MYCELIUM] = Mycelium::class;
self::$list[self::WATER_LILY] = WaterLily::class; self::$list[self::WATER_LILY] = WaterLily::class;
self::$list[self::NETHER_BRICKS] = NetherBrick::class; self::$list[self::NETHER_BRICKS] = NetherBrick::class;
self::$list[self::NETHER_BRICK_FENCE] = NetherBrickFence::class;
self::$list[self::NETHER_BRICKS_STAIRS] = NetherBrickStairs::class; self::$list[self::NETHER_BRICKS_STAIRS] = NetherBrickStairs::class;
self::$list[self::ENCHANTING_TABLE] = EnchantingTable::class; self::$list[self::ENCHANTING_TABLE] = EnchantingTable::class;
self::$list[self::BREWING_STAND] = BrewingStand::class;
self::$list[self::END_PORTAL_FRAME] = EndPortalFrame::class; self::$list[self::END_PORTAL_FRAME] = EndPortalFrame::class;
self::$list[self::END_STONE] = EndStone::class; self::$list[self::END_STONE] = EndStone::class;
self::$list[self::SANDSTONE_STAIRS] = SandstoneStairs::class; self::$list[self::SANDSTONE_STAIRS] = SandstoneStairs::class;
@ -402,11 +403,11 @@ class Block extends Position implements Metadatable{
self::$list[self::BIRCH_WOOD_STAIRS] = BirchWoodStairs::class; self::$list[self::BIRCH_WOOD_STAIRS] = BirchWoodStairs::class;
self::$list[self::JUNGLE_WOOD_STAIRS] = JungleWoodStairs::class; self::$list[self::JUNGLE_WOOD_STAIRS] = JungleWoodStairs::class;
self::$list[self::STONE_WALL] = StoneWall::class; self::$list[self::STONE_WALL] = StoneWall::class;
self::$list[self::FLOWER_POT_BLOCK] = FlowerPot::class;
self::$list[self::CARROT_BLOCK] = Carrot::class; self::$list[self::CARROT_BLOCK] = Carrot::class;
self::$list[self::POTATO_BLOCK] = Potato::class; self::$list[self::POTATO_BLOCK] = Potato::class;
self::$list[self::ANVIL] = Anvil::class; self::$list[self::ANVIL] = Anvil::class;
self::$list[self::TRAPPED_CHEST] = TrappedChest::class;
self::$list[self::REDSTONE_BLOCK] = Redstone::class; self::$list[self::REDSTONE_BLOCK] = Redstone::class;
self::$list[self::QUARTZ_BLOCK] = Quartz::class; self::$list[self::QUARTZ_BLOCK] = Quartz::class;
@ -420,11 +421,12 @@ class Block extends Position implements Metadatable{
self::$list[self::ACACIA_WOOD_STAIRS] = AcaciaWoodStairs::class; self::$list[self::ACACIA_WOOD_STAIRS] = AcaciaWoodStairs::class;
self::$list[self::DARK_OAK_WOOD_STAIRS] = DarkOakWoodStairs::class; self::$list[self::DARK_OAK_WOOD_STAIRS] = DarkOakWoodStairs::class;
self::$list[self::IRON_TRAPDOOR] = IronTrapdoor::class;
self::$list[self::HAY_BALE] = HayBale::class; self::$list[self::HAY_BALE] = HayBale::class;
self::$list[self::CARPET] = Carpet::class; self::$list[self::CARPET] = Carpet::class;
self::$list[self::HARDENED_CLAY] = HardenedClay::class; self::$list[self::HARDENED_CLAY] = HardenedClay::class;
self::$list[self::COAL_BLOCK] = Coal::class; self::$list[self::COAL_BLOCK] = Coal::class;
self::$list[self::PACKED_ICE] = PackedIce::class;
self::$list[self::DOUBLE_PLANT] = DoublePlant::class; self::$list[self::DOUBLE_PLANT] = DoublePlant::class;
self::$list[self::FENCE_GATE_SPRUCE] = FenceGateSpruce::class; self::$list[self::FENCE_GATE_SPRUCE] = FenceGateSpruce::class;
@ -439,7 +441,6 @@ class Block extends Position implements Metadatable{
self::$list[self::BEETROOT_BLOCK] = Beetroot::class; self::$list[self::BEETROOT_BLOCK] = Beetroot::class;
self::$list[self::STONECUTTER] = Stonecutter::class; self::$list[self::STONECUTTER] = Stonecutter::class;
self::$list[self::GLOWING_OBSIDIAN] = GlowingObsidian::class; self::$list[self::GLOWING_OBSIDIAN] = GlowingObsidian::class;
self::$list[self::NETHER_REACTOR] = NetherReactor::class;
foreach(self::$list as $id => $class){ foreach(self::$list as $id => $class){
if($class !== null){ if($class !== null){

View File

@ -0,0 +1,46 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class BrewingStand extends Transparent{
protected $id = self::BREWING_STAND;
public function __construct(){
}
public function getName(){
return "Brewing Stand";
}
public function getHardness(){
return 0.5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
}

View File

@ -49,7 +49,7 @@ class Bricks extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::BRICKS_BLOCK, 0, 1], [Item::BRICKS_BLOCK, 0, 1],
]; ];

View File

@ -135,7 +135,7 @@ class BurningFurnace extends Solid{
public function getDrops(Item $item){ public function getDrops(Item $item){
$drops = []; $drops = [];
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
$drops[] = [Item::FURNACE, 0, 1]; $drops[] = [Item::FURNACE, 0, 1];
} }

View File

@ -96,6 +96,7 @@ class Cake extends Transparent{
$ev = new EntityRegainHealthEvent($player, 3, EntityRegainHealthEvent::CAUSE_EATING); $ev = new EntityRegainHealthEvent($player, 3, EntityRegainHealthEvent::CAUSE_EATING);
$player->heal($ev->getAmount(), $ev); $player->heal($ev->getAmount(), $ev);
if(!$ev->isCancelled()){
if($this->meta >= 0x06){ if($this->meta >= 0x06){
$this->getLevel()->setBlock($this, new Air(), true); $this->getLevel()->setBlock($this, new Air(), true);
}else{ }else{
@ -104,6 +105,7 @@ class Cake extends Transparent{
return true; return true;
} }
}
return false; return false;
} }

View File

@ -45,7 +45,7 @@ class Coal extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::COAL_BLOCK, 0, 1], [Item::COAL_BLOCK, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class CoalOre extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::COAL, 0, 1], [Item::COAL, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class Cobblestone extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::COBBLESTONE, 0, 1], [Item::COBBLESTONE, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class Diamond extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= Tool::TIER_IRON){
return [ return [
[Item::DIAMOND_BLOCK, 0, 1], [Item::DIAMOND_BLOCK, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class DiamondOre extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= Tool::TIER_IRON){
return [ return [
[Item::DIAMOND, 0, 1], [Item::DIAMOND, 0, 1],
]; ];

View File

@ -49,13 +49,13 @@ class DoubleSlab extends Solid{
4 => "Brick", 4 => "Brick",
5 => "Stone Brick", 5 => "Stone Brick",
6 => "Quartz", 6 => "Quartz",
7 => "", 7 => "Nether Brick",
]; ];
return "DoubleTag " . $names[$this->meta & 0x07] . " Slab"; return "DoubleTag " . $names[$this->meta & 0x07] . " Slab";
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::SLAB, $this->meta & 0x07, 2], [Item::SLAB, $this->meta & 0x07, 2],
]; ];

View File

@ -45,7 +45,7 @@ class Emerald extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= Tool::TIER_IRON){
return [ return [
[Item::EMERALD_BLOCK, 0, 1], [Item::EMERALD_BLOCK, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class EmeraldOre extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= Tool::TIER_IRON){
return [ return [
[Item::EMERALD, 0, 1], [Item::EMERALD, 0, 1],
]; ];

View File

@ -97,7 +97,7 @@ class EnchantingTable extends Transparent{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[$this->id, 0, 1], [$this->id, 0, 1],
]; ];

View File

@ -26,6 +26,12 @@ use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3; use pocketmine\math\Vector3;
class Fence extends Transparent{ class Fence extends Transparent{
const FENCE_OAK = 0;
const FENCE_SPRUCE = 1;
const FENCE_BIRCH = 2;
const FENCE_JUNGLE = 3;
const FENCE_ACACIA = 4;
const FENCE_DARKOAK = 5;
protected $id = self::FENCE; protected $id = self::FENCE;
@ -38,18 +44,18 @@ class Fence extends Transparent{
} }
public function getToolType(){ public function getToolType(){
return Tool::TYPE_PICKAXE; return Tool::TYPE_AXE;
} }
public function getName(){ public function getName(){
static $names = [ static $names = [
0 => "Oak Fence", self::FENCE_OAK => "Oak Fence",
1 => "Spruce Fence", self::FENCE_SPRUCE => "Spruce Fence",
2 => "Birch Fence", self::FENCE_BIRCH => "Birch Fence",
3 => "Jungle Fence", self::FENCE_JUNGLE => "Jungle Fence",
4 => "Acacia Fence", self::FENCE_ACACIA => "Acacia Fence",
5 => "Dark Oak Fence", self::FENCE_DARKOAK => "Dark Oak Fence",
"", "",
"" ""
]; ];

View File

@ -23,6 +23,7 @@ namespace pocketmine\block;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\item\Tool; use pocketmine\item\Tool;
use pocketmine\level\sound\DoorSound;
use pocketmine\math\AxisAlignedBB; use pocketmine\math\AxisAlignedBB;
use pocketmine\Player; use pocketmine\Player;

View File

@ -21,21 +21,18 @@
namespace pocketmine\block; namespace pocketmine\block;
use pocketmine\item\Item;
class NetherReactor extends Solid{ class FlowerPot extends Transparent{
protected $id = self::NETHER_REACTOR; protected $id = self::FLOWER_POT_BLOCK;
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getName(){ public function getName(){
return "Nether Reactor"; return "Flower Pot Block";
}
public function canBeActivated(){
return true;
} }
} }

View File

@ -60,7 +60,7 @@ class GlowingRedstoneOre extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= Tool::TIER_IRON){
return [ return [
[Item::REDSTONE_DUST, 0, mt_rand(4, 5)], [Item::REDSTONE_DUST, 0, mt_rand(4, 5)],
]; ];

View File

@ -45,7 +45,7 @@ class Gold extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= Tool::TIER_IRON){
return [ return [
[Item::GOLD_BLOCK, 0, 1], [Item::GOLD_BLOCK, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class GoldOre extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 4){ if($item->isPickaxe() >= Tool::TIER_IRON){
return [ return [
[Item::GOLD_ORE, 0, 1], [Item::GOLD_ORE, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class Iron extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 3){ if($item->isPickaxe() >= Tool::TIER_STONE){
return [ return [
[Item::IRON_BLOCK, 0, 1], [Item::IRON_BLOCK, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class IronBars extends Thin{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::IRON_BARS, 0, 1], [Item::IRON_BARS, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class IronDoor extends Door{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::IRON_DOOR, 0, 1], [Item::IRON_DOOR, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class IronOre extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 3){ if($item->isPickaxe() >= Tool::TIER_STONE){
return [ return [
[Item::IRON_ORE, 0, 1], [Item::IRON_ORE, 0, 1],
]; ];

View File

@ -0,0 +1,156 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\Player;
class IronTrapdoor extends Transparent{
protected $id = self::IRON_TRAPDOOR;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getName(){
return "Iron Trapdoor";
}
public function getHardness(){
return 5;
}
public function canBeActivated(){
return true;
}
protected function recalculateBoundingBox(){
$damage = $this->getDamage();
$f = 0.1875;
if(($damage & 0x08) > 0){
$bb = new AxisAlignedBB(
$this->x,
$this->y + 1 - $f,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}else{
$bb = new AxisAlignedBB(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + $f,
$this->z + 1
);
}
if(($damage & 0x04) > 0){
if(($damage & 0x03) === 0){
$bb->setBounds(
$this->x,
$this->y,
$this->z + 1 - $f,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}elseif(($damage & 0x03) === 1){
$bb->setBounds(
$this->x,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + $f
);
}
if(($damage & 0x03) === 2){
$bb->setBounds(
$this->x + 1 - $f,
$this->y,
$this->z,
$this->x + 1,
$this->y + 1,
$this->z + 1
);
}
if(($damage & 0x03) === 3){
$bb->setBounds(
$this->x,
$this->y,
$this->z,
$this->x + $f,
$this->y + 1,
$this->z + 1
);
}
}
return $bb;
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
if(($target->isTransparent() === false or $target->getId() === self::SLAB) and $face !== 0 and $face !== 1){
$faces = [
2 => 0,
3 => 1,
4 => 2,
5 => 3,
];
$this->meta = $faces[$face] & 0x03;
if($fy > 0.5){
$this->meta |= 0x08;
}
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
return false;
}
public function getDrops(Item $item){
return [
[$this->id, 0, 1],
];
}
public function onActivate(Item $item, Player $player = null){
$this->meta ^= 0x04;
$this->getLevel()->setBlock($this, $this, true);
$this->level->addSound(new DoorSound($this));
return true;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
}

View File

@ -45,7 +45,7 @@ class Lapis extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 3){ if($item->isPickaxe() >= Tool::TIER_STONE){
return [ return [
[Item::LAPIS_BLOCK, 0, 1], [Item::LAPIS_BLOCK, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class LapisOre extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 3){ if($item->isPickaxe() >= Tool::TIER_STONE){
return [ return [
[Item::DYE, 4, mt_rand(4, 8)], [Item::DYE, 4, mt_rand(4, 8)],
]; ];

View File

@ -45,7 +45,7 @@ class MossStone extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::MOSS_STONE, $this->meta, 1], [Item::MOSS_STONE, $this->meta, 1],
]; ];

View File

@ -45,7 +45,7 @@ class NetherBrick extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::NETHER_BRICKS, 0, 1], [Item::NETHER_BRICKS, 0, 1],
]; ];

View File

@ -0,0 +1,71 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class NetherBrickFence extends Transparent {
protected $id = self::NETHER_BRICK_FENCE;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function getBreakTime(Item $item){
if ($item instanceof Air){
//Breaking by hand
return 10;
}
else{
// Other breaktimes are equal to woodfences.
return parent::getBreakTime($item);
}
}
public function getHardness(){
return 2;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
public function getName(){
return "Nether Brick Fence";
}
public function canConnect(Block $block){
//TODO: activate comments when the NetherBrickFenceGate class has been created.
return ($block instanceof NetherBrickFence /* or $block instanceof NetherBrickFenceGate */) ? true : $block->isSolid() and !$block->isTransparent();
}
public function getDrops(Item $item){
if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [
[$this->id, $this->meta, 1],
];
}else{
return [];
}
}
}

View File

@ -45,7 +45,7 @@ class Netherrack extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::NETHERRACK, 0, 1], [Item::NETHERRACK, 0, 1],
]; ];

View File

@ -45,7 +45,7 @@ class Obsidian extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 5){ if($item->isPickaxe() >= Tool::TIER_DIAMOND){
return [ return [
[Item::OBSIDIAN, 0, 1], [Item::OBSIDIAN, 0, 1],
]; ];

View File

@ -0,0 +1,47 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
class PackedIce extends Solid{
protected $id = self::PACKED_ICE;
public function __construct(){
}
public function getName(){
return "Packed Ice";
}
public function getHardness(){
return 0.5;
}
public function getToolType(){
return Tool::TYPE_PICKAXE;
}
}

View File

@ -26,6 +26,11 @@ use pocketmine\item\Tool;
class Quartz extends Solid{ class Quartz extends Solid{
const QUARTZ_NORMAL = 0;
const QUARTZ_CHISELED = 1;
const QUARTZ_PILLAR = 2;
const QUARTZ_PILLAR2 = 3;
protected $id = self::QUARTZ_BLOCK; protected $id = self::QUARTZ_BLOCK;
public function __construct($meta = 0){ public function __construct($meta = 0){
@ -38,10 +43,10 @@ class Quartz extends Solid{
public function getName(){ public function getName(){
static $names = [ static $names = [
0 => "Quartz Block", self::QUARTZ_NORMAL => "Quartz Block",
1 => "Chiseled Quartz Block", self::QUARTZ_CHISELED => "Chiseled Quartz Block",
2 => "Quartz Pillar", self::QUARTZ_PILLAR => "Quartz Pillar",
3 => "Quartz Pillar", self::QUARTZ_PILLAR2 => "Quartz Pillar",
]; ];
return $names[$this->meta & 0x03]; return $names[$this->meta & 0x03];
} }
@ -51,7 +56,7 @@ class Quartz extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::QUARTZ_BLOCK, $this->meta & 0x03, 1], [Item::QUARTZ_BLOCK, $this->meta & 0x03, 1],
]; ];

View File

@ -45,7 +45,7 @@ class Redstone extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::REDSTONE_BLOCK, 0, 1], [Item::REDSTONE_BLOCK, 0, 1],
]; ];

View File

@ -58,7 +58,7 @@ class RedstoneOre extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 2){ if($item->isPickaxe() >= Tool::TIER_GOLD){
return [ return [
[Item::REDSTONE_DUST, 0, mt_rand(4, 5)], [Item::REDSTONE_DUST, 0, mt_rand(4, 5)],
]; ];

View File

@ -26,6 +26,10 @@ use pocketmine\item\Tool;
class Sandstone extends Solid{ class Sandstone extends Solid{
const NORMAL = 0;
const CHISELED = 1;
const SMOOTH = 2;
protected $id = self::SANDSTONE; protected $id = self::SANDSTONE;
public function __construct($meta = 0){ public function __construct($meta = 0){
@ -38,9 +42,9 @@ class Sandstone extends Solid{
public function getName(){ public function getName(){
static $names = [ static $names = [
0 => "Sandstone", self::NORMAL => "Sandstone",
1 => "Chiseled Sandstone", self::CHISELED => "Chiseled Sandstone",
2 => "Smooth Sandstone", self::SMOOTH => "Smooth Sandstone",
3 => "", 3 => "",
]; ];
return $names[$this->meta & 0x03]; return $names[$this->meta & 0x03];
@ -51,7 +55,7 @@ class Sandstone extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::SANDSTONE, $this->meta & 0x03, 1], [Item::SANDSTONE, $this->meta & 0x03, 1],
]; ];

View File

@ -88,7 +88,7 @@ class SignPost extends Transparent{
} }
public function onBreak(Item $item){ public function onBreak(Item $item){
$this->getLevel()->setBlock($this, new Air(), true, true, true); $this->getLevel()->setBlock($this, new Air(), true, true);
return true; return true;
} }

View File

@ -27,6 +27,14 @@ use pocketmine\math\AxisAlignedBB;
use pocketmine\Player; use pocketmine\Player;
class Slab extends Transparent{ class Slab extends Transparent{
const STONE = 0;
const SANDSTONE = 1;
const WOODEN = 2;
const COBBLESTONE = 3;
const BRICK = 4;
const STONE_BRICK = 5;
const QUARTZ = 6;
const NETHER_BRICK = 7;
protected $id = self::SLAB; protected $id = self::SLAB;
@ -40,14 +48,14 @@ class Slab extends Transparent{
public function getName(){ public function getName(){
static $names = [ static $names = [
0 => "Stone", self::STONE => "Stone",
1 => "Sandstone", self::SANDSTONE => "Sandstone",
2 => "Wooden", self::WOODEN => "Wooden",
3 => "Cobblestone", self::COBBLESTONE => "Cobblestone",
4 => "Brick", self::BRICK => "Brick",
5 => "Stone Brick", self::STONE_BRICK => "Stone Brick",
6 => "Quartz", self::QUARTZ => "Quartz",
7 => "", self::NETHER_BRICK => "Nether Brick",
]; ];
return (($this->meta & 0x08) > 0 ? "Upper " : "") . $names[$this->meta & 0x07] . " Slab"; return (($this->meta & 0x08) > 0 ? "Upper " : "") . $names[$this->meta & 0x07] . " Slab";
} }
@ -125,7 +133,7 @@ class Slab extends Transparent{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[$this->id, $this->meta & 0x07, 1], [$this->id, $this->meta & 0x07, 1],
]; ];

View File

@ -22,6 +22,7 @@
namespace pocketmine\block; namespace pocketmine\block;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB; use pocketmine\math\AxisAlignedBB;
use pocketmine\Player; use pocketmine\Player;
@ -143,7 +144,7 @@ abstract class Stair extends Transparent{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[$this->getId(), 0, 1], [$this->getId(), 0, 1],
]; ];

View File

@ -37,7 +37,6 @@ class Stone extends Solid{
public function __construct($meta = 0){ public function __construct($meta = 0){
$this->meta = $meta; $this->meta = $meta;
} }
public function getHardness(){ public function getHardness(){

View File

@ -25,6 +25,10 @@ use pocketmine\item\Item;
use pocketmine\item\Tool; use pocketmine\item\Tool;
class StoneBricks extends Solid{ class StoneBricks extends Solid{
const NORMAL = 0;
const MOSSY = 1;
const CRACKED = 2;
const CHISELED = 3;
protected $id = self::STONE_BRICKS; protected $id = self::STONE_BRICKS;
@ -42,16 +46,16 @@ class StoneBricks extends Solid{
public function getName(){ public function getName(){
static $names = [ static $names = [
0 => "Stone Bricks", self::NORMAL => "Stone Bricks",
1 => "Mossy Stone Bricks", self::MOSSY => "Mossy Stone Bricks",
2 => "Cracked Stone Bricks", self::CRACKED => "Cracked Stone Bricks",
3 => "Chiseled Stone Bricks", self::CHISELED => "Chiseled Stone Bricks",
]; ];
return $names[$this->meta & 0x03]; return $names[$this->meta & 0x03];
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::STONE_BRICKS, $this->meta & 0x03, 1], [Item::STONE_BRICKS, $this->meta & 0x03, 1],
]; ];

View File

@ -27,6 +27,8 @@ use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3; use pocketmine\math\Vector3;
class StoneWall extends Transparent{ class StoneWall extends Transparent{
const NONE_MOSSY_WALL = 0;
const MOSSY_WALL = 1;
protected $id = self::STONE_WALL; protected $id = self::STONE_WALL;

View File

@ -55,7 +55,7 @@ class Stonecutter extends Solid{
} }
public function getDrops(Item $item){ public function getDrops(Item $item){
if($item->isPickaxe() >= 1){ if($item->isPickaxe() >= Tool::TIER_WOODEN){
return [ return [
[Item::STONECUTTER, 0, 1], [Item::STONECUTTER, 0, 1],
]; ];

View File

@ -24,6 +24,7 @@ namespace pocketmine\block;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\item\Tool; use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB; use pocketmine\math\AxisAlignedBB;
use pocketmine\level\sound\DoorSound;
use pocketmine\Player; use pocketmine\Player;
class Trapdoor extends Transparent{ class Trapdoor extends Transparent{

View File

@ -0,0 +1,181 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\Tool;
use pocketmine\math\AxisAlignedBB;
use pocketmine\nbt\NBT;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\Enum;
use pocketmine\nbt\tag\Int as IntTag;
use pocketmine\nbt\tag\String as StringTag;
use pocketmine\Player;
use pocketmine\tile\Chest as TileChest;
use pocketmine\tile\Tile;
class TrappedChest extends Transparent{
protected $id = self::CHEST;
public function __construct($meta = 0){
$this->meta = $meta;
}
public function canBeActivated(){
return true;
}
public function getHardness(){
return 2.5;
}
public function getName(){
return "Trapped Chest";
}
public function getToolType(){
return Tool::TYPE_AXE;
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x + 0.0625,
$this->y,
$this->z + 0.0625,
$this->x + 0.9375,
$this->y + 0.9475,
$this->z + 0.9375
);
}
public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){
$faces = [
0 => 4,
1 => 2,
2 => 5,
3 => 3,
];
$chest = null;
$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];
for($side = 2; $side <= 5; ++$side){
if(($this->meta === 4 or $this->meta === 5) and ($side === 4 or $side === 5)){
continue;
}elseif(($this->meta === 3 or $this->meta === 2) and ($side === 2 or $side === 3)){
continue;
}
$c = $this->getSide($side);
if($c instanceof Chest and $c->getDamage() === $this->meta){
$tile = $this->getLevel()->getTile($c);
if($tile instanceof TileChest and !$tile->isPaired()){
$chest = $tile;
break;
}
}
}
$this->getLevel()->setBlock($block, $this, true, true);
$nbt = new CompoundTag("", [
new Enum("Items", []),
new StringTag("id", Tile::CHEST),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
if($item->hasCustomName()){
$nbt->CustomName = new StringTag("CustomName", $item->getCustomName());
}
if($item->hasCustomBlockData()){
foreach($item->getCustomBlockData() as $key => $v){
$nbt->{$key} = $v;
}
}
$tile = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
if($chest instanceof TileChest and $tile instanceof TileChest){
$chest->pairWith($tile);
$tile->pairWith($chest);
}
return true;
}
public function onBreak(Item $item){
$t = $this->getLevel()->getTile($this);
if($t instanceof TileChest){
$t->unpair();
}
$this->getLevel()->setBlock($this, new Air(), true, true);
return true;
}
public function onActivate(Item $item, Player $player = null){
if($player instanceof Player){
$top = $this->getSide(1);
if($top->isTransparent() !== true){
return true;
}
$t = $this->getLevel()->getTile($this);
$chest = null;
if($t instanceof TileChest){
$chest = $t;
}else{
$nbt = new CompoundTag("", [
new Enum("Items", []),
new StringTag("id", Tile::CHEST),
new IntTag("x", $this->x),
new IntTag("y", $this->y),
new IntTag("z", $this->z)
]);
$nbt->Items->setTagType(NBT::TAG_Compound);
$chest = Tile::createTile("Chest", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);
}
if(isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof String){
if($chest->namedtag->Lock->getValue() !== $item->getCustomName()){
return true;
}
}
if($player->isCreative()){
return true;
}
$player->addWindow($chest->getInventory());
}
return true;
}
public function getDrops(Item $item){
return [
[$this->id, 0, 1],
];
}
}

View File

@ -22,6 +22,8 @@
namespace pocketmine\block; namespace pocketmine\block;
use pocketmine\level\Level;
class WallSign extends SignPost{ class WallSign extends SignPost{
protected $id = self::WALL_SIGN; protected $id = self::WALL_SIGN;
@ -31,6 +33,20 @@ class WallSign extends SignPost{
} }
public function onUpdate($type){ public function onUpdate($type){
$faces = [
2 => 3,
3 => 2,
4 => 5,
5 => 4,
];
if($type === Level::BLOCK_UPDATE_NORMAL){
if(isset($faces[$this->meta])) {
if ($this->getSide($faces[$this->meta])->getId() === self::AIR) {
$this->getLevel()->useBreakOn($this);
}
return Level::BLOCK_UPDATE_NORMAL;
}
}
return false; return false;
} }
} }

View File

@ -64,9 +64,9 @@ class BanListCommand extends VanillaCommand{
} }
if($args[0] === "ips"){ if($args[0] === "ips"){
$sender->sendMessage("commands.banlist.ips", [count($list)]); $sender->sendMessage(new TranslationContainer("commands.banlist.ips", [count($list)]));
}else{ }else{
$sender->sendMessage("commands.banlist.players", [count($list)]); $sender->sendMessage(new TranslationContainer("commands.banlist.players", [count($list)]));
} }
$sender->sendMessage(substr($message, 0, -2)); $sender->sendMessage(substr($message, 0, -2));

View File

@ -57,15 +57,15 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
public $height = 1.8; public $height = 1.8;
public $eyeHeight = 1.62; public $eyeHeight = 1.62;
protected $skinName;
protected $skin; protected $skin;
protected $isSlim = false;
public function getSkinData(){ public function getSkinData(){
return $this->skin; return $this->skin;
} }
public function isSkinSlim(){ public function getSkinName(){
return $this->isSlim; return $this->skinName;
} }
/** /**
@ -84,11 +84,11 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
/** /**
* @param string $str * @param string $str
* @param bool $isSlim * @param string $skinName
*/ */
public function setSkin($str, $isSlim = false){ public function setSkin($str, $skinName){
$this->skin = $str; $this->skin = $str;
$this->isSlim = (bool) $isSlim; $this->skinName = $skinName;
} }
public function getInventory(){ public function getInventory(){
@ -112,7 +112,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
} }
if(isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof CompoundTag){ if(isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof CompoundTag){
$this->setSkin($this->namedtag->Skin["Data"], $this->namedtag->Skin["Slim"] > 0); $this->setSkin($this->namedtag->Skin["Data"], $this->namedtag->Skin["Name"]);
} }
$this->uuid = UUID::fromData($this->getId(), $this->getSkinData(), $this->getNameTag()); $this->uuid = UUID::fromData($this->getId(), $this->getSkinData(), $this->getNameTag());
@ -195,7 +195,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
if(strlen($this->getSkinData()) > 0){ if(strlen($this->getSkinData()) > 0){
$this->namedtag->Skin = new CompoundTag("Skin", [ $this->namedtag->Skin = new CompoundTag("Skin", [
"Data" => new StringTag("Data", $this->getSkinData()), "Data" => new StringTag("Data", $this->getSkinData()),
"Slim" => new ByteTag("Slim", $this->isSkinSlim() ? 1 : 0) "Name" => new StringTag("Name", $this->getSkinName())
]); ]);
} }
} }
@ -210,7 +210,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
if(!($this instanceof Player)){ if(!($this instanceof Player)){
$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getName(), $this->isSlim, $this->skin, [$player]); $this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getName(), $this->skinName, $this->skin, [$player]);
} }
$pk = new AddPlayerPacket(); $pk = new AddPlayerPacket();

View File

@ -36,7 +36,7 @@ class PlayerQuitEvent extends PlayerEvent{
public function __construct(Player $player, $quitMessage, $autoSave = true){ public function __construct(Player $player, $quitMessage, $autoSave = true){
$this->player = $player; $this->player = $player;
$this->quitMessage = $quitMessage; $this->quitMessage = $quitMessage;
$this->autoSave = true; $this->autoSave = $autoSave;
} }
public function setQuitMessage($quitMessage){ public function setQuitMessage($quitMessage){

View File

@ -385,7 +385,7 @@ abstract class BaseInventory implements Inventory{
} }
public function setMaxStackSize($size){ public function setMaxStackSize($size){
$this->setMaxStackSize($size); $this->maxStackSize = (int) $size;
} }
public function open(Player $who){ public function open(Player $who){

View File

@ -23,7 +23,7 @@ namespace pocketmine\inventory;
use pocketmine\level\Level; use pocketmine\level\Level;
use pocketmine\network\Network; use pocketmine\network\Network;
use pocketmine\network\protocol\TileEventPacket; use pocketmine\network\protocol\BlockEventPacket;
use pocketmine\Player; use pocketmine\Player;
use pocketmine\tile\Chest; use pocketmine\tile\Chest;
@ -44,7 +44,7 @@ class ChestInventory extends ContainerInventory{
parent::onOpen($who); parent::onOpen($who);
if(count($this->getViewers()) === 1){ if(count($this->getViewers()) === 1){
$pk = new TileEventPacket(); $pk = new BlockEventPacket();
$pk->x = $this->getHolder()->getX(); $pk->x = $this->getHolder()->getX();
$pk->y = $this->getHolder()->getY(); $pk->y = $this->getHolder()->getY();
$pk->z = $this->getHolder()->getZ(); $pk->z = $this->getHolder()->getZ();
@ -58,7 +58,7 @@ class ChestInventory extends ContainerInventory{
public function onClose(Player $who){ public function onClose(Player $who){
if(count($this->getViewers()) === 1){ if(count($this->getViewers()) === 1){
$pk = new TileEventPacket(); $pk = new BlockEventPacket();
$pk->x = $this->getHolder()->getX(); $pk->x = $this->getHolder()->getX();
$pk->y = $this->getHolder()->getY(); $pk->y = $this->getHolder()->getY();
$pk->z = $this->getHolder()->getZ(); $pk->z = $this->getHolder()->getZ();

View File

@ -21,8 +21,15 @@
namespace pocketmine\inventory; namespace pocketmine\inventory;
use pocketmine\block\Planks; use pocketmine\block\Planks;
use pocketmine\block\Quartz;
use pocketmine\block\Sandstone;
use pocketmine\block\Slab;
use pocketmine\block\Fence;
use pocketmine\block\Stone; use pocketmine\block\Stone;
use pocketmine\block\StoneBricks;
use pocketmine\block\StoneWall;
use pocketmine\block\Wood; use pocketmine\block\Wood;
use pocketmine\block\Wood2; use pocketmine\block\Wood2;
use pocketmine\item\Item; use pocketmine\item\Item;
@ -110,56 +117,245 @@ class CraftingManager{
"XX" "XX"
))->setIngredient("X", Item::get(Item::STRING, 0, 4))); ))->setIngredient("X", Item::get(Item::STRING, 0, 4)));
$this->registerRecipe((new ShapelessRecipe(Item::get(Item::TORCH, 0, 4)))->addIngredient(Item::get(Item::COAL, 0, 1))->addIngredient(Item::get(Item::STICK, 0, 1))); $this->registerRecipe((new ShapedRecipe(Item::get(Item::TORCH, 0, 4),
$this->registerRecipe((new ShapelessRecipe(Item::get(Item::TORCH, 0, 4)))->addIngredient(Item::get(Item::COAL, 1, 1))->addIngredient(Item::get(Item::STICK, 0, 1))); "C ",
$this->registerRecipe((new ShapelessRecipe(Item::get(Item::SUGAR, 0, 1)))->addIngredient(Item::get(Item::SUGARCANE, 0, 1))); "S"
))->setIngredient("C", Item::get(Item::COAL,0,1))->setIngredient("S", Item::get(Item::STICK,0,1)));
$this->registerRecipe((new ShapedRecipe(Item::get(Item::TORCH, 0, 4),
"C ",
"S"
))->setIngredient("C", Item::get(Item::COAL, 1, 1))->setIngredient("S", Item::get(Item::STICK, 0, 1)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::BED, 0, 1)))->addIngredient(Item::get(Item::WOOL, null, 3))->addIngredient(Item::get(Item::WOODEN_PLANK, null, 3))); $this->registerRecipe((new ShapedRecipe(Item::get(Item::SUGAR, 0, 1),
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::CHEST, 0, 1)))->addIngredient(Item::get(Item::WOODEN_PLANK, null, 8))); "S"
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, 0, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::OAK, 4))); ))->setIngredient("S", Item::get(Item::SUGARCANE, 0, 1)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::SPRUCE, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 4)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::BIRCH, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 4)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::JUNGLE, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::JUNGLE, 4)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::ACACIA, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::ACACIA, 4)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE, Planks::DARK_OAK, 3)))->addIngredient(Item::get(Item::STICK, 0, 2))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::DARK_OAK, 4)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_GATE, 0, 1)))->addIngredient(Item::get(Item::STICK, 0, 4))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::OAK, 2)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_GATE_SPRUCE, 0, 1)))->addIngredient(Item::get(Item::STICK, 0, 4))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 2)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_GATE_BIRCH, 0, 1)))->addIngredient(Item::get(Item::STICK, 0, 4))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 2)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_GATE_JUNGLE, 0, 1)))->addIngredient(Item::get(Item::STICK, 0, 4))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::JUNGLE, 2)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_GATE_DARK_OAK, 0, 1)))->addIngredient(Item::get(Item::STICK, 0, 4))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::DARK_OAK, 2)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FENCE_GATE_ACACIA, 0, 1)))->addIngredient(Item::get(Item::STICK, 0, 4))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::ACACIA, 2)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::FURNACE, 0, 1)))->addIngredient(Item::get(Item::COBBLESTONE, 0, 8)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::GLASS_PANE, 0, 16)))->addIngredient(Item::get(Item::GLASS, 0, 6)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::LADDER, 0, 2)))->addIngredient(Item::get(Item::STICK, 0, 7)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::NETHER_REACTOR, 0, 1)))->addIngredient(Item::get(Item::DIAMOND, 0, 3))->addIngredient(Item::get(Item::IRON_INGOT, 0, 6)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::TRAPDOOR, 0, 2)))->addIngredient(Item::get(Item::WOODEN_PLANK, null, 6)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::WOODEN_DOOR, 0, 1)))->addIngredient(Item::get(Item::WOODEN_PLANK, null, 6)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::WOODEN_STAIRS, 0, 4)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::OAK, 6)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::WOOD_SLAB, Planks::OAK, 6)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::OAK, 3)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::SPRUCE_WOOD_STAIRS, 0, 4)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 6)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::WOOD_SLAB, Planks::SPRUCE, 6)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 3)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::BIRCH_WOOD_STAIRS, 0, 4)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 6)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::WOOD_SLAB, Planks::BIRCH, 6)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 3)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::JUNGLE_WOOD_STAIRS, 0, 4)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::JUNGLE, 6)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::WOOD_SLAB, Planks::JUNGLE, 6)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::JUNGLE, 3)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::ACACIA_WOOD_STAIRS, 0, 4)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::ACACIA, 6)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::WOOD_SLAB, Planks::ACACIA, 6)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::ACACIA, 3)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::DARK_OAK_WOOD_STAIRS, 0, 4)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::DARK_OAK, 6)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::WOOD_SLAB, Planks::DARK_OAK, 6)))->addIngredient(Item::get(Item::WOODEN_PLANK, Planks::DARK_OAK, 3)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::BUCKET, 0, 1)))->addIngredient(Item::get(Item::IRON_INGOT, 0, 3))); $this->registerRecipe((new BigShapedRecipe(Item::get(Item::BED, 0, 1),
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::CLOCK, 0, 1)))->addIngredient(Item::get(Item::GOLD_INGOT, 0, 4))->addIngredient(Item::get(Item::REDSTONE_DUST, 0, 1))); "WWW",
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::COMPASS, 0, 1)))->addIngredient(Item::get(Item::IRON_INGOT, 0, 4))->addIngredient(Item::get(Item::REDSTONE_DUST, 0, 1))); "PPP"
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::TNT, 0, 1)))->addIngredient(Item::get(Item::GUNPOWDER, 0, 5))->addIngredient(Item::get(Item::SAND, null, 4))); ))->setIngredient("W", Item::get(Item::WOOL, null, 3))->setIngredient("P", Item::get(Item::WOODEN_PLANK, null, 3)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::BOWL, 0, 4)))->addIngredient(Item::get(Item::WOODEN_PLANKS, null, 3)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::MINECART, 0, 1)))->addIngredient(Item::get(Item::IRON_INGOT, 0, 5))); $this->registerRecipe((new BigShapedRecipe(Item::get(Item::CHEST, 0, 1),
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::BOOK, 0, 1)))->addIngredient(Item::get(Item::PAPER, 0, 3))); "PPP",
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::BOOKSHELF, 0, 1)))->addIngredient(Item::get(Item::WOODEN_PLANK, null, 6))->addIngredient(Item::get(Item::BOOK, 0, 3))); "P P",
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::PAINTING, 0, 1)))->addIngredient(Item::get(Item::STICK, 0, 8))->addIngredient(Item::get(Item::WOOL, null, 1))); "PPP"
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::PAPER, 0, 1)))->addIngredient(Item::get(Item::SUGARCANE, 0, 3))); ))->setIngredient("P", Item::get(Item::WOODEN_PLANK, null, 8)));
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::SIGN, 0, 3)))->addIngredient(Item::get(Item::STICK, 0, 1))->addIngredient(Item::get(Item::WOODEN_PLANKS, null, 6))); //TODO: check if it gives one sign or three
$this->registerRecipe((new BigShapelessRecipe(Item::get(Item::IRON_BARS, 0, 16)))->addIngredient(Item::get(Item::IRON_INGOT, 0, 6))); $this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE, 0, 3),
"PSP",
"PSP"
))->setIngredient("S", Item::get(Item::STICK, 0, 2))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::OAK, 4)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE, Planks::SPRUCE, 3),
"PSP",
"PSP"
))->setIngredient("S", Item::get(Item::STICK, 0, 2))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 4)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE, Planks::BIRCH, 3),
"PSP",
"PSP"
))->setIngredient("S", Item::get(Item::STICK, 0, 2))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 4)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE, Planks::JUNGLE, 3),
"PSP",
"PSP"
))->setIngredient("S", Item::get(Item::STICK, 0, 2))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::JUNGLE, 4)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE, Planks::ACACIA, 3),
"PSP",
"PSP"
))->setIngredient("S", Item::get(Item::STICK, 0, 2))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::ACACIA, 4)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE, Planks::DARK_OAK, 3),
"PSP",
"PSP"
))->setIngredient("S", Item::get(Item::STICK, 0, 2))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::DARK_OAK, 4)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE_GATE, 0, 1),
"SPS",
"SPS"
))->setIngredient("S", Item::get(Item::STICK, 0, 4))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::OAK, 2)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE_GATE_SPRUCE, 0, 1),
"SPS",
"SPS"
))->setIngredient("S", Item::get(Item::STICK, 0, 4))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 2)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE_GATE_BIRCH, 0, 1),
"SPS",
"SPS"
))->setIngredient("S", Item::get(Item::STICK, 0, 4))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 2)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE_GATE_JUNGLE, 0, 1),
"SPS",
"SPS"
))->setIngredient("S", Item::get(Item::STICK, 0, 4))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::JUNGLE, 2)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE_GATE_DARK_OAK, 0, 1),
"SPS",
"SPS"
))->setIngredient("S", Item::get(Item::STICK, 0, 4))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::DARK_OAK, 2)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FENCE_GATE_ACACIA, 0, 1),
"SPS",
"SPS"
))->setIngredient("S", Item::get(Item::STICK, 0, 4))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::ACACIA, 2)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::FURNACE, 0, 1),
"CCC",
"C C",
"CCC"
))->setIngredient("C", Item::get(Item::COBBLESTONE, 0, 8)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::GLASS_PANE, 0, 16),
"GGG",
"GGG"
))->setIngredient("G", Item::get(Item::GLASS, 0, 6)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::LADDER, 0, 2),
"S S",
"SSS",
"S S"
))->setIngredient("S", Item::get(Item::STICK, 0, 7)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::TRAPDOOR, 0, 2),
"PPP",
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, null, 6)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::WOODEN_DOOR, 0, 1),
"PP",
"PP",
"PP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, null, 6)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::WOODEN_STAIRS, 0, 4),
" P",
" PP",
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::OAK, 6)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::WOOD_SLAB, Planks::OAK, 6),
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::OAK, 3)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::SPRUCE_WOOD_STAIRS, 0, 4),
" P",
" PP",
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 6)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::WOOD_SLAB, Planks::SPRUCE, 6),
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::SPRUCE, 3)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::BIRCH_WOOD_STAIRS, 0, 4),
" P",
" PP",
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 6)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::WOOD_SLAB, Planks::BIRCH, 6),
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::BIRCH, 3)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::JUNGLE_WOOD_STAIRS, 0, 4),
"P",
"PP",
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::JUNGLE, 6)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::WOOD_SLAB, Planks::JUNGLE, 6),
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::JUNGLE, 3)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::ACACIA_WOOD_STAIRS, 0, 4),
" P",
" PP",
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::ACACIA, 6)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::WOOD_SLAB, Planks::ACACIA, 6),
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::ACACIA, 3)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::DARK_OAK_WOOD_STAIRS, 0, 4),
" P",
" PP",
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::DARK_OAK, 6)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::WOOD_SLAB, Planks::DARK_OAK, 6),
"PPP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, Planks::DARK_OAK, 3)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::BUCKET, 0, 1),
"I I",
" I"
))->setIngredient("I", Item::get(Item::IRON_INGOT, 0, 3)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::CLOCK, 0, 1),
" G",
"GR",
" G"
))->setIngredient("G", Item::get(Item::GOLD_INGOT, 0, 4))->setIngredient("R", Item::get(Item::REDSTONE_DUST, 0, 1)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::COMPASS, 0, 1),
" I ",
"IRI",
" I"
))->setIngredient("I", Item::get(Item::IRON_INGOT, 0, 4))->setIngredient("R", Item::get(Item::REDSTONE_DUST, 0, 1)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::TNT, 0, 1),
"GSG",
"SGS",
"GSG"
))->setIngredient("G", Item::get(Item::GUNPOWDER, 0, 5))->setIngredient("S", Item::get(Item::SAND, null, 4)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::BOWL, 0, 4),
"P P",
" P"
))->setIngredient("P", Item::get(Item::WOODEN_PLANKS, null, 3)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::MINECART, 0, 1),
"I I",
"III"
))->setIngredient("I", Item::get(Item::IRON_INGOT, 0, 5)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::BOOK, 0, 1),
"P P",
" P "
))->setIngredient("P", Item::get(Item::PAPER, 0, 3)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::BOOKSHELF, 0, 1),
"PBP",
"PBP",
"PBP"
))->setIngredient("P", Item::get(Item::WOODEN_PLANK, null, 6))->setIngredient("B", Item::get(Item::BOOK, 0, 3)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::PAINTING, 0, 1),
"SSS",
"SWS",
"SSS"
))->setIngredient("S", Item::get(Item::STICK, 0, 8))->setIngredient("W", Item::get(Item::WOOL, null, 1)));
$this->registerRecipe((new ShapedRecipe(Item::get(Item::PAPER, 0, 3),
"SS",
"S"
))->setIngredient("S", Item::get(Item::SUGARCANE, 0, 3)));
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::SIGN, 0, 3),
"PPP",
"PPP",
" S"
))->setIngredient("S", Item::get(Item::STICK, 0, 1))->setIngredient("P", Item::get(Item::WOODEN_PLANKS, null, 6))); //TODO: check if it gives one sign or three
$this->registerRecipe((new BigShapedRecipe(Item::get(Item::IRON_BARS, 0, 16),
"III",
"III",
"III"
))->setIngredient("I", Item::get(Item::IRON_INGOT, 0, 9)));
} }
protected function registerFurnace(){ protected function registerFurnace(){
@ -186,37 +382,141 @@ class CraftingManager{
} }
protected function registerStonecutter(){ protected function registerStonecutter(){
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::QUARTZ_BLOCK, 0, 1)))->addIngredient(Item::get(Item::QUARTZ, 0, 4))); $shapes = [
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::BRICK_STAIRS, 0, 4)))->addIngredient(Item::get(Item::BRICKS_BLOCK, 0, 6))); "slab" => [
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::BRICKS_BLOCK, 0, 1)))->addIngredient(Item::get(Item::BRICK, 0, 4))); " ",
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 4, 6)))->addIngredient(Item::get(Item::BRICKS_BLOCK, 0, 3))); "XXX",
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::QUARTZ_BLOCK, 1, 1)))->addIngredient(Item::get(Item::SLAB, 6, 2))); " "
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 3, 6)))->addIngredient(Item::get(Item::COBBLESTONE, 0, 3))); ],
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::COBBLESTONE_WALL, 0, 6)))->addIngredient(Item::get(Item::COBBLESTONE, 0, 6))); "stairs" => [
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::COBBLESTONE_WALL, 1, 6)))->addIngredient(Item::get(Item::MOSS_STONE, 0, 6))); "X ",
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::NETHER_BRICKS, 0, 1)))->addIngredient(Item::get(Item::NETHER_BRICK, 0, 4))); "XX ",
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::NETHER_BRICKS_STAIRS, 0, 4)))->addIngredient(Item::get(Item::NETHER_BRICKS, 0, 6))); "XXX"
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::QUARTZ_BLOCK, 2, 2)))->addIngredient(Item::get(Item::QUARTZ_BLOCK, 0, 2))); ],
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 6, 6)))->addIngredient(Item::get(Item::QUARTZ_BLOCK, 0, 3))); "wall/fence" => [
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SANDSTONE_STAIRS, 0, 4)))->addIngredient(Item::get(Item::SANDSTONE, 0, 6))); "XXX",
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SANDSTONE, 0, 1)))->addIngredient(Item::get(Item::SAND, 0, 4))); "XXX",
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SANDSTONE, 2, 4)))->addIngredient(Item::get(Item::SANDSTONE, 0, 4))); " "
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SANDSTONE, 1, 1)))->addIngredient(Item::get(Item::SLAB, 1, 2))); ],
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 1, 6)))->addIngredient(Item::get(Item::SANDSTONE, 0, 3))); "blockrecipe1" => [
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE_BRICK_STAIRS, 0, 4)))->addIngredient(Item::get(Item::STONE_BRICK, null, 6))); "XX",
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE_BRICK, 0, 4)))->addIngredient(Item::get(Item::STONE, null, 4))); "XX"
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE_BRICK, 3, 1)))->addIngredient(Item::get(Item::SLAB, 5, 2))); ],
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE_BRICK, 1, 1)))->addIngredient(Item::get(Item::STONE_BRICK, 0, 1))->addIngredient(Item::get(Item::VINES, 0, 1))); "blockrecipe2X1" => [
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 5, 6)))->addIngredient(Item::get(Item::STONE_BRICK, null, 3))); " ",
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::SLAB, 0, 6)))->addIngredient(Item::get(Item::STONE, null, 3))); " X ",
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::COBBLESTONE_STAIRS, 0, 4)))->addIngredient(Item::get(Item::COBBLESTONE, 0, 6))); " X "
],
"blockrecipe2X2" => [
"AB",
"BA"
],
"blockrecipe1X2" => [
" ",
"AB"
]
];
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::POLISHED_GRANITE, 4)))->addIngredient(Item::get(Item::STONE, Stone::GRANITE, 4))); $buildRecipes = [];
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::POLISHED_DIORITE, 4)))->addIngredient(Item::get(Item::STONE, Stone::DIORITE, 4)));
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::POLISHED_ANDESITE, 4)))->addIngredient(Item::get(Item::STONE, Stone::ANDESITE, 4))); // Single ingedient stone cutter recipes:
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::GRANITE, 1)))->addIngredient(Item::get(Item::STONE, Stone::DIORITE, 1))->addIngredient(Item::get(Item::QUARTZ, 0, 1))); $RESULT_ITEMID = 0; $RESULT_META = 1; $INGREDIENT_ITEMID = 2; $INGREDIENT_META = 3; $RECIPE_SHAPE = 4;$RESULT_AMOUNT = 5;
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::DIORITE, 2)))->addIngredient(Item::get(Item::COBBLESTONE, 0, 2))->addIngredient(Item::get(Item::QUARTZ, 0, 2))); $recipes = [
$this->registerRecipe((new StonecutterShapelessRecipe(Item::get(Item::STONE, Stone::ANDESITE, 2)))->addIngredient(Item::get(Item::COBBLESTONE, 0, 1))->addIngredient(Item::get(Item::STONE, Stone::DIORITE, 1))); //RESULT_ITEM_ID RESULT_META INGREDIENT_ITEMID INGREDIENT_META RECIPE_SHAPE RESULT_AMOUNT
[Item::SLAB, Slab::STONE, Item::STONE, Stone::NORMAL, "slab", 6],
[Item::SLAB, Slab::COBBLESTONE, Item::COBBLESTONE, 0, "slab", 6],
[Item::SLAB, Slab::SANDSTONE, Item::SANDSTONE, 0, "slab", 6],
[Item::SLAB, Slab::BRICK, Item::BRICK, 0, "slab", 6],
[Item::SLAB, Slab::STONE_BRICK, Item::STONE_BRICK, StoneBricks::NORMAL,"slab", 6],
[Item::SLAB, Slab::NETHER_BRICK, Item::NETHER_BRICK_BLOCK, 0, "slab", 6],
[Item::SLAB, Slab::QUARTZ, Item::QUARTZ_BLOCK, 0, "slab", 6],
[Item::COBBLESTONE_STAIRS, 0, Item::COBBLESTONE, 0, "stairs", 4],
[Item::SANDSTONE_STAIRS, 0, Item::SANDSTONE, 0, "stairs", 4],
[Item::STONE_BRICK_STAIRS, 0, Item::STONE_BRICK, StoneBricks::NORMAL,"stairs", 4],
[Item::BRICK_STAIRS, 0, Item::BRICKS_BLOCK, 0, "stairs", 4],
[Item::NETHER_BRICKS_STAIRS,0, Item::NETHER_BRICK_BLOCK, 0, "stairs", 4],
[Item::COBBLESTONE_WALL, StoneWall::NONE_MOSSY_WALL, Item::COBBLESTONE, 0, "wall/fence", 6],
[Item::COBBLESTONE_WALL, StoneWall::MOSSY_WALL, Item::MOSSY_STONE, 0, "wall/fence", 6],
[Item::NETHER_BRICK_FENCE, 0, Item::NETHER_BRICK_BLOCK, 0, "wall/fence", 6],
[Item::NETHER_BRICKS, 0, Item::NETHER_BRICK, 0, "blockrecipe1", 1],
[Item::SANDSTONE, SandStone::NORMAL, Item::SAND, 0, "blockrecipe1", 1],
[Item::SANDSTONE, Sandstone::CHISELED, Item::SANDSTONE, SandStone::NORMAL, "blockrecipe1", 4],
[Item::STONE_BRICK, StoneBricks::NORMAL, Item::STONE, Stone::NORMAL, "blockrecipe1", 4],
[Item::STONE_BRICK, StoneBricks::NORMAL, Item::STONE, Stone::POLISHED_GRANITE,"blockrecipe1", 4],
[Item::STONE_BRICK, StoneBricks::NORMAL, Item::STONE, Stone::POLISHED_DIORITE,"blockrecipe1", 4],
[Item::STONE_BRICK, StoneBricks::NORMAL, Item::STONE, Stone::POLISHED_ANDESITE,"blockrecipe1",4],
[Item::STONE, Stone::POLISHED_GRANITE, Item::STONE, Stone::GRANITE, "blockrecipe1", 4],
[Item::STONE, Stone::POLISHED_DIORITE, Item::STONE, Stone::DIORITE, "blockrecipe1", 4],
[Item::STONE, Stone::POLISHED_ANDESITE, Item::STONE, Stone::ANDESITE, "blockrecipe1", 4],
[Item::QUARTZ_BLOCK, Quartz::QUARTZ_NORMAL, Item::QUARTZ, Stone::ANDESITE, "blockrecipe1", 4],
[Item::QUARTZ_BLOCK, Quartz::QUARTZ_CHISELED, Item::SLAB, Slab::QUARTZ, "blockrecipe2X1", 1],
[Item::SANDSTONE, SandStone::CHISELED, Item::SLAB, Slab::SANDSTONE, "blockrecipe2X1", 1],
[Item::STONE_BRICK, StoneBricks::CHISELED, Item::SLAB, Slab::STONE_BRICK, "blockrecipe2X1", 1],
];
foreach ($recipes as $recipe){
$buildRecipes[] = $this->createOneIngedientRecipe($shapes[$recipe[$RECIPE_SHAPE]], $recipe[$RESULT_ITEMID], $recipe[$RESULT_META], $recipe[$RESULT_AMOUNT], $recipe[$INGREDIENT_ITEMID], $recipe[$INGREDIENT_META], "X", "Stonecutter");
}
// Multi-ingredient stone recipes:
$buildRecipes[] = ((new StonecutterShapedRecipe(Item::get(Item::STONE, Stone::GRANITE, 1),
...$shapes["blockrecipe1X2"]
))->setIngredient("A", Item::get(Item::STONE, Stone::DIORITE, 1))->setIngredient("B", Item::get(Item::QUARTZ, Quartz::QUARTZ_NORMAL, 1)));
$buildRecipes[] = ((new StonecutterShapedRecipe(Item::get(Item::STONE, Stone::DIORITE, 2),
...$shapes["blockrecipe2X2"]
))->setIngredient("A", Item::get(Item::COBBLESTONE, 0, 2))->setIngredient("B", Item::get(Item::QUARTZ, 0, 2)));
$buildRecipes[] = ((new StonecutterShapedRecipe(Item::get(Item::STONE, Stone::ANDESITE, 2),
...$shapes["blockrecipe1X2"]
))->setIngredient("A", Item::get(Item::COBBLESTONE, 0, 1))->setIngredient("B", Item::get(Item::STONE, Stone::DIORITE, 1)));
$buildRecipes[] = ((new StonecutterShapedRecipe(Item::get(Item::STONE_BRICK, StoneBricks::MOSSY, 1),
...$shapes["blockrecipe1X2"]
))->setIngredient("A", Item::get(Item::STONE_BRICK, StoneBricks::NORMAL, 1))->setIngredient("B", Item::get(Item::VINES, 0, 1)));
$this->sortAndAddRecipesArray($buildRecipes);
}
private function sortAndAddRecipesArray(&$recipes){
// Sort the recipes based on the result item name with the bubblesort algoritm.
for ($i = 0; $i < count($recipes); ++$i){
$current = $recipes[$i];
$result = $current->getResult();
for ($j = count($recipes)-1; $j > $i; --$j)
{
if ($this->sort($result, $recipes[$j]->getResult())>0){
$swap = $current;
$current = $recipes[$j];
$recipes[$j] = $swap;
$result = $current->getResult();
}
}
$this->registerRecipe($current);
}
}
private function createOneIngedientRecipe($recipeshape, $resultitem, $resultitemmeta, $resultitemamound, $ingedienttype, $ingredientmeta, $ingredientname, $inventoryType = ""){
$ingredientamount = 0;
$height = 0;
// count how many of the ingredient are in the recipe and check height for big or small recipe.
foreach ($recipeshape as $line){
$height += 1;
$width = strlen($line);
$ingredientamount += substr_count($line, $ingredientname);
}
$recipe = null;
if ($height < 3){
// Process small recipe
$fullClassName = "pocketmine\\inventory\\".$inventoryType."ShapedRecipe";// $ShapeClass."ShapedRecipe";
$recipe = ((new $fullClassName(Item::get($resultitem, $resultitemmeta, $resultitemamound),
...$recipeshape
))->setIngredient($ingredientname, Item::get($ingedienttype, $ingredientmeta, $ingredientamount)));
}
else{
// Process big recipe
$fullClassName = "pocketmine\\inventory\\".$inventoryType."BigShapedRecipe";
$recipe = ((new $fullClassName(Item::get($resultitem, $resultitemmeta, $resultitemamound),
...$recipeshape
))->setIngredient($ingredientname, Item::get($ingedienttype, $ingredientmeta, $ingredientamount)));
}
return $recipe;
} }
protected function registerFood(){ protected function registerFood(){

View File

@ -24,7 +24,7 @@ namespace pocketmine\inventory;
use pocketmine\item\Item; use pocketmine\item\Item;
use pocketmine\level\Level; use pocketmine\level\Level;
use pocketmine\network\Network; use pocketmine\network\Network;
use pocketmine\network\protocol\TileEventPacket; use pocketmine\network\protocol\BlockEventPacket;
use pocketmine\Player; use pocketmine\Player;
use pocketmine\tile\Chest; use pocketmine\tile\Chest;
@ -99,7 +99,7 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
parent::onOpen($who); parent::onOpen($who);
if(count($this->getViewers()) === 1){ if(count($this->getViewers()) === 1){
$pk = new TileEventPacket(); $pk = new BlockEventPacket();
$pk->x = $this->right->getHolder()->getX(); $pk->x = $this->right->getHolder()->getX();
$pk->y = $this->right->getHolder()->getY(); $pk->y = $this->right->getHolder()->getY();
$pk->z = $this->right->getHolder()->getZ(); $pk->z = $this->right->getHolder()->getZ();
@ -113,7 +113,7 @@ class DoubleChestInventory extends ChestInventory implements InventoryHolder{
public function onClose(Player $who){ public function onClose(Player $who){
if(count($this->getViewers()) === 1){ if(count($this->getViewers()) === 1){
$pk = new TileEventPacket(); $pk = new BlockEventPacket();
$pk->x = $this->right->getHolder()->getX(); $pk->x = $this->right->getHolder()->getX();
$pk->y = $this->right->getHolder()->getY(); $pk->y = $this->right->getHolder()->getY();
$pk->z = $this->right->getHolder()->getZ(); $pk->z = $this->right->getHolder()->getZ();

View File

@ -21,6 +21,6 @@
namespace pocketmine\inventory; namespace pocketmine\inventory;
class StonecutterShapelessRecipe extends ShapelessRecipe{ class StonecutterBigShapedRecipe extends ShapedRecipe{
} }

View File

@ -0,0 +1,26 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\inventory;
class StonecutterShapedRecipe extends ShapedRecipe{
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Arrow extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::ARROW, $meta, $count, "Arrow");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class BakedPotato extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::BAKED_POTATO, $meta, $count, "Baked Potato");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Beetroot extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::BEETROOT, $meta, $count, "Beetroot");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Bone extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::BONE, $meta, $count, "Bone");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Book extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::BOOK, $meta, $count, "Book");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Bread extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::BREAD, $meta, $count, "Bread");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Camera extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::CAMERA, $meta, $count, "Camera");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Clay extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::CLAY, $meta, $count, "Clay");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Clock extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::CLOCK, $meta, $count, "Clock");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Compass extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::COMPASS, $meta, $count, "Compass");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class CookedChicken extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::COOKED_CHICKEN, $meta, $count, "Cooked Chicken");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class CookedPorkchop extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::COOKED_PORKCHOP, $meta, $count, "Cooked Porkchop");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Cookie extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::COOKIE, $meta, $count, "Cookie");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Dye extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::DYE, $meta, $count, "Dye");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Egg extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::EGG, $meta, $count, "Egg");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Emerald extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::EMERALD, $meta, $count, "Emerald");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
use pocketmine\block\Block;
class FishingRod extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::FISHING_ROD, 0, $count, "Fishing Rod");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Flint extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::FLINT, $meta, $count, "Flint");
}
}

View File

@ -0,0 +1,31 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
use pocketmine\block\Block;
class FlowerPot extends Item{
public function __construct($meta = 0, $count = 1){
$this->block = Block::get(Item::FLOWER_POT_BLOCK);
parent::__construct(self::FLOWER_POT, 0, $count, "Flower Pot");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class GlowstoneDust extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::GLOWSTONE_DUST, $meta, $count, "Glowstone Dust");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class GoldNugget extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::GOLD_NUGGET, $meta, $count, "Gold Nugget");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class GoldenApple extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::GOLDEN_APPLE, $meta, $count, "Golden Apple");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Gunpowder extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::GUNPOWDER, $meta, $count, "Gunpowder");
}
}

View File

@ -25,6 +25,7 @@
namespace pocketmine\item; namespace pocketmine\item;
use pocketmine\block\Block; use pocketmine\block\Block;
use pocketmine\block\Fence;
use pocketmine\block\Flower; use pocketmine\block\Flower;
use pocketmine\entity\Entity; use pocketmine\entity\Entity;
use pocketmine\entity\Squid; use pocketmine\entity\Squid;
@ -202,13 +203,13 @@ class Item{
const LILY_PAD = 111; const LILY_PAD = 111;
const NETHER_BRICKS = 112; const NETHER_BRICKS = 112;
const NETHER_BRICK_BLOCK = 112; const NETHER_BRICK_BLOCK = 112;
const NETHER_BRICK_FENCE = 113;
const NETHER_BRICKS_STAIRS = 114; const NETHER_BRICKS_STAIRS = 114;
const ENCHANTING_TABLE = 116; const ENCHANTING_TABLE = 116;
const ENCHANT_TABLE = 116; const ENCHANT_TABLE = 116;
const ENCHANTMENT_TABLE = 116; const ENCHANTMENT_TABLE = 116;
const BREWING_STAND = 117;
const END_PORTAL = 120; const END_PORTAL = 120;
const END_STONE = 121; const END_STONE = 121;
@ -226,11 +227,12 @@ class Item{
const COBBLE_WALL = 139; const COBBLE_WALL = 139;
const STONE_WALL = 139; const STONE_WALL = 139;
const COBBLESTONE_WALL = 139; const COBBLESTONE_WALL = 139;
const FLOWER_POT_BLOCK = 140;
const CARROT_BLOCK = 141; const CARROT_BLOCK = 141;
const POTATO_BLOCK = 142; const POTATO_BLOCK = 142;
const ANVIL = 145; const ANVIL = 145;
const TRAPPED_CHEST = 146;
const REDSTONE_BLOCK = 152; const REDSTONE_BLOCK = 152;
@ -257,11 +259,12 @@ class Item{
const DARK_OAK_WOOD_STAIRS = 164; const DARK_OAK_WOOD_STAIRS = 164;
const DARK_OAK_WOODEN_STAIRS = 164; const DARK_OAK_WOODEN_STAIRS = 164;
const IRON_TRAPDOOR = 167;
const HAY_BALE = 170; const HAY_BALE = 170;
const CARPET = 171; const CARPET = 171;
const HARDENED_CLAY = 172; const HARDENED_CLAY = 172;
const COAL_BLOCK = 173; const COAL_BLOCK = 173;
const PACKED_ICE = 174;
const DOUBLE_PLANT = 175; const DOUBLE_PLANT = 175;
const FENCE_GATE_SPRUCE = 183; const FENCE_GATE_SPRUCE = 183;
@ -276,7 +279,6 @@ class Item{
const BEETROOT_BLOCK = 244; const BEETROOT_BLOCK = 244;
const STONECUTTER = 245; const STONECUTTER = 245;
const GLOWING_OBSIDIAN = 246; const GLOWING_OBSIDIAN = 246;
const NETHER_REACTOR = 247;
//Normal Item IDs //Normal Item IDs
@ -380,7 +382,7 @@ class Item{
const EGG = 344; const EGG = 344;
const COMPASS = 345; const COMPASS = 345;
const FISHING_ROD = 346;
const CLOCK = 347; const CLOCK = 347;
const GLOWSTONE_DUST = 348; const GLOWSTONE_DUST = 348;
const RAW_FISH = 349; const RAW_FISH = 349;
@ -414,6 +416,7 @@ class Item{
const EMERALD = 388; const EMERALD = 388;
const FLOWER_POT = 390;
const CARROT = 391; const CARROT = 391;
const CARROTS = 391; const CARROTS = 391;
const POTATO = 392; const POTATO = 392;
@ -452,31 +455,48 @@ class Item{
public static function init(){ public static function init(){
if(self::$list === null){ if(self::$list === null){
self::$list = new \SplFixedArray(65536); self::$list = new \SplFixedArray(65536);
self::$list[self::SUGARCANE] = Sugarcane::class; self::$list[self::IRON_SHOVEL] = IronShovel::class;
self::$list[self::WHEAT_SEEDS] = WheatSeeds::class; self::$list[self::IRON_PICKAXE] = IronPickaxe::class;
self::$list[self::PUMPKIN_SEEDS] = PumpkinSeeds::class; self::$list[self::IRON_AXE] = IronAxe::class;
self::$list[self::MELON_SEEDS] = MelonSeeds::class; self::$list[self::FLINT_STEEL] = FlintSteel::class;
self::$list[self::MUSHROOM_STEW] = MushroomStew::class;
self::$list[self::BEETROOT_SOUP] = BeetrootSoup::class;
self::$list[self::CARROT] = Carrot::class;
self::$list[self::POTATO] = Potato::class;
self::$list[self::BEETROOT_SEEDS] = BeetrootSeeds::class;
self::$list[self::SIGN] = Sign::class;
self::$list[self::WOODEN_DOOR] = WoodenDoor::class;
self::$list[self::BUCKET] = Bucket::class;
self::$list[self::IRON_DOOR] = IronDoor::class;
self::$list[self::CAKE] = Cake::class;
self::$list[self::BED] = Bed::class;
self::$list[self::PAINTING] = Painting::class;
self::$list[self::COAL] = Coal::class;
self::$list[self::APPLE] = Apple::class; self::$list[self::APPLE] = Apple::class;
self::$list[self::SPAWN_EGG] = SpawnEgg::class; self::$list[self::BOW] = Bow::class;
self::$list[self::ARROW] = Arrow::class;
self::$list[self::COAL] = Coal::class;
self::$list[self::DIAMOND] = Diamond::class; self::$list[self::DIAMOND] = Diamond::class;
self::$list[self::IRON_INGOT] = IronIngot::class;
self::$list[self::GOLD_INGOT] = GoldIngot::class;
self::$list[self::IRON_SWORD] = IronSword::class;
self::$list[self::WOODEN_SWORD] = WoodenSword::class;
self::$list[self::WOODEN_SHOVEL] = WoodenShovel::class;
self::$list[self::WOODEN_PICKAXE] = WoodenPickaxe::class;
self::$list[self::WOODEN_AXE] = WoodenAxe::class;
self::$list[self::STONE_SWORD] = StoneSword::class;
self::$list[self::STONE_SHOVEL] = StoneShovel::class;
self::$list[self::STONE_PICKAXE] = StonePickaxe::class;
self::$list[self::STONE_AXE] = StoneAxe::class;
self::$list[self::DIAMOND_SWORD] = DiamondSword::class;
self::$list[self::DIAMOND_SHOVEL] = DiamondShovel::class;
self::$list[self::DIAMOND_PICKAXE] = DiamondPickaxe::class;
self::$list[self::DIAMOND_AXE] = DiamondAxe::class;
self::$list[self::STICK] = Stick::class; self::$list[self::STICK] = Stick::class;
self::$list[self::SNOWBALL] = Snowball::class;
self::$list[self::BOWL] = Bowl::class; self::$list[self::BOWL] = Bowl::class;
self::$list[self::MUSHROOM_STEW] = MushroomStew::class;
self::$list[self::GOLD_SWORD] = GoldSword::class;
self::$list[self::GOLD_SHOVEL] = GoldShovel::class;
self::$list[self::GOLD_PICKAXE] = GoldPickaxe::class;
self::$list[self::GOLD_AXE] = GoldAxe::class;
self::$list[self::STRING] = StringItem::class;
self::$list[self::FEATHER] = Feather::class; self::$list[self::FEATHER] = Feather::class;
self::$list[self::BRICK] = Brick::class; self::$list[self::GUNPOWDER] = Gunpowder::class;
self::$list[self::WOODEN_HOE] = WoodenHoe::class;
self::$list[self::STONE_HOE] = StoneHoe::class;
self::$list[self::IRON_HOE] = IronHoe::class;
self::$list[self::DIAMOND_HOE] = DiamondHoe::class;
self::$list[self::GOLD_HOE] = GoldHoe::class;
self::$list[self::WHEAT_SEEDS] = WheatSeeds::class;
self::$list[self::WHEAT] = Wheat::class;
self::$list[self::BREAD] = Bread::class;
self::$list[self::LEATHER_CAP] = LeatherCap::class; self::$list[self::LEATHER_CAP] = LeatherCap::class;
self::$list[self::LEATHER_TUNIC] = LeatherTunic::class; self::$list[self::LEATHER_TUNIC] = LeatherTunic::class;
self::$list[self::LEATHER_PANTS] = LeatherPants::class; self::$list[self::LEATHER_PANTS] = LeatherPants::class;
@ -489,47 +509,68 @@ class Item{
self::$list[self::IRON_CHESTPLATE] = IronChestplate::class; self::$list[self::IRON_CHESTPLATE] = IronChestplate::class;
self::$list[self::IRON_LEGGINGS] = IronLeggings::class; self::$list[self::IRON_LEGGINGS] = IronLeggings::class;
self::$list[self::IRON_BOOTS] = IronBoots::class; self::$list[self::IRON_BOOTS] = IronBoots::class;
self::$list[self::GOLD_HELMET] = GoldHelmet::class;
self::$list[self::GOLD_CHESTPLATE] = GoldChestplate::class;
self::$list[self::GOLD_LEGGINGS] = GoldLeggings::class;
self::$list[self::GOLD_BOOTS] = GoldBoots::class;
self::$list[self::DIAMOND_HELMET] = DiamondHelmet::class; self::$list[self::DIAMOND_HELMET] = DiamondHelmet::class;
self::$list[self::DIAMOND_CHESTPLATE] = DiamondChestplate::class; self::$list[self::DIAMOND_CHESTPLATE] = DiamondChestplate::class;
self::$list[self::DIAMOND_LEGGINGS] = DiamondLeggings::class; self::$list[self::DIAMOND_LEGGINGS] = DiamondLeggings::class;
self::$list[self::DIAMOND_BOOTS] = DiamondBoots::class; self::$list[self::DIAMOND_BOOTS] = DiamondBoots::class;
self::$list[self::IRON_SWORD] = IronSword::class; self::$list[self::GOLD_HELMET] = GoldHelmet::class;
self::$list[self::IRON_INGOT] = IronIngot::class; self::$list[self::GOLD_CHESTPLATE] = GoldChestplate::class;
self::$list[self::GOLD_INGOT] = GoldIngot::class; self::$list[self::GOLD_LEGGINGS] = GoldLeggings::class;
self::$list[self::IRON_SHOVEL] = IronShovel::class; self::$list[self::GOLD_BOOTS] = GoldBoots::class;
self::$list[self::IRON_PICKAXE] = IronPickaxe::class; self::$list[self::FLINT] = Flint::class;
self::$list[self::IRON_AXE] = IronAxe::class; self::$list[self::RAW_PORKCHOP] = RawPorkchop::class;
self::$list[self::IRON_HOE] = IronHoe::class; self::$list[self::COOKED_PORKCHOP] = CookedPorkchop::class;
self::$list[self::DIAMOND_SWORD] = DiamondSword::class; self::$list[self::PAINTING] = Painting::class;
self::$list[self::DIAMOND_SHOVEL] = DiamondShovel::class; self::$list[self::GOLDEN_APPLE] = GoldenApple::class;
self::$list[self::DIAMOND_PICKAXE] = DiamondPickaxe::class; self::$list[self::SIGN] = Sign::class;
self::$list[self::DIAMOND_AXE] = DiamondAxe::class; self::$list[self::WOODEN_DOOR] = WoodenDoor::class;
self::$list[self::DIAMOND_HOE] = DiamondHoe::class; self::$list[self::BUCKET] = Bucket::class;
self::$list[self::GOLD_SWORD] = GoldSword::class; self::$list[self::MINECART] = Minecart::class;
self::$list[self::GOLD_SHOVEL] = GoldShovel::class; self::$list[self::IRON_DOOR] = IronDoor::class;
self::$list[self::GOLD_PICKAXE] = GoldPickaxe::class; self::$list[self::REDSTONE] = Redstone::class;
self::$list[self::GOLD_AXE] = GoldAxe::class; self::$list[self::SNOWBALL] = Snowball::class;
self::$list[self::GOLD_HOE] = GoldHoe::class; self::$list[self::LEATHER] = Leather::class;
self::$list[self::STONE_SWORD] = StoneSword::class; self::$list[self::BRICK] = Brick::class;
self::$list[self::STONE_SHOVEL] = StoneShovel::class; self::$list[self::CLAY] = Clay::class;
self::$list[self::STONE_PICKAXE] = StonePickaxe::class; self::$list[self::SUGARCANE] = Sugarcane::class;
self::$list[self::STONE_AXE] = StoneAxe::class; self::$list[self::PAPER] = Paper::class;
self::$list[self::STONE_HOE] = StoneHoe::class; self::$list[self::BOOK] = Book::class;
self::$list[self::WOODEN_SWORD] = WoodenSword::class; self::$list[self::SLIMEBALL] = Slimeball::class;
self::$list[self::WOODEN_SHOVEL] = WoodenShovel::class; self::$list[self::EGG] = Egg::class;
self::$list[self::WOODEN_PICKAXE] = WoodenPickaxe::class; self::$list[self::COMPASS] = Compass::class;
self::$list[self::WOODEN_AXE] = WoodenAxe::class; self::$list[self::CLOCK] = Clock::class;
self::$list[self::WOODEN_HOE] = WoodenHoe::class; self::$list[self::GLOWSTONE_DUST] = GlowstoneDust::class;
self::$list[self::FLINT_STEEL] = FlintSteel::class;
self::$list[self::SHEARS] = Shears::class;
self::$list[self::BOW] = Bow::class;
self::$list[self::RAW_FISH] = Fish::class; self::$list[self::RAW_FISH] = Fish::class;
self::$list[self::COOKED_FISH] = CookedFish::class; self::$list[self::COOKED_FISH] = CookedFish::class;
self::$list[self::DYE] = Dye::class;
self::$list[self::BONE] = Bone::class;
self::$list[self::SUGAR] = Sugar::class;
self::$list[self::CAKE] = Cake::class;
self::$list[self::BED] = Bed::class;
self::$list[self::COOKIE] = Cookie::class;
self::$list[self::SHEARS] = Shears::class;
self::$list[self::MELON] = Melon::class;
self::$list[self::PUMPKIN_SEEDS] = PumpkinSeeds::class;
self::$list[self::MELON_SEEDS] = MelonSeeds::class;
self::$list[self::RAW_BEEF] = RawBeef::class;
self::$list[self::STEAK] = Steak::class;
self::$list[self::RAW_CHICKEN] = RawChicken::class;
self::$list[self::COOKED_CHICKEN] = CookedChicken::class;
self::$list[self::GOLD_NUGGET] = GoldNugget::class;
self::$list[self::SPAWN_EGG] = SpawnEgg::class;
self::$list[self::EMERALD] = Emerald::class;
self::$list[self::FLOWER_POT] = FlowerPot::class;
self::$list[self::CARROT] = Carrot::class;
self::$list[self::POTATO] = Potato::class;
self::$list[self::BAKED_POTATO] = BakedPotato::class;
self::$list[self::PUMPKIN_PIE] = PumpkinPie::class;
self::$list[self::NETHER_BRICK] = NetherBrick::class;
self::$list[self::QUARTZ] = Quartz::class;
self::$list[self::QUARTZ] = NetherQuartz::class;
// self::$list[self::CAMERA] = Camera::class;
self::$list[self::BEETROOT] = Beetroot::class;
self::$list[self::BEETROOT_SEEDS] = BeetrootSeeds::class;
self::$list[self::BEETROOT_SOUP] = BeetrootSoup::class;
for($i = 0; $i < 256; ++$i){ for($i = 0; $i < 256; ++$i){
if(Block::$list[$i] !== null){ if(Block::$list[$i] !== null){
@ -545,6 +586,7 @@ class Item{
private static function initCreativeItems(){ private static function initCreativeItems(){
self::clearCreativeItems(); self::clearCreativeItems();
//Building //Building
self::addCreativeItem(Item::get(Item::COBBLESTONE, 0)); self::addCreativeItem(Item::get(Item::COBBLESTONE, 0));
self::addCreativeItem(Item::get(Item::STONE_BRICKS, 0)); self::addCreativeItem(Item::get(Item::STONE_BRICKS, 0));
@ -559,7 +601,6 @@ class Item{
self::addCreativeItem(Item::get(Item::WOODEN_PLANKS, 4)); self::addCreativeItem(Item::get(Item::WOODEN_PLANKS, 4));
self::addCreativeItem(Item::get(Item::WOODEN_PLANKS, 5)); self::addCreativeItem(Item::get(Item::WOODEN_PLANKS, 5));
self::addCreativeItem(Item::get(Item::BRICKS, 0)); self::addCreativeItem(Item::get(Item::BRICKS, 0));
self::addCreativeItem(Item::get(Item::STONE, 0)); self::addCreativeItem(Item::get(Item::STONE, 0));
self::addCreativeItem(Item::get(Item::STONE, 1)); self::addCreativeItem(Item::get(Item::STONE, 1));
self::addCreativeItem(Item::get(Item::STONE, 2)); self::addCreativeItem(Item::get(Item::STONE, 2));
@ -603,6 +644,7 @@ class Item{
self::addCreativeItem(Item::get(Item::TRUNK2, 1)); self::addCreativeItem(Item::get(Item::TRUNK2, 1));
self::addCreativeItem(Item::get(Item::NETHER_BRICKS, 0)); self::addCreativeItem(Item::get(Item::NETHER_BRICKS, 0));
self::addCreativeItem(Item::get(Item::NETHERRACK, 0)); self::addCreativeItem(Item::get(Item::NETHERRACK, 0));
self::addCreativeItem(Item::get(Item::SOUL_SAND, 0));
self::addCreativeItem(Item::get(Item::BEDROCK, 0)); self::addCreativeItem(Item::get(Item::BEDROCK, 0));
self::addCreativeItem(Item::get(Item::COBBLESTONE_STAIRS, 0)); self::addCreativeItem(Item::get(Item::COBBLESTONE_STAIRS, 0));
self::addCreativeItem(Item::get(Item::OAK_WOODEN_STAIRS, 0)); self::addCreativeItem(Item::get(Item::OAK_WOODEN_STAIRS, 0));
@ -628,6 +670,7 @@ class Item{
self::addCreativeItem(Item::get(Item::SLAB, 4)); self::addCreativeItem(Item::get(Item::SLAB, 4));
self::addCreativeItem(Item::get(Item::SLAB, 5)); self::addCreativeItem(Item::get(Item::SLAB, 5));
self::addCreativeItem(Item::get(Item::SLAB, 6)); self::addCreativeItem(Item::get(Item::SLAB, 6));
self::addCreativeItem(Item::get(Item::SLAB, 7));
self::addCreativeItem(Item::get(Item::QUARTZ_BLOCK, 0)); self::addCreativeItem(Item::get(Item::QUARTZ_BLOCK, 0));
self::addCreativeItem(Item::get(Item::QUARTZ_BLOCK, 1)); self::addCreativeItem(Item::get(Item::QUARTZ_BLOCK, 1));
self::addCreativeItem(Item::get(Item::QUARTZ_BLOCK, 2)); self::addCreativeItem(Item::get(Item::QUARTZ_BLOCK, 2));
@ -640,6 +683,7 @@ class Item{
self::addCreativeItem(Item::get(Item::EMERALD_ORE, 0)); self::addCreativeItem(Item::get(Item::EMERALD_ORE, 0));
self::addCreativeItem(Item::get(Item::OBSIDIAN, 0)); self::addCreativeItem(Item::get(Item::OBSIDIAN, 0));
self::addCreativeItem(Item::get(Item::ICE, 0)); self::addCreativeItem(Item::get(Item::ICE, 0));
self::addCreativeItem(Item::get(Item::PACKED_ICE, 0));
self::addCreativeItem(Item::get(Item::SNOW_BLOCK, 0)); self::addCreativeItem(Item::get(Item::SNOW_BLOCK, 0));
self::addCreativeItem(Item::get(Item::END_STONE, 0)); self::addCreativeItem(Item::get(Item::END_STONE, 0));
@ -658,24 +702,31 @@ class Item{
self::addCreativeItem(Item::get(Item::GLASS, 0)); self::addCreativeItem(Item::get(Item::GLASS, 0));
self::addCreativeItem(Item::get(Item::GLOWSTONE_BLOCK, 0)); self::addCreativeItem(Item::get(Item::GLOWSTONE_BLOCK, 0));
self::addCreativeItem(Item::get(Item::VINES, 0)); self::addCreativeItem(Item::get(Item::VINES, 0));
self::addCreativeItem(Item::get(Item::NETHER_REACTOR, 0));
self::addCreativeItem(Item::get(Item::LADDER, 0)); self::addCreativeItem(Item::get(Item::LADDER, 0));
self::addCreativeItem(Item::get(Item::SPONGE, 0)); self::addCreativeItem(Item::get(Item::SPONGE, 0));
self::addCreativeItem(Item::get(Item::GLASS_PANE, 0)); self::addCreativeItem(Item::get(Item::GLASS_PANE, 0));
self::addCreativeItem(Item::get(Item::WOODEN_DOOR, 0)); self::addCreativeItem(Item::get(Item::WOODEN_DOOR, 0)); // Oak
self::addCreativeItem(Item::get(Item::WOODEN_DOOR, 1)); // Spruce
self::addCreativeItem(Item::get(Item::WOODEN_DOOR, 2)); // Birch
self::addCreativeItem(Item::get(Item::WOODEN_DOOR, 3)); // Jungle
self::addCreativeItem(Item::get(Item::WOODEN_DOOR, 4)); // Acacia
self::addCreativeItem(Item::get(Item::WOODEN_DOOR, 5)); // Dark oak
self::addCreativeItem(Item::get(Item::IRON_DOOR, 0));
self::addCreativeItem(Item::get(Item::TRAPDOOR, 0)); self::addCreativeItem(Item::get(Item::TRAPDOOR, 0));
self::addCreativeItem(Item::get(Item::FENCE, 0)); self::addCreativeItem(Item::get(Item::IRON_TRAPDOOR, 0));
self::addCreativeItem(Item::get(Item::FENCE, 1)); self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_OAK));
self::addCreativeItem(Item::get(Item::FENCE, 2)); self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_SPRUCE));
self::addCreativeItem(Item::get(Item::FENCE, 3)); self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_BIRCH));
self::addCreativeItem(Item::get(Item::FENCE, 4)); self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_JUNGLE));
self::addCreativeItem(Item::get(Item::FENCE, 5)); self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_ACACIA));
self::addCreativeItem(Item::get(Item::FENCE, Fence::FENCE_DARKOAK));
self::addCreativeItem(Item::get(Item::NETHER_BRICK_FENCE, 0));
self::addCreativeItem(Item::get(Item::FENCE_GATE, 0)); self::addCreativeItem(Item::get(Item::FENCE_GATE, 0));
self::addCreativeItem(Item::get(Item::FENCE_GATE_BIRCH, 0));
self::addCreativeItem(Item::get(Item::FENCE_GATE_SPRUCE, 0)); self::addCreativeItem(Item::get(Item::FENCE_GATE_SPRUCE, 0));
self::addCreativeItem(Item::get(Item::FENCE_GATE_DARK_OAK, 0)); self::addCreativeItem(Item::get(Item::FENCE_GATE_BIRCH, 0));
self::addCreativeItem(Item::get(Item::FENCE_GATE_JUNGLE, 0)); self::addCreativeItem(Item::get(Item::FENCE_GATE_JUNGLE, 0));
self::addCreativeItem(Item::get(Item::FENCE_GATE_ACACIA, 0)); self::addCreativeItem(Item::get(Item::FENCE_GATE_ACACIA, 0));
self::addCreativeItem(Item::get(Item::FENCE_GATE_DARK_OAK, 0));
self::addCreativeItem(Item::get(Item::IRON_BARS, 0)); self::addCreativeItem(Item::get(Item::IRON_BARS, 0));
self::addCreativeItem(Item::get(Item::BED, 0)); self::addCreativeItem(Item::get(Item::BED, 0));
self::addCreativeItem(Item::get(Item::BOOKSHELF, 0)); self::addCreativeItem(Item::get(Item::BOOKSHELF, 0));
@ -683,8 +734,14 @@ class Item{
self::addCreativeItem(Item::get(Item::WORKBENCH, 0)); self::addCreativeItem(Item::get(Item::WORKBENCH, 0));
self::addCreativeItem(Item::get(Item::STONECUTTER, 0)); self::addCreativeItem(Item::get(Item::STONECUTTER, 0));
self::addCreativeItem(Item::get(Item::CHEST, 0)); self::addCreativeItem(Item::get(Item::CHEST, 0));
self::addCreativeItem(Item::get(Item::TRAPPED_CHEST, 0));
self::addCreativeItem(Item::get(Item::FURNACE, 0)); self::addCreativeItem(Item::get(Item::FURNACE, 0));
self::addCreativeItem(Item::get(Item::BREWING_STAND, 0));
// TODO: Note Block
self::addCreativeItem(Item::get(Item::END_PORTAL, 0)); self::addCreativeItem(Item::get(Item::END_PORTAL, 0));
self::addCreativeItem(Item::get(Item::ANVIL, 0));
self::addCreativeItem(Item::get(Item::ANVIL, 4));
self::addCreativeItem(Item::get(Item::ANVIL, 8));
self::addCreativeItem(Item::get(Item::DANDELION, 0)); self::addCreativeItem(Item::get(Item::DANDELION, 0));
self::addCreativeItem(Item::get(Item::RED_FLOWER, Flower::TYPE_POPPY)); self::addCreativeItem(Item::get(Item::RED_FLOWER, Flower::TYPE_POPPY));
self::addCreativeItem(Item::get(Item::RED_FLOWER, Flower::TYPE_BLUE_ORCHID)); self::addCreativeItem(Item::get(Item::RED_FLOWER, Flower::TYPE_BLUE_ORCHID));
@ -695,8 +752,9 @@ class Item{
self::addCreativeItem(Item::get(Item::RED_FLOWER, Flower::TYPE_WHITE_TULIP)); self::addCreativeItem(Item::get(Item::RED_FLOWER, Flower::TYPE_WHITE_TULIP));
self::addCreativeItem(Item::get(Item::RED_FLOWER, Flower::TYPE_PINK_TULIP)); self::addCreativeItem(Item::get(Item::RED_FLOWER, Flower::TYPE_PINK_TULIP));
self::addCreativeItem(Item::get(Item::RED_FLOWER, Flower::TYPE_OXEYE_DAISY)); self::addCreativeItem(Item::get(Item::RED_FLOWER, Flower::TYPE_OXEYE_DAISY));
// TODO: Sunflower
// TODO: Lilac // TODO: Lilac
//TODO: DoubleTag Tallgrass // TODO: Double Tallgrass
// TODO: Large Fern // TODO: Large Fern
// TODO: Rose Bush // TODO: Rose Bush
// TODO: Peony // TODO: Peony
@ -728,8 +786,15 @@ class Item{
self::addCreativeItem(Item::get(Item::LEAVES2, 0)); self::addCreativeItem(Item::get(Item::LEAVES2, 0));
self::addCreativeItem(Item::get(Item::LEAVES2, 1)); self::addCreativeItem(Item::get(Item::LEAVES2, 1));
self::addCreativeItem(Item::get(Item::CAKE, 0)); self::addCreativeItem(Item::get(Item::CAKE, 0));
// TODO: Skeleton skull
// TODO: Wither skeleton skull
// TODO: Zombie head
// TODO: Head
// TODO: Creeper head
self::addCreativeItem(Item::get(Item::SIGN, 0)); self::addCreativeItem(Item::get(Item::SIGN, 0));
self::addCreativeItem(Item::get(Item::FLOWER_POT, 0));
self::addCreativeItem(Item::get(Item::MONSTER_SPAWNER, 0)); self::addCreativeItem(Item::get(Item::MONSTER_SPAWNER, 0));
self::addCreativeItem(Item::get(Item::ENCHANTMENT_TABLE, 0));
self::addCreativeItem(Item::get(Item::WOOL, 0)); self::addCreativeItem(Item::get(Item::WOOL, 0));
self::addCreativeItem(Item::get(Item::WOOL, 7)); self::addCreativeItem(Item::get(Item::WOOL, 7));
self::addCreativeItem(Item::get(Item::WOOL, 6)); self::addCreativeItem(Item::get(Item::WOOL, 6));
@ -763,64 +828,184 @@ class Item{
self::addCreativeItem(Item::get(Item::CARPET, 9)); self::addCreativeItem(Item::get(Item::CARPET, 9));
self::addCreativeItem(Item::get(Item::CARPET, 8)); self::addCreativeItem(Item::get(Item::CARPET, 8));
self::addCreativeItem(Item::get(Item::ANVIL, 0));
self::addCreativeItem(Item::get(Item::ANVIL, 4));
self::addCreativeItem(Item::get(Item::ANVIL, 8));
//Tools //Tools
//TODO self::addCreativeItem(Item::get(Item::RAILS, 0)); // TODO: self::addCreativeItem(Item::get(Item::RAILS, 0));
//TODO self::addCreativeItem(Item::get(Item::POWERED_RAILS, 0)); // TODO: self::addCreativeItem(Item::get(Item::POWERED_RAILS, 0));
// TODO: Detector rail
// TODO: Activator rail
self::addCreativeItem(Item::get(Item::TORCH, 0)); self::addCreativeItem(Item::get(Item::TORCH, 0));
self::addCreativeItem(Item::get(Item::BUCKET, 0)); self::addCreativeItem(Item::get(Item::BUCKET, 0));
self::addCreativeItem(Item::get(Item::BUCKET, 1)); self::addCreativeItem(Item::get(Item::BUCKET, 1));
self::addCreativeItem(Item::get(Item::BUCKET, 8)); self::addCreativeItem(Item::get(Item::BUCKET, 8));
self::addCreativeItem(Item::get(Item::BUCKET, 10)); self::addCreativeItem(Item::get(Item::BUCKET, 10));
self::addCreativeItem(Item::get(Item::TNT, 0)); self::addCreativeItem(Item::get(Item::TNT, 0));
self::addCreativeItem(Item::get(Item::IRON_HOE, 0)); self::addCreativeItem(Item::get(Item::REDSTONE, 0));
self::addCreativeItem(Item::get(Item::IRON_SHOVEL, 0));
self::addCreativeItem(Item::get(Item::IRON_SWORD, 0));
self::addCreativeItem(Item::get(Item::BOW, 0)); self::addCreativeItem(Item::get(Item::BOW, 0));
self::addCreativeItem(Item::get(Item::SHEARS, 0)); self::addCreativeItem(Item::get(Item::FISHING_ROD, 0));
self::addCreativeItem(Item::get(Item::FLINT_AND_STEEL, 0)); self::addCreativeItem(Item::get(Item::FLINT_AND_STEEL, 0));
self::addCreativeItem(Item::get(Item::SHEARS, 0));
self::addCreativeItem(Item::get(Item::CLOCK, 0)); self::addCreativeItem(Item::get(Item::CLOCK, 0));
self::addCreativeItem(Item::get(Item::COMPASS, 0)); self::addCreativeItem(Item::get(Item::COMPASS, 0));
self::addCreativeItem(Item::get(Item::MINECART, 0)); self::addCreativeItem(Item::get(Item::MINECART, 0));
// TODO: Oak boat
// TODO: Spruce boat
// TODO: Birch boat
// TODO: Jungle boat
// TODO: Acacia boat
// TODO: Dark Oak boat
self::addCreativeItem(Item::get(Item::SPAWN_EGG, Villager::NETWORK_ID)); self::addCreativeItem(Item::get(Item::SPAWN_EGG, Villager::NETWORK_ID));
//self::addCreativeItem(Item::get(Item::SPAWN_EGG, 10)); //Chicken //self::addCreativeItem(Item::get(Item::SPAWN_EGG, 10)); //Chicken
//self::addCreativeItem(Item::get(Item::SPAWN_EGG, 11)); //Cow //self::addCreativeItem(Item::get(Item::SPAWN_EGG, 11)); //Cow
//self::addCreativeItem(Item::get(Item::SPAWN_EGG, 12)); //Pig //self::addCreativeItem(Item::get(Item::SPAWN_EGG, 12)); //Pig
//self::addCreativeItem(Item::get(Item::SPAWN_EGG, 13)); //Sheep //self::addCreativeItem(Item::get(Item::SPAWN_EGG, 13)); //Sheep
// TODO: Wolf // TODO: Wolf
// TODO: Ocelot
// TODO: Mooshroom // TODO: Mooshroom
// TODO: Bat
// TODO: Rabbit
// TODO: Creeper // TODO: Creeper
// TODO: Enderman // TODO: Enderman
// TODO: Silverfish // TODO: Silverfish
// TODO: Skeleton // TODO: Skeleton
// TODO: Slime // TODO: Slime
// TODO: Spider
self::addCreativeItem(Item::get(Item::SPAWN_EGG, Zombie::NETWORK_ID)); self::addCreativeItem(Item::get(Item::SPAWN_EGG, Zombie::NETWORK_ID));
//TODO: PigZombie //TODO: PigZombie
self::addCreativeItem(Item::get(Item::SPAWN_EGG, Squid::NETWORK_ID)); self::addCreativeItem(Item::get(Item::SPAWN_EGG, Squid::NETWORK_ID));
// TODO: Cave spider
// TODO: Magma cube
// TODO: Ghast
// TODO: Blaze
self::addCreativeItem(Item::get(Item::WOODEN_SWORD, 0));
self::addCreativeItem(Item::get(Item::WOODEN_HOE, 0));
self::addCreativeItem(Item::get(Item::WOODEN_SHOVEL, 0));
self::addCreativeItem(Item::get(Item::WOODEN_PICKAXE, 0));
self::addCreativeItem(Item::get(Item::WOODEN_AXE, 0));
self::addCreativeItem(Item::get(Item::STONE_SWORD, 0));
self::addCreativeItem(Item::get(Item::STONE_HOE, 0));
self::addCreativeItem(Item::get(Item::STONE_SHOVEL, 0));
self::addCreativeItem(Item::get(Item::STONE_PICKAXE, 0));
self::addCreativeItem(Item::get(Item::STONE_AXE, 0));
self::addCreativeItem(Item::get(Item::IRON_SWORD, 0));
self::addCreativeItem(Item::get(Item::IRON_HOE, 0));
self::addCreativeItem(Item::get(Item::IRON_SHOVEL, 0));
self::addCreativeItem(Item::get(Item::IRON_PICKAXE, 0));
self::addCreativeItem(Item::get(Item::IRON_AXE, 0));
self::addCreativeItem(Item::get(Item::DIAMOND_SWORD, 0));
self::addCreativeItem(Item::get(Item::DIAMOND_HOE, 0));
self::addCreativeItem(Item::get(Item::DIAMOND_SHOVEL, 0));
self::addCreativeItem(Item::get(Item::DIAMOND_PICKAXE, 0));
self::addCreativeItem(Item::get(Item::DIAMOND_AXE, 0));
self::addCreativeItem(Item::get(Item::GOLD_SWORD, 0));
self::addCreativeItem(Item::get(Item::GOLD_HOE, 0));
self::addCreativeItem(Item::get(Item::GOLD_SHOVEL, 0));
self::addCreativeItem(Item::get(Item::GOLD_PICKAXE, 0));
self::addCreativeItem(Item::get(Item::GOLD_AXE, 0));
self::addCreativeItem(Item::get(Item::LEATHER_CAP, 0));
self::addCreativeItem(Item::get(Item::LEATHER_TUNIC, 0));
self::addCreativeItem(Item::get(Item::LEATHER_PANTS, 0));
self::addCreativeItem(Item::get(Item::LEATHER_BOOTS, 0));
self::addCreativeItem(Item::get(Item::CHAIN_HELMET, 0));
self::addCreativeItem(Item::get(Item::CHAIN_CHESTPLATE, 0));
self::addCreativeItem(Item::get(Item::CHAIN_LEGGINGS, 0));
self::addCreativeItem(Item::get(Item::CHAIN_BOOTS, 0));
self::addCreativeItem(Item::get(Item::IRON_HELMET, 0));
self::addCreativeItem(Item::get(Item::IRON_CHESTPLATE, 0));
self::addCreativeItem(Item::get(Item::IRON_LEGGINGS, 0));
self::addCreativeItem(Item::get(Item::IRON_BOOTS, 0));
self::addCreativeItem(Item::get(Item::DIAMOND_HELMET, 0));
self::addCreativeItem(Item::get(Item::DIAMOND_CHESTPLATE, 0));
self::addCreativeItem(Item::get(Item::DIAMOND_LEGGINGS, 0));
self::addCreativeItem(Item::get(Item::DIAMOND_BOOTS, 0));
self::addCreativeItem(Item::get(Item::GOLD_HELMET, 0));
self::addCreativeItem(Item::get(Item::GOLD_CHESTPLATE, 0));
self::addCreativeItem(Item::get(Item::GOLD_LEGGINGS, 0));
self::addCreativeItem(Item::get(Item::GOLD_BOOTS, 0));
// TODO: Lever
// TODO: Redstone lamp
// TODO: Redstone torch
// TODO: Wood pressure plate
// TODO: Stone pressure plate
// TODO: Weighted pressure plate light
// TODO: Weighted pressure plate heavy
// TODO: Wood button
// TODO: Stone button
// TODO: Daylight sensor
// TODO: Tripwire hook
self::addCreativeItem(Item::get(Item::SNOWBALL)); self::addCreativeItem(Item::get(Item::SNOWBALL));
//Seeds //Seeds
self::addCreativeItem(Item::get(Item::COAL, 0));
self::addCreativeItem(Item::get(Item::COAL, 1));
self::addCreativeItem(Item::get(Item::DIAMOND, 0));
self::addCreativeItem(Item::get(Item::IRON_INGOT, 0));
self::addCreativeItem(Item::get(Item::GOLD_INGOT, 0));
self::addCreativeItem(Item::get(Item::EMERALD, 0));
self::addCreativeItem(Item::get(Item::STICK, 0));
self::addCreativeItem(Item::get(Item::BOWL, 0));
self::addCreativeItem(Item::get(Item::STRING, 0));
self::addCreativeItem(Item::get(Item::FEATHER, 0));
self::addCreativeItem(Item::get(Item::FLINT, 0));
self::addCreativeItem(Item::get(Item::LEATHER, 0));
// TODO: Rabbit hide
self::addCreativeItem(Item::get(Item::CLAY, 0));
self::addCreativeItem(Item::get(Item::SUGAR, 0));
self::addCreativeItem(Item::get(Item::NETHER_QUARTZ, 0));
self::addCreativeItem(Item::get(Item::PAPER, 0));
self::addCreativeItem(Item::get(Item::BOOK, 0));
self::addCreativeItem(Item::get(Item::ARROW, 0));
self::addCreativeItem(Item::get(Item::BONE, 0));
self::addCreativeItem(Item::get(Item::SUGARCANE, 0)); self::addCreativeItem(Item::get(Item::SUGARCANE, 0));
self::addCreativeItem(Item::get(Item::WHEAT, 0)); self::addCreativeItem(Item::get(Item::WHEAT, 0));
self::addCreativeItem(Item::get(Item::SEEDS, 0)); self::addCreativeItem(Item::get(Item::SEEDS, 0));
self::addCreativeItem(Item::get(Item::MELON_SEEDS, 0));
self::addCreativeItem(Item::get(Item::PUMPKIN_SEEDS, 0)); self::addCreativeItem(Item::get(Item::PUMPKIN_SEEDS, 0));
self::addCreativeItem(Item::get(Item::CARROT, 0)); self::addCreativeItem(Item::get(Item::MELON_SEEDS, 0));
self::addCreativeItem(Item::get(Item::POTATO, 0));
self::addCreativeItem(Item::get(Item::BEETROOT_SEEDS, 0)); self::addCreativeItem(Item::get(Item::BEETROOT_SEEDS, 0));
self::addCreativeItem(Item::get(Item::EGG, 0)); self::addCreativeItem(Item::get(Item::EGG, 0));
self::addCreativeItem(Item::get(Item::APPLE, 0));
self::addCreativeItem(Item::get(Item::GOLDEN_APPLE, 0));
// TODO: Golden apple enchanted
self::addCreativeItem(Item::get(Item::RAW_FISH, 0)); self::addCreativeItem(Item::get(Item::RAW_FISH, 0));
self::addCreativeItem(Item::get(Item::RAW_FISH, 1)); self::addCreativeItem(Item::get(Item::RAW_FISH, 1)); // TODO: Raw salmon
self::addCreativeItem(Item::get(Item::RAW_FISH, 2)); self::addCreativeItem(Item::get(Item::RAW_FISH, 2)); // TODO: Clownfish
self::addCreativeItem(Item::get(Item::RAW_FISH, 3)); self::addCreativeItem(Item::get(Item::RAW_FISH, 3)); // TODO: Pufferfish
self::addCreativeItem(Item::get(Item::COOKED_FISH, 0)); self::addCreativeItem(Item::get(Item::COOKED_FISH, 0));
self::addCreativeItem(Item::get(Item::COOKED_FISH, 1)); self::addCreativeItem(Item::get(Item::COOKED_FISH, 1)); //salmon
// TODO: Rotten flesh
// TODO: Mushroom stew
self::addCreativeItem(Item::get(Item::BREAD, 0));
self::addCreativeItem(Item::get(Item::RAW_PORKCHOP, 0));
self::addCreativeItem(Item::get(Item::COOKED_PORKCHOP, 0));
self::addCreativeItem(Item::get(Item::RAW_CHICKEN, 0));
self::addCreativeItem(Item::get(Item::COOKED_CHICKEN, 0));
self::addCreativeItem(Item::get(Item::RAW_BEEF, 0));
self::addCreativeItem(Item::get(Item::STEAK, 0));
self::addCreativeItem(Item::get(Item::MELON, 0));
self::addCreativeItem(Item::get(Item::CARROT, 0));
self::addCreativeItem(Item::get(Item::POTATO, 0));
self::addCreativeItem(Item::get(Item::BAKED_POTATO, 0));
// TODO: Poisonous potato
self::addCreativeItem(Item::get(Item::COOKIE, 0));
self::addCreativeItem(Item::get(Item::PUMPKIN_PIE, 0));
// TODO: Raw rabbit
// TODO: Cooked rabbit
// TODO: Rabbit stew
// TODO: Magma cream
// TODO: Blaze rod
self::addCreativeItem(Item::get(Item::GOLD_NUGGET, 0));
// TODO: Golden carrot
// TODO: Glistering melon
// TODO: Rabbit's foot
// TODO: Ghast tear
self::addCreativeItem(Item::get(Item::SLIMEBALL, 0));
// TODO: Blaze powder
// TODO: Nether wart
self::addCreativeItem(Item::get(Item::GUNPOWDER, 0));
self::addCreativeItem(Item::get(Item::GLOWSTONE_DUST, 0));
// TODO: Spider eye
// TODO: Fermented spider eye
// TODO: Bottle o' enchanting
// TODO: Enchanted books
self::addCreativeItem(Item::get(Item::DYE, 0)); self::addCreativeItem(Item::get(Item::DYE, 0));
self::addCreativeItem(Item::get(Item::DYE, 7)); self::addCreativeItem(Item::get(Item::DYE, 7));
self::addCreativeItem(Item::get(Item::DYE, 6)); self::addCreativeItem(Item::get(Item::DYE, 6));
@ -837,6 +1022,9 @@ class Item{
self::addCreativeItem(Item::get(Item::DYE, 10)); self::addCreativeItem(Item::get(Item::DYE, 10));
self::addCreativeItem(Item::get(Item::DYE, 9)); self::addCreativeItem(Item::get(Item::DYE, 9));
self::addCreativeItem(Item::get(Item::DYE, 8)); self::addCreativeItem(Item::get(Item::DYE, 8));
// TODO: Glass bottle
// TODO: Water bottle
// TODO: Potions
} }
public static function clearCreativeItems(){ public static function clearCreativeItems(){

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Leather extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::LEATHER, $meta, $count, "Leather");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Melon extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::MELON, $meta, $count, "Melon");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Minecart extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::MINECART, $meta, $count, "Minecart");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class NetherBrick extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::NETHER_BRICK, $meta, $count, "Nether Brick");
}
}

View File

@ -0,0 +1,29 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class NetherQuartz extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::NETHER_QUARTZ, 0, $count, "Nether Quartz");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Paper extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::PAPER, $meta, $count, "Paper");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class PumpkinPie extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::PUMPKIN_PIE, $meta, $count, "Pumpkin Pie");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Quartz extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::QUARTZ, $meta, $count, "Quartz");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class RawBeef extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::RAW_BEEF, $meta, $count, "Raw Beef");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class RawChicken extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::RAW_CHICKEN, $meta, $count, "Raw Chicken");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class RawPorkchop extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::RAW_PORKCHOP, $meta, $count, "Raw Porkchop");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Redstone extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::REDSTONE, $meta, $count, "Redstone");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Slimeball extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::SLIMEBALL, $meta, $count, "Slimeball");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class Steak extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::STEAK, $meta, $count, "Steak");
}
}

View File

@ -0,0 +1,30 @@
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\item;
class StringItem extends Item{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::STRING, $meta, $count, "String");
}
}

Some files were not shown because too many files have changed in this diff Show More