diff --git a/src/BlockAPI.php b/src/BlockAPI.php index baf393e6a..58a2c90cc 100644 --- a/src/BlockAPI.php +++ b/src/BlockAPI.php @@ -31,6 +31,45 @@ use PocketMine\Tile\Sign as Sign; use PocketMine\NBT\Tag\Compound as Compound; use PocketMine\NBT\Tag\String as String; use PocketMine\NBT\Tag\Int as Int; +use PocketMine\Block\STONE as STONE; +use PocketMine\Block\COBBLESTONE as COBBLESTONE; +use PocketMine\Block\BRICKS as BRICKS; +use PocketMine\Block\DIRT as DIRT; +use PocketMine\Block\GRASS as GRASS; +use PocketMine\Block\SANDSTONE as SANDSTONE; +use PocketMine\Block\SAND as SAND; +use PocketMine\Block\GRAVEL as GRAVEL; +use PocketMine\Block\NETHERRACK as NETHERRACK; +use PocketMine\Block\BEDROCK as BEDROCK; +use PocketMine\Block\SLAB as SLAB; +use PocketMine\Block\OBSIDIAN as OBSIDIAN; +use PocketMine\Block\ICE as ICE; +use PocketMine\Block\GLASS as GLASS; +use PocketMine\Block\WOOL as WOOL; +use PocketMine\Block\LADDER as LADDER; +use PocketMine\Block\SPONGE as SPONGE; +use PocketMine\Block\TRAPDOOR as TRAPDOOR; +use PocketMine\Block\FENCE as FENCE; +use PocketMine\Block\BED as BED; +use PocketMine\Block\BOOKSHELF as BOOKSHELF; +use PocketMine\Block\WORKBENCH as WORKBENCH; +use PocketMine\Block\STONECUTTER as STONECUTTER; +use PocketMine\Block\CHEST as CHEST; +use PocketMine\Block\FURNACE as FURNACE; +use PocketMine\Block\DANDELION as DANDELION; +use PocketMine\Block\CACTUS as CACTUS; +use PocketMine\Block\PUMPKIN as PUMPKIN; +use PocketMine\Block\COBWEB as COBWEB; +use PocketMine\Block\SAPLING as SAPLING; +use PocketMine\Block\LEAVES as LEAVES; +use PocketMine\Block\CAKE as CAKE; +use PocketMine\Block\CARPET as CARPET; +use PocketMine\Block\TORCH as TORCH; +use PocketMine\Block\TNT as TNT; +use PocketMine\Block\SUGARCANE as SUGARCANE; +use PocketMine\Block\WHEAT as WHEAT; +use PocketMine\Block\CARROT as CARROT; +use PocketMine\Block\POTATO as POTATO; class BlockAPI{ private $server; @@ -38,53 +77,53 @@ class BlockAPI{ private $randomUpdates = array(); public static $creative = array( //Building - [Block\STONE, 0], - [Block\COBBLESTONE, 0], - [Block\STONE_BRICKS, 0], - [Block\STONE_BRICKS, 1], - [Block\STONE_BRICKS, 2], + [STONE, 0], + [COBBLESTONE, 0], + [STONE_BRICKS, 0], + [STONE_BRICKS, 1], + [STONE_BRICKS, 2], [Block\MOSS_STONE, 0], [Block\WOODEN_PLANKS, 0], [Block\WOODEN_PLANKS, 1], [Block\WOODEN_PLANKS, 2], [Block\WOODEN_PLANKS, 3], - [Block\BRICKS, 0], + [BRICKS, 0], - [Block\DIRT, 0], - [Block\GRASS, 0], + [DIRT, 0], + [GRASS, 0], [Block\CLAY_BLOCK, 0], - [Block\SANDSTONE, 0], - [Block\SANDSTONE, 1], - [Block\SANDSTONE, 2], - [Block\SAND, 0], - [Block\GRAVEL, 0], + [SANDSTONE, 0], + [SANDSTONE, 1], + [SANDSTONE, 2], + [SAND, 0], + [GRAVEL, 0], [Block\TRUNK, 0], [Block\TRUNK, 1], [Block\TRUNK, 2], [Block\TRUNK, 3], [Block\NETHER_BRICKS, 0], - [Block\NETHERRACK, 0], - [Block\BEDROCK, 0], - [Block\COBBLESTONE_STAIRS, 0], + [NETHERRACK, 0], + [BEDROCK, 0], + [COBBLESTONE_STAIRS, 0], [Block\OAK_WOODEN_STAIRS, 0], [Block\SPRUCE_WOODEN_STAIRS, 0], [Block\BIRCH_WOODEN_STAIRS, 0], [Block\JUNGLE_WOODEN_STAIRS, 0], [Block\BRICK_STAIRS, 0], - [Block\SANDSTONE_STAIRS, 0], - [Block\STONE_BRICK_STAIRS, 0], + [SANDSTONE_STAIRS, 0], + [STONE_BRICK_STAIRS, 0], [Block\NETHER_BRICKS_STAIRS, 0], [Block\QUARTZ_STAIRS, 0], - [Block\SLAB, 0], - [Block\SLAB, 1], + [SLAB, 0], + [SLAB, 1], [Block\WOODEN_SLAB, 0], [Block\WOODEN_SLAB, 1], [Block\WOODEN_SLAB, 2], [Block\WOODEN_SLAB, 3], - [Block\SLAB, 3], - [Block\SLAB, 4], - [Block\SLAB, 5], - [Block\SLAB, 6], + [SLAB, 3], + [SLAB, 4], + [SLAB, 5], + [SLAB, 6], [Block\QUARTZ_BLOCK, 0], [Block\QUARTZ_BLOCK, 1], [Block\QUARTZ_BLOCK, 2], @@ -94,101 +133,101 @@ class BlockAPI{ [Block\DIAMOND_ORE, 0], [Block\LAPIS_ORE, 0], [Block\REDSTONE_ORE, 0], - [Block\OBSIDIAN, 0], - [Block\ICE, 0], + [OBSIDIAN, 0], + [ICE, 0], [Block\SNOW_BLOCK, 0], //Decoration - [Block\COBBLESTONE_WALL, 0], - [Block\COBBLESTONE_WALL, 1], + [COBBLESTONE_WALL, 0], + [COBBLESTONE_WALL, 1], [Block\GOLD_BLOCK, 0], [Block\IRON_BLOCK, 0], [Block\DIAMOND_BLOCK, 0], [Block\LAPIS_BLOCK, 0], [Block\COAL_BLOCK, 0], [Block\SNOW_LAYER, 0], - [Block\GLASS, 0], + [GLASS, 0], [Block\GLOWSTONE_BLOCK, 0], [Block\NETHER_REACTOR, 0], - [Block\WOOL, 0], - [Block\WOOL, 7], - [Block\WOOL, 6], - [Block\WOOL, 5], - [Block\WOOL, 4], - [Block\WOOL, 3], - [Block\WOOL, 2], - [Block\WOOL, 1], - [Block\WOOL, 15], - [Block\WOOL, 14], - [Block\WOOL, 13], - [Block\WOOL, 12], - [Block\WOOL, 11], - [Block\WOOL, 10], - [Block\WOOL, 9], - [Block\WOOL, 8], - [Block\LADDER, 0], - [Block\SPONGE, 0], - [Block\GLASS_PANE, 0], + [WOOL, 0], + [WOOL, 7], + [WOOL, 6], + [WOOL, 5], + [WOOL, 4], + [WOOL, 3], + [WOOL, 2], + [WOOL, 1], + [WOOL, 15], + [WOOL, 14], + [WOOL, 13], + [WOOL, 12], + [WOOL, 11], + [WOOL, 10], + [WOOL, 9], + [WOOL, 8], + [LADDER, 0], + [SPONGE, 0], + [GLASS_PANE, 0], [Block\WOODEN_DOOR, 0], - [Block\TRAPDOOR, 0], - [Block\FENCE, 0], - [Block\FENCE_GATE, 0], + [TRAPDOOR, 0], + [FENCE, 0], + [FENCE_GATE, 0], [Block\IRON_BARS, 0], - [Block\BED, 0], - [Block\BOOKSHELF, 0], + [BED, 0], + [BOOKSHELF, 0], [Block\PAINTING, 0], - [Block\WORKBENCH, 0], - [Block\STONECUTTER, 0], - [Block\CHEST, 0], - [Block\FURNACE, 0], - [Block\DANDELION, 0], + [WORKBENCH, 0], + [STONECUTTER, 0], + [CHEST, 0], + [FURNACE, 0], + [DANDELION, 0], [Block\CYAN_FLOWER, 0], [Block\BROWN_MUSHROOM, 0], [Block\RED_MUSHROOM, 0], - [Block\CACTUS, 0], + [CACTUS, 0], [Block\MELON_BLOCK, 0], - [Block\PUMPKIN, 0], + [PUMPKIN, 0], [Block\LIT_PUMPKIN, 0], - [Block\COBWEB, 0], + [COBWEB, 0], [Block\HAY_BALE, 0], [Block\TALL_GRASS, 1], [Block\TALL_GRASS, 2], [Block\DEAD_BUSH, 0], - [Block\SAPLING, 0], - [Block\SAPLING, 1], - [Block\SAPLING, 2], - [Block\SAPLING, 3], - [Block\LEAVES, 0], - [Block\LEAVES, 1], - [Block\LEAVES, 2], - [Block\LEAVES, 3], - [Block\CAKE, 0], + [SAPLING, 0], + [SAPLING, 1], + [SAPLING, 2], + [SAPLING, 3], + [LEAVES, 0], + [LEAVES, 1], + [LEAVES, 2], + [LEAVES, 3], + [CAKE, 0], [Block\SIGN, 0], - [Block\CARPET, 0], - [Block\CARPET, 7], - [Block\CARPET, 6], - [Block\CARPET, 5], - [Block\CARPET, 4], - [Block\CARPET, 3], - [Block\CARPET, 2], - [Block\CARPET, 1], - [Block\CARPET, 15], - [Block\CARPET, 14], - [Block\CARPET, 13], - [Block\CARPET, 12], - [Block\CARPET, 11], - [Block\CARPET, 10], - [Block\CARPET, 9], - [Block\CARPET, 8], + [CARPET, 0], + [CARPET, 7], + [CARPET, 6], + [CARPET, 5], + [CARPET, 4], + [CARPET, 3], + [CARPET, 2], + [CARPET, 1], + [CARPET, 15], + [CARPET, 14], + [CARPET, 13], + [CARPET, 12], + [CARPET, 11], + [CARPET, 10], + [CARPET, 9], + [CARPET, 8], //Tools //array(RAILS, 0), //array(POWERED_RAILS, 0), - [Block\TORCH, 0], + [TORCH, 0], [Block\BUCKET, 0], [Block\BUCKET, 8], [Block\BUCKET, 10], - [Block\TNT, 0], + [TNT, 0], [Block\IRON_HOE, 0], [Block\IRON_SWORD, 0], [Block\BOW, 0], @@ -203,13 +242,13 @@ class BlockAPI{ array(SPAWN_EGG, MOB_SHEEP), //Seeds - [Block\SUGARCANE, 0], - [Block\WHEAT, 0], + [SUGARCANE, 0], + [WHEAT, 0], [Block\SEEDS, 0], [Block\MELON_SEEDS, 0], - [Block\PUMPKIN_SEEDS, 0], - [Block\CARROT, 0], - [Block\POTATO, 0], + [PUMPKIN_SEEDS, 0], + [CARROT, 0], + [POTATO, 0], [Block\BEETROOT_SEEDS, 0], [Block\EGG, 0], [Block\DYE, 0], diff --git a/src/block/Bed.php b/src/block/Bed.php index 181e83ecf..98a5962ce 100644 --- a/src/block/Bed.php +++ b/src/block/Bed.php @@ -21,6 +21,10 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; +use PocketMine\Block\Block as Block; +use PocketMine\Item\BED as BED; class Bed extends Transparent{ public function __construct($type = 0){ @@ -30,7 +34,7 @@ class Bed extends Transparent{ $this->hardness = 1; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if(ServerAPI::request()->api->time->getPhase($player->level) !== "night"){ $pk = new Network\Protocol\ChatPacket; $pk->message = "You can only sleep at night"; @@ -72,7 +76,7 @@ class Bed extends Transparent{ return true; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->isTransparent === false){ $faces = array( @@ -96,7 +100,7 @@ class Bed extends Transparent{ return false; } - public function onBreak(Item\Item $item, Player $player){ + public function onBreak(Item $item, Player $player){ $blockNorth = $this->getSide(2); //Gets the blocks around them $blockSouth = $this->getSide(3); $blockEast = $this->getSide(5); @@ -128,9 +132,9 @@ class Bed extends Transparent{ return true; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( - array(Item\BED, 0, 1), + array(BED, 0, 1), ); } diff --git a/src/block/Bedrock.php b/src/block/Bedrock.php index b48b2da52..0b1a7f11f 100644 --- a/src/block/Bedrock.php +++ b/src/block/Bedrock.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Bedrock extends Solid{ public function __construct(){ @@ -29,7 +30,7 @@ class Bedrock extends Solid{ $this->hardness = 18000000; } - public function isBreakable(Item\Item $item, Player $player){ + public function isBreakable(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return true; } diff --git a/src/block/Beetroot.php b/src/block/Beetroot.php index 30a66f421..5f3234851 100644 --- a/src/block/Beetroot.php +++ b/src/block/Beetroot.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class Beetroot extends Flowable{ public function __construct($meta = 0){ @@ -29,7 +31,7 @@ class Beetroot extends Flowable{ $this->hardness = 0; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); @@ -39,7 +41,7 @@ class Beetroot extends Flowable{ return false; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta = 0x07; $this->level->setBlock($this, $this, true, false, true); @@ -57,7 +59,7 @@ class Beetroot extends Flowable{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->isTransparent === true){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get(BEETROOT_SEEDS, 0, 1)); + //ServerAPI::request()->api->entity->drop($this, Item::get(BEETROOT_SEEDS, 0, 1)); $this->level->setBlock($this, new Air(), false, false, true); return BLOCK_UPDATE_NORMAL; @@ -78,7 +80,7 @@ class Beetroot extends Flowable{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ $drops = array(); if($this->meta >= 0x07){ $drops[] = array(Item\BEETROOT, 0, 1); diff --git a/src/block/BirchWoodStairs.php b/src/block/BirchWoodStairs.php index 754fa9641..32d06edba 100644 --- a/src/block/BirchWoodStairs.php +++ b/src/block/BirchWoodStairs.php @@ -21,13 +21,14 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class BirchWoodStairs extends Stair{ public function __construct($meta = 0){ parent::__construct(BIRCH_WOOD_STAIRS, $meta, "Birch Wood Stairs"); } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); diff --git a/src/block/Block.php b/src/block/Block.php index b33ffb1b7..207abbc35 100644 --- a/src/block/Block.php +++ b/src/block/Block.php @@ -429,12 +429,12 @@ abstract class Block extends Position{ /** * Returns an array of Item objects to be dropped * - * @param Item\Item $item + * @param ItemItem $item * @param Player $player * * @return array */ - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(ItemItem $item, Player $player){ if(!isset(self::$class[$this->id])){ //Unknown blocks return array(); } else{ @@ -447,13 +447,13 @@ abstract class Block extends Position{ /** * Returns the seconds that this block takes to be broken using an specific Item * - * @param Item\Item $item + * @param ItemItem $item * @param Player $player * * @return float */ - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(ItemItem $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.15; } @@ -470,7 +470,7 @@ abstract class Block extends Position{ */ public function getSide($side){ $v = parent::getSide($side); - if($this->level instanceof Level\Level){ + if($this->level instanceof LevelLevel){ return $this->level->getBlock($v); } @@ -484,27 +484,27 @@ abstract class Block extends Position{ /** * Returns if the item can be broken with an specific Item * - * @param Item\Item $item + * @param ItemItem $item * @param Player $player * * @return bool */ - abstract function isBreakable(Item\Item $item, Player $player); + abstract function isBreakable(ItemItem $item, Player $player); /** * Do the actions needed so the block is broken with the Item * - * @param Item\Item $item + * @param ItemItem $item * @param Player $player * * @return mixed */ - abstract function onBreak(Item\Item $item, Player $player); + abstract function onBreak(ItemItem $item, Player $player); /** * Places the Block, using block space and block target, and side. Returns if the block has been placed. * - * @param Item\Item $item + * @param ItemItem $item * @param Player $player * @param Block $block * @param Block $target @@ -515,17 +515,17 @@ abstract class Block extends Position{ * * @return bool */ - abstract function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz); + abstract function place(ItemItem $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz); /** * Do actions when activated by Item. Returns if it has done anything * - * @param Item\Item $item + * @param ItemItem $item * @param Player $player * * @return bool */ - abstract function onActivate(Item\Item $item, Player $player); + abstract function onActivate(ItemItem $item, Player $player); /** * Fires a block update on the Block diff --git a/src/block/Bricks.php b/src/block/Bricks.php index 1fa8fdbda..0a9393848 100644 --- a/src/block/Bricks.php +++ b/src/block/Bricks.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Bricks extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class Bricks extends Solid{ $this->hardness = 30; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -48,7 +49,7 @@ class Bricks extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(BRICKS_BLOCK, 0, 1), diff --git a/src/block/BrownMushroom.php b/src/block/BrownMushroom.php index 3fdc8a0d4..cb2864fb7 100644 --- a/src/block/BrownMushroom.php +++ b/src/block/BrownMushroom.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\ServerAPI as ServerAPI; +use PocketMine\Item\Item as Item; class BrownMushroom extends Flowable{ public function __construct(){ @@ -32,7 +34,7 @@ class BrownMushroom extends Flowable{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->isTransparent === true){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id)); + //ServerAPI::request()->api->entity->drop($this, Item::get($this->id)); $this->level->setBlock($this, new Air(), false, false, true); return BLOCK_UPDATE_NORMAL; @@ -42,7 +44,7 @@ class BrownMushroom extends Flowable{ return false; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->isTransparent === false){ $this->level->setBlock($block, $this, true, false, true); diff --git a/src/block/BurningFurnace.php b/src/block/BurningFurnace.php index f4396e5bb..c0c013d94 100644 --- a/src/block/BurningFurnace.php +++ b/src/block/BurningFurnace.php @@ -21,6 +21,13 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\NBT\Tag\Compound as Compound; +use PocketMine\NBT\Tag\Enum as Enum; +use PocketMine\NBT\Tag\String as String; +use PocketMine\Tile\Tile as Tile; +use PocketMine\NBT\Tag\Int as Int; +use PocketMine\Tile\Furnace as Furnace; class BurningFurnace extends Solid{ public function __construct($meta = 0){ @@ -29,7 +36,7 @@ class BurningFurnace extends Solid{ $this->hardness = 17.5; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $faces = array( 0 => 4, 1 => 2, @@ -38,41 +45,41 @@ class BurningFurnace extends Solid{ ); $this->meta = $faces[$player->getDirection()]; $this->level->setBlock($block, $this, true, false, true); - $nbt = new NBT\Tag\Compound(false, array( - "Items" => new NBT\Tag\Enum("Items", array()), - "id" => new NBT\Tag\String("id", Tile\Tile::FURNACE), - "x" => new NBT\Tag\Int("x", $this->x), - "y" => new NBT\Tag\Int("y", $this->y), - "z" => new NBT\Tag\Int("z", $this->z) + $nbt = new Compound(false, array( + "Items" => new Enum("Items", array()), + "id" => new String("id", Tile::FURNACE), + "x" => new Int("x", $this->x), + "y" => new Int("y", $this->y), + "z" => new Int("z", $this->z) )); $nbt->Items->setTagType(NBT\Tag_Compound); - $furnace = new Tile\Furnace($this->level, $nbt); + $furnace = new Furnace($this->level, $nbt); return true; } - public function onBreak(Item\Item $item, Player $player){ + public function onBreak(Item $item, Player $player){ $this->level->setBlock($this, new Air(), true, true, true); return true; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ $t = $this->level->getTile($this); $furnace = false; - if($t instanceof Tile\Furnace){ + if($t instanceof Furnace){ $furnace = $t; } else{ - $nbt = new NBT\Tag\Compound(false, array( - "Items" => new NBT\Tag\Enum("Items", array()), - "id" => new NBT\Tag\String("id", Tile\Tile::FURNACE), - "x" => new NBT\Tag\Int("x", $this->x), - "y" => new NBT\Tag\Int("y", $this->y), - "z" => new NBT\Tag\Int("z", $this->z) + $nbt = new Compound(false, array( + "Items" => new Enum("Items", array()), + "id" => new String("id", Tile::FURNACE), + "x" => new Int("x", $this->x), + "y" => new Int("y", $this->y), + "z" => new Int("z", $this->z) )); $nbt->Items->setTagType(NBT\Tag_Compound); - $furnace = new Tile\Furnace($this->level, $nbt); + $furnace = new Furnace($this->level, $nbt); } if(($player->gamemode & 0x01) === 0x01){ @@ -84,7 +91,7 @@ class BurningFurnace extends Solid{ return true; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -104,14 +111,14 @@ class BurningFurnace extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ $drops = array(); if($item->isPickaxe() >= 1){ $drops[] = array(FURNACE, 0, 1); } $t = $this->level->getTile($this); - if($t instanceof Tile\Furnace){ - for($s = 0; $s < Tile\Furnace::SLOTS; ++$s){ + if($t instanceof Furnace){ + for($s = 0; $s < Furnace::SLOTS; ++$s){ $slot = $t->getSlot($s); if($slot->getID() > AIR and $slot->getCount() > 0){ $drops[] = array($slot->getID(), $slot->getMetadata(), $slot->getCount()); diff --git a/src/block/Cactus.php b/src/block/Cactus.php index 296e4eee5..d55e535fa 100644 --- a/src/block/Cactus.php +++ b/src/block/Cactus.php @@ -21,6 +21,9 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\ServerAPI as ServerAPI; +use PocketMine\Item\Item as Item; +use PocketMine\Math\Vector3 as Vector3; class Cactus extends Transparent{ public function __construct($meta = 0){ @@ -34,7 +37,7 @@ class Cactus extends Transparent{ $down = $this->getSide(0); if($down->getID() !== SAND and $down->getID() !== CACTUS){ //Replace with common break method $this->level->setBlock($this, new Air(), false); - ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id)); + ServerAPI::request()->api->entity->drop($this, Item::get($this->id)); return BLOCK_UPDATE_NORMAL; } @@ -42,7 +45,7 @@ class Cactus extends Transparent{ if($this->getSide(0)->getID() !== CACTUS){ if($this->meta == 0x0F){ for($y = 1; $y < 3; ++$y){ - $b = $this->level->getBlock(new Math\Vector3($this->x, $this->y + $y, $this->z)); + $b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z)); if($b->getID() === AIR){ $this->level->setBlock($b, new Cactus(), true, false, true); break; @@ -62,7 +65,7 @@ class Cactus extends Transparent{ return false; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() === SAND or $down->getID() === CACTUS){ $block0 = $this->getSide(2); @@ -78,7 +81,7 @@ class Cactus extends Transparent{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); diff --git a/src/block/Cake.php b/src/block/Cake.php index 18f320286..229389337 100644 --- a/src/block/Cake.php +++ b/src/block/Cake.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Cake extends Transparent{ public function __construct($meta = 0){ @@ -31,7 +32,7 @@ class Cake extends Transparent{ $this->hardness = 2.5; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() !== AIR){ $this->level->setBlock($block, $this, true, false, true); @@ -54,11 +55,11 @@ class Cake extends Transparent{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array(); } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($player->getHealth() < 20){ ++$this->meta; $player->heal(3, "cake"); diff --git a/src/block/Carpet.php b/src/block/Carpet.php index 9dfb39500..fabf6fa41 100644 --- a/src/block/Carpet.php +++ b/src/block/Carpet.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class Carpet extends Flowable{ public function __construct($meta = 0){ @@ -49,7 +51,7 @@ class Carpet extends Flowable{ $this->isSolid = true; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() !== AIR){ $this->level->setBlock($block, $this, true, false, true); diff --git a/src/block/Carrot.php b/src/block/Carrot.php index 1f25d64a2..d4eb50221 100644 --- a/src/block/Carrot.php +++ b/src/block/Carrot.php @@ -21,6 +21,9 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; +use PocketMine\Item\CARROT as CARROT; class Carrot extends Flowable{ public function __construct($meta = 0){ @@ -29,7 +32,7 @@ class Carrot extends Flowable{ $this->hardness = 0; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); @@ -40,7 +43,7 @@ class Carrot extends Flowable{ return false; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta = 0x07; $this->level->setBlock($this, $this, true, false, true); @@ -58,7 +61,7 @@ class Carrot extends Flowable{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->isTransparent === true){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get(Item\CARROT, 0, 1)); + //ServerAPI::request()->api->entity->drop($this, Item::get(CARROT, 0, 1)); $this->level->setBlock($this, new Air(), false, false, true); return BLOCK_UPDATE_NORMAL; @@ -79,12 +82,12 @@ class Carrot extends Flowable{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ $drops = array(); if($this->meta >= 0x07){ - $drops[] = array(Item\CARROT, 0, mt_rand(1, 4)); + $drops[] = array(CARROT, 0, mt_rand(1, 4)); } else{ - $drops[] = array(Item\CARROT, 0, 1); + $drops[] = array(CARROT, 0, 1); } return $drops; diff --git a/src/block/Chest.php b/src/block/Chest.php index 7af2afd43..6bfc800f9 100644 --- a/src/block/Chest.php +++ b/src/block/Chest.php @@ -21,6 +21,13 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\Tile\Chest as TileChest; +use PocketMine\NBT\Tag\Compound as Compound; +use PocketMine\NBT\Tag\Enum as Enum; +use PocketMine\NBT\Tag\String as String; +use PocketMine\Tile\Tile as Tile; +use PocketMine\NBT\Tag\Int as Int; class Chest extends Transparent{ public function __construct($meta = 0){ @@ -29,7 +36,7 @@ class Chest extends Transparent{ $this->hardness = 15; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $faces = array( 0 => 4, 1 => 2, @@ -47,8 +54,8 @@ class Chest extends Transparent{ continue; } $c = $this->getSide($side); - if(($c instanceof Tile\Chest) and $c->getMetadata() === $this->meta){ - if((($tile = $this->level->getTile($c)) instanceof Tile\Chest) and !$tile->isPaired()){ + if(($c instanceof TileChest) and $c->getMetadata() === $this->meta){ + if((($tile = $this->level->getTile($c)) instanceof TileChest) and !$tile->isPaired()){ $chest = $tile; break; } @@ -56,17 +63,17 @@ class Chest extends Transparent{ } $this->level->setBlock($block, $this, true, false, true); - $nbt = new NBT\Tag\Compound(false, array( - "Items" => new NBT\Tag\Enum("Items", array()), - "id" => new NBT\Tag\String("id", Tile\Tile::CHEST), - "x" => new NBT\Tag\Int("x", $this->x), - "y" => new NBT\Tag\Int("y", $this->y), - "z" => new NBT\Tag\Int("z", $this->z) + $nbt = new Compound(false, array( + "Items" => new Enum("Items", array()), + "id" => new String("id", Tile::CHEST), + "x" => new Int("x", $this->x), + "y" => new Int("y", $this->y), + "z" => new Int("z", $this->z) )); $nbt->Items->setTagType(NBT\Tag_Compound); - $tile = new Tile\Chest($this->level, $nbt); + $tile = new TileChest($this->level, $nbt); - if($chest instanceof Tile\Chest){ + if($chest instanceof TileChest){ $chest->pairWith($tile); $tile->pairWith($chest); } @@ -74,9 +81,9 @@ class Chest extends Transparent{ return true; } - public function onBreak(Item\Item $item, Player $player){ + public function onBreak(Item $item, Player $player){ $t = $this->level->getTile($this); - if($t instanceof Tile\Chest){ + if($t instanceof TileChest){ $t->unpair(); } $this->level->setBlock($this, new Air(), true, true, true); @@ -84,7 +91,7 @@ class Chest extends Transparent{ return true; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ $top = $this->getSide(1); if($top->isTransparent !== true){ return true; @@ -92,18 +99,18 @@ class Chest extends Transparent{ $t = $this->level->getTile($this); $chest = false; - if($t instanceof Tile\Chest){ + if($t instanceof TileChest){ $chest = $t; } else{ - $nbt = new NBT\Tag\Compound(false, array( - "Items" => new NBT\Tag\Enum("Items", array()), - "id" => new NBT\Tag\String("id", Tile\Tile::CHEST), - "x" => new NBT\Tag\Int("x", $this->x), - "y" => new NBT\Tag\Int("y", $this->y), - "z" => new NBT\Tag\Int("z", $this->z) + $nbt = new Compound(false, array( + "Items" => new Enum("Items", array()), + "id" => new String("id", Tile::CHEST), + "x" => new Int("x", $this->x), + "y" => new Int("y", $this->y), + "z" => new Int("z", $this->z) )); $nbt->Items->setTagType(NBT\Tag_Compound); - $chest = new Tile\Chest($this->level, $nbt); + $chest = new TileChest($this->level, $nbt); } @@ -116,7 +123,7 @@ class Chest extends Transparent{ return true; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ $drops = array( array($this->id, 0, 1), ); diff --git a/src/block/Clay.php b/src/block/Clay.php index 2571c138c..0e2de55e0 100644 --- a/src/block/Clay.php +++ b/src/block/Clay.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Clay extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class Clay extends Solid{ $this->hardness = 3; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array(Item\CLAY, 0, 4), ); diff --git a/src/block/Coal.php b/src/block/Coal.php index de0a4da33..11ab9dadf 100644 --- a/src/block/Coal.php +++ b/src/block/Coal.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Coal extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class Coal extends Solid{ $this->hardness = 30; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -48,7 +49,7 @@ class Coal extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(COAL_BLOCK, 0, 1), diff --git a/src/block/CoalOre.php b/src/block/CoalOre.php index 17f87bd02..fe25f9b99 100644 --- a/src/block/CoalOre.php +++ b/src/block/CoalOre.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\Item\COAL as COAL; class CoalOre extends Solid{ public function __construct(){ @@ -28,7 +30,7 @@ class CoalOre extends Solid{ $this->hardness = 15; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -48,10 +50,10 @@ class CoalOre extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( - array(Item\COAL, 0, 1), + array(COAL, 0, 1), ); } else{ return array(); diff --git a/src/block/Cobblestone.php b/src/block/Cobblestone.php index 78e324fa9..07b510524 100644 --- a/src/block/Cobblestone.php +++ b/src/block/Cobblestone.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Cobblestone extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class Cobblestone extends Solid{ $this->hardness = 30; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -48,7 +49,7 @@ class Cobblestone extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(COBBLESTONE, 0, 1), diff --git a/src/block/Cobweb.php b/src/block/Cobweb.php index d8a240656..25b911bd4 100644 --- a/src/block/Cobweb.php +++ b/src/block/Cobweb.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Cobweb extends Flowable{ public function __construct(){ @@ -30,7 +31,7 @@ class Cobweb extends Flowable{ $this->hardness = 25; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array(); } } \ No newline at end of file diff --git a/src/block/CyanFlower.php b/src/block/CyanFlower.php index 01bf7d391..d3bce50b1 100644 --- a/src/block/CyanFlower.php +++ b/src/block/CyanFlower.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class CyanFlower extends Flowable{ public function __construct(){ @@ -28,7 +30,7 @@ class CyanFlower extends Flowable{ $this->hardness = 0; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){ $this->level->setBlock($block, $this, true, false, true); @@ -43,7 +45,7 @@ class CyanFlower extends Flowable{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->isTransparent === true){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id)); + //ServerAPI::request()->api->entity->drop($this, Item::get($this->id)); $this->level->setBlock($this, new Air(), false, false, true); return BLOCK_UPDATE_NORMAL; diff --git a/src/block/Dandelion.php b/src/block/Dandelion.php index 0834062a5..4cf95f5b9 100644 --- a/src/block/Dandelion.php +++ b/src/block/Dandelion.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class Dandelion extends Flowable{ public function __construct(){ @@ -28,7 +30,7 @@ class Dandelion extends Flowable{ $this->hardness = 0; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() === 2 or $down->getID() === 3 or $down->getID() === 60){ $this->level->setBlock($block, $this, true, false, true); @@ -43,7 +45,7 @@ class Dandelion extends Flowable{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->isTransparent === true){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id)); + //ServerAPI::request()->api->entity->drop($this, Item::get($this->id)); $this->level->setBlock($this, new Air(), false, false, true); return BLOCK_UPDATE_NORMAL; diff --git a/src/block/Diamond.php b/src/block/Diamond.php index 358751056..e1df5bae1 100644 --- a/src/block/Diamond.php +++ b/src/block/Diamond.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Diamond extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class Diamond extends Solid{ $this->hardness = 30; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -42,7 +43,7 @@ class Diamond extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 4){ return array( array(DIAMOND_BLOCK, 0, 1), diff --git a/src/block/DiamondOre.php b/src/block/DiamondOre.php index afcb3cecc..008fea39e 100644 --- a/src/block/DiamondOre.php +++ b/src/block/DiamondOre.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\Item\DIAMOND as DIAMOND; class DiamondOre extends Solid{ public function __construct(){ @@ -28,7 +30,7 @@ class DiamondOre extends Solid{ $this->hardness = 15; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -42,10 +44,10 @@ class DiamondOre extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 4){ return array( - array(Item\DIAMOND, 0, 1), + array(DIAMOND, 0, 1), ); } else{ return array(); diff --git a/src/block/Dirt.php b/src/block/Dirt.php index 530f2ea3d..f809ed071 100644 --- a/src/block/Dirt.php +++ b/src/block/Dirt.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\Block\Block as Block; class Dirt extends Solid{ public function __construct(){ @@ -29,7 +31,7 @@ class Dirt extends Solid{ $this->hardness = 2.5; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($item->isHoe()){ if(($player->gamemode & 0x01) === 0){ $item->useOn($this); diff --git a/src/block/Door.php b/src/block/Door.php index 3bc8d3754..aa5ca054c 100644 --- a/src/block/Door.php +++ b/src/block/Door.php @@ -21,6 +21,9 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\Block\Block as Block; +use PocketMine\Player as Player; abstract class Door extends Transparent{ @@ -44,7 +47,7 @@ abstract class Door extends Transparent{ return false; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ if($face === 1){ $blockUp = $this->getSide(1); $blockDown = $this->getSide(0); @@ -74,7 +77,7 @@ abstract class Door extends Transparent{ return false; } - public function onBreak(Item\Item $item, Player $player){ + public function onBreak(Item $item, Player $player){ if(($this->meta & 0x08) === 0x08){ $down = $this->getSide(0); if($down->getID() === $this->id){ @@ -91,7 +94,7 @@ abstract class Door extends Transparent{ return true; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if(($this->meta & 0x08) === 0x08){ //Top $down = $this->getSide(0); if($down->getID() === $this->id){ diff --git a/src/block/DoubleSlab.php b/src/block/DoubleSlab.php index fda700905..bce406f35 100644 --- a/src/block/DoubleSlab.php +++ b/src/block/DoubleSlab.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class DoubleSlab extends Solid{ public function __construct($meta = 0){ @@ -38,7 +39,7 @@ class DoubleSlab extends Solid{ $this->hardness = 30; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -58,7 +59,7 @@ class DoubleSlab extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(SLAB, $this->meta & 0x07, 2), diff --git a/src/block/DoubleWoodSlab.php b/src/block/DoubleWoodSlab.php index 081037d88..098a9c50e 100644 --- a/src/block/DoubleWoodSlab.php +++ b/src/block/DoubleWoodSlab.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class DoubleWoodSlab extends Solid{ public function __construct($meta = 0){ @@ -35,7 +36,7 @@ class DoubleWoodSlab extends Solid{ $this->hardness = 15; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -55,7 +56,7 @@ class DoubleWoodSlab extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array(WOOD_SLAB, $this->meta & 0x07, 2), ); diff --git a/src/block/Fallable.php b/src/block/Fallable.php index 82b4d0dd9..7a9a6e80b 100644 --- a/src/block/Fallable.php +++ b/src/block/Fallable.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class Fallable extends Solid{ @@ -29,7 +31,7 @@ class Fallable extends Solid{ $this->hasPhysics = true; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $ret = $this->level->setBlock($this, $this, true, false, true); ServerAPI::request()->api->block->blockUpdate(clone $this, BLOCK_UPDATE_NORMAL); diff --git a/src/block/Farmland.php b/src/block/Farmland.php index bf0389e44..734604525 100644 --- a/src/block/Farmland.php +++ b/src/block/Farmland.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Farmland extends Solid{ public function __construct($meta = 0){ @@ -28,7 +29,7 @@ class Farmland extends Solid{ $this->hardness = 3; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array(DIRT, 0, 1), ); diff --git a/src/block/FenceGate.php b/src/block/FenceGate.php index 855c71480..de58aa12a 100644 --- a/src/block/FenceGate.php +++ b/src/block/FenceGate.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class FenceGate extends Transparent{ public function __construct($meta = 0){ @@ -34,7 +35,7 @@ class FenceGate extends Transparent{ $this->hardness = 15; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $faces = array( 0 => 3, 1 => 0, @@ -47,13 +48,13 @@ class FenceGate extends Transparent{ return true; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ $faces = array( 0 => 3, 1 => 0, diff --git a/src/block/Fire.php b/src/block/Fire.php index afffa8ef7..0c9bca6c5 100644 --- a/src/block/Fire.php +++ b/src/block/Fire.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Fire extends Flowable{ public function __construct($meta = 0){ @@ -31,7 +32,7 @@ class Fire extends Flowable{ $this->hardness = 0; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array(); } diff --git a/src/block/Generic.php b/src/block/Generic.php index f5b0a06f5..2437e2ea9 100644 --- a/src/block/Generic.php +++ b/src/block/Generic.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class Generic extends Block{ @@ -33,15 +35,15 @@ class Generic extends Block{ parent::__construct($id, $meta, $name); } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ return $this->level->setBlock($this, $this, true, false, true); } - public function isBreakable(Item\Item $item, Player $player){ + public function isBreakable(Item $item, Player $player){ return $this->breakable; } - public function onBreak(Item\Item $item, Player $player){ + public function onBreak(Item $item, Player $player){ return $this->level->setBlock($this, new Air(), true, false, true); } @@ -69,7 +71,7 @@ class Generic extends Block{ return false; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ return $this->isActivable; } } \ No newline at end of file diff --git a/src/block/Glass.php b/src/block/Glass.php index 362ab94e6..e247bef46 100644 --- a/src/block/Glass.php +++ b/src/block/Glass.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Glass extends Transparent{ public function __construct(){ @@ -28,7 +29,7 @@ class Glass extends Transparent{ $this->hardness = 1.5; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array(); } } \ No newline at end of file diff --git a/src/block/GlowingRedstoneOre.php b/src/block/GlowingRedstoneOre.php index df5047359..70442b69d 100644 --- a/src/block/GlowingRedstoneOre.php +++ b/src/block/GlowingRedstoneOre.php @@ -21,6 +21,10 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Block\Block as Block; +use PocketMine\Level\Position as Position; +use PocketMine\Utils\Utils as Utils; +use PocketMine\Item\Item as Item; class GlowingRedstoneOre extends Solid{ public function __construct(){ @@ -34,14 +38,14 @@ class GlowingRedstoneOre extends Solid{ return BLOCK_UPDATE_WEAK; } else{ - $this->level->scheduleBlockUpdate(new Level\Position($this, 0, 0, $this->level), Utils\Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); + $this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM); } return false; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -55,7 +59,7 @@ class GlowingRedstoneOre extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 4){ return array( array(Item\REDSTONE_DUST, 0, mt_rand(4, 5)), diff --git a/src/block/Glowstone.php b/src/block/Glowstone.php index 51f630e05..ca643c27b 100644 --- a/src/block/Glowstone.php +++ b/src/block/Glowstone.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Glowstone extends Transparent{ public function __construct(){ @@ -28,7 +29,7 @@ class Glowstone extends Transparent{ $this->hardness = 1.5; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array(Item\GLOWSTONE_DUST, 0, mt_rand(2, 4)), ); diff --git a/src/block/Gold.php b/src/block/Gold.php index ba3683d17..66969c860 100644 --- a/src/block/Gold.php +++ b/src/block/Gold.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Gold extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class Gold extends Solid{ $this->hardness = 30; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -42,7 +43,7 @@ class Gold extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 4){ return array( array(GOLD_BLOCK, 0, 1), diff --git a/src/block/GoldOre.php b/src/block/GoldOre.php index 3ab81e5e4..96562c679 100644 --- a/src/block/GoldOre.php +++ b/src/block/GoldOre.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class GoldOre extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class GoldOre extends Solid{ $this->hardness = 15; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -42,7 +43,7 @@ class GoldOre extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 4){ return array( array(GOLD_ORE, 0, 1), diff --git a/src/block/Grass.php b/src/block/Grass.php index 38b6c0b94..5ad77e592 100644 --- a/src/block/Grass.php +++ b/src/block/Grass.php @@ -21,6 +21,9 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\Level\Generator\Object\TallGrass as TallGrass; +use PocketMine\Utils\Random as Random; class Grass extends Solid{ public function __construct(){ @@ -29,18 +32,18 @@ class Grass extends Solid{ $this->hardness = 3; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array(DIRT, 0, 1), ); } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ if(($player->gamemode & 0x01) === 0){ $item->count--; } - Level\Generator\Object\TallGrass::growGrass($this->level, $this, new Utils\Random(), 8, 2); + TallGrass::growGrass($this->level, $this, new Random(), 8, 2); return true; } elseif($item->isHoe()){ diff --git a/src/block/Gravel.php b/src/block/Gravel.php index bb9501330..09f30ad87 100644 --- a/src/block/Gravel.php +++ b/src/block/Gravel.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Gravel extends Fallable{ public function __construct(){ @@ -28,7 +29,7 @@ class Gravel extends Fallable{ $this->hardness = 3; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if(mt_rand(1, 10) === 1){ return array( array(Item\FLINT, 0, 1), diff --git a/src/block/HayBale.php b/src/block/HayBale.php index 4ffb417fe..45a758aff 100644 --- a/src/block/HayBale.php +++ b/src/block/HayBale.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class HayBale extends Solid{ public function __construct($meta = 0){ @@ -28,7 +29,7 @@ class HayBale extends Solid{ $this->hardness = 10; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $faces = array( 0 => 0, 1 => 0, @@ -44,7 +45,7 @@ class HayBale extends Solid{ return true; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); diff --git a/src/block/Ice.php b/src/block/Ice.php index 93571016e..b8d48e3e0 100644 --- a/src/block/Ice.php +++ b/src/block/Ice.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Ice extends Transparent{ public function __construct(){ @@ -28,7 +29,7 @@ class Ice extends Transparent{ $this->hardness = 2.5; } - public function onBreak(Item\Item $item, Player $player){ + public function onBreak(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0){ $this->level->setBlock($this, new Water(), true, false, true); } else{ @@ -38,7 +39,7 @@ class Ice extends Transparent{ return true; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -58,7 +59,7 @@ class Ice extends Transparent{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array(); } } \ No newline at end of file diff --git a/src/block/Iron.php b/src/block/Iron.php index dc4bf4d77..87f8bf617 100644 --- a/src/block/Iron.php +++ b/src/block/Iron.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Iron extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class Iron extends Solid{ $this->hardness = 30; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -44,7 +45,7 @@ class Iron extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 3){ return array( array(IRON_BLOCK, 0, 1), diff --git a/src/block/IronDoor.php b/src/block/IronDoor.php index 93bf9fa4c..94ec7932f 100644 --- a/src/block/IronDoor.php +++ b/src/block/IronDoor.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class IronDoor extends Door{ public function __construct($meta = 0){ @@ -29,7 +30,7 @@ class IronDoor extends Door{ $this->hardness = 25; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -49,7 +50,7 @@ class IronDoor extends Door{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(Item\IRON_DOOR, 0, 1), diff --git a/src/block/IronOre.php b/src/block/IronOre.php index 3f9cd236e..52698fa89 100644 --- a/src/block/IronOre.php +++ b/src/block/IronOre.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class IronOre extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class IronOre extends Solid{ $this->hardness = 15; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -44,7 +45,7 @@ class IronOre extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 3){ return array( array(IRON_ORE, 0, 1), diff --git a/src/block/JungleWoodStairs.php b/src/block/JungleWoodStairs.php index f49ed6e71..83eeec5e1 100644 --- a/src/block/JungleWoodStairs.php +++ b/src/block/JungleWoodStairs.php @@ -21,13 +21,14 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class JungleWoodStairs extends Stair{ public function __construct($meta = 0){ parent::__construct(JUNGLE_WOOD_STAIRS, $meta, "Jungle Wood Stairs"); } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); diff --git a/src/block/Ladder.php b/src/block/Ladder.php index 4a23ffeef..518a61b24 100644 --- a/src/block/Ladder.php +++ b/src/block/Ladder.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class Ladder extends Transparent{ public function __construct($meta = 0){ @@ -30,7 +32,7 @@ class Ladder extends Transparent{ $this->hardness = 2; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ if($target->isTransparent === false){ $faces = array( 2 => 2, @@ -52,7 +54,7 @@ class Ladder extends Transparent{ public function onUpdate($type){ if($type === BLOCK_UPDATE_NORMAL){ /*if($this->getSide(0)->getID() === AIR){ //Replace with common break method - ServerAPI::request()->api->entity->drop($this, Item\Item::get(LADDER, 0, 1)); + ServerAPI::request()->api->entity->drop($this, Item::get(LADDER, 0, 1)); $this->level->setBlock($this, new Air(), true, true, true); return BLOCK_UPDATE_NORMAL; }*/ @@ -61,7 +63,7 @@ class Ladder extends Transparent{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); diff --git a/src/block/Lapis.php b/src/block/Lapis.php index adb342c28..4c47bfacc 100644 --- a/src/block/Lapis.php +++ b/src/block/Lapis.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Lapis extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class Lapis extends Solid{ $this->hardness = 15; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -44,7 +45,7 @@ class Lapis extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 3){ return array( array(LAPIS_BLOCK, 0, 1), diff --git a/src/block/LapisOre.php b/src/block/LapisOre.php index c5268ccd7..1ce0704cb 100644 --- a/src/block/LapisOre.php +++ b/src/block/LapisOre.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class LapisOre extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class LapisOre extends Solid{ $this->hardness = 15; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -44,7 +45,7 @@ class LapisOre extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 3){ return array( array(Item\DYE, 4, mt_rand(4, 8)), diff --git a/src/block/Lava.php b/src/block/Lava.php index fb6995750..2f1f21278 100644 --- a/src/block/Lava.php +++ b/src/block/Lava.php @@ -21,6 +21,9 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; +use PocketMine\Level\Position as Position; class Lava extends Liquid{ public function __construct($meta = 0){ @@ -28,7 +31,7 @@ class Lava extends Liquid{ $this->hardness = 0; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $ret = $this->level->setBlock($this, $this, true, false, true); ServerAPI::request()->api->block->scheduleBlockUpdate(clone $this, 40, BLOCK_UPDATE_NORMAL); @@ -99,7 +102,7 @@ class Lava extends Liquid{ if($level !== 0x07){ if($down instanceof Air || $down instanceof Lava){ $this->level->setBlock($down, new Lava(0x01), false, false, true); - ServerAPI::request()->api->block->scheduleBlockUpdate(new Level\Position($down, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); + ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($down, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); } else{ for($side = 2; $side <= 5; ++$side){ $b = $this->getSide($side); @@ -107,7 +110,7 @@ class Lava extends Liquid{ } elseif($b->isFlowable === true){ $this->level->setBlock($b, new Lava(min($level + 2, 7)), false, false, true); - ServerAPI::request()->api->block->scheduleBlockUpdate(new Level\Position($b, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); + ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($b, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); } } } @@ -121,7 +124,7 @@ class Lava extends Liquid{ if($tlevel != 0x00){ for($s = 0; $s <= 5; $s++){ $ssb = $sb->getSide($s); - ServerAPI::request()->api->block->scheduleBlockUpdate(new Level\Position($ssb, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); + ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($ssb, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); } $this->level->setBlock($sb, new Air(), false, false, true); } @@ -132,7 +135,7 @@ class Lava extends Liquid{ if($tlevel != 0x00){ for($s = 0; $s <= 5; $s++){ $ssb = $sb->getSide($s); - ServerAPI::request()->api->block->scheduleBlockUpdate(new Level\Position($ssb, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); + ServerAPI::request()->api->block->scheduleBlockUpdate(new Position($ssb, 0, 0, $this->level), 40, BLOCK_UPDATE_NORMAL); } $this->level->setBlock($b, new Air(), false, false, true); } diff --git a/src/block/Leaves.php b/src/block/Leaves.php index 6fe25808b..ac129ab94 100644 --- a/src/block/Leaves.php +++ b/src/block/Leaves.php @@ -21,6 +21,9 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\ServerAPI as ServerAPI; +use PocketMine\Item\Item as Item; +use PocketMine\Item\APPLE as APPLE; class Leaves extends Transparent{ const OAK = 0; @@ -122,11 +125,11 @@ class Leaves extends Transparent{ $this->level->setBlock($this, new Air(), false, false, true); if(mt_rand(1, 20) === 1){ //Saplings //TODO - ServerAPI::request()->api->entity->drop($this, Item\Item::get(SAPLING, $this->meta & 0x03, 1)); + ServerAPI::request()->api->entity->drop($this, Item::get(SAPLING, $this->meta & 0x03, 1)); } if(($this->meta & 0x03) === self::OAK and mt_rand(1, 200) === 1){ //Apples //TODO - ServerAPI::request()->api->entity->drop($this, Item\Item::get(APPLE, 0, 1)); + ServerAPI::request()->api->entity->drop($this, Item::get(APPLE, 0, 1)); } return BLOCK_UPDATE_NORMAL; @@ -137,12 +140,12 @@ class Leaves extends Transparent{ return false; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $this->meta |= 0x04; $this->level->setBlock($this, $this, true, false, true); } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ $drops = array(); if($item->isShears()){ $drops[] = array(LEAVES, $this->meta & 0x03, 1); @@ -151,7 +154,7 @@ class Leaves extends Transparent{ $drops[] = array(Item\SAPLING, $this->meta & 0x03, 1); } if(($this->meta & 0x03) === self::OAK and mt_rand(1, 200) === 1){ //Apples - $drops[] = array(Item\APPLE, 0, 1); + $drops[] = array(APPLE, 0, 1); } } diff --git a/src/block/LitPumpkin.php b/src/block/LitPumpkin.php index 281322ce7..44b93854b 100644 --- a/src/block/LitPumpkin.php +++ b/src/block/LitPumpkin.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class LitPumpkin extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class LitPumpkin extends Solid{ $this->hardness = 5; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $faces = array( 0 => 4, 1 => 2, diff --git a/src/block/Melon.php b/src/block/Melon.php index 1a741a930..8e35fd922 100644 --- a/src/block/Melon.php +++ b/src/block/Melon.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Melon extends Transparent{ public function __construct(){ @@ -28,7 +29,7 @@ class Melon extends Transparent{ $this->hardness = 5; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array(Item\MELON_SLICE, 0, mt_rand(3, 7)), ); diff --git a/src/block/MelonStem.php b/src/block/MelonStem.php index bc3a5872a..9d6f38867 100644 --- a/src/block/MelonStem.php +++ b/src/block/MelonStem.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class MelonStem extends Flowable{ public function __construct($meta = 0){ @@ -29,7 +31,7 @@ class MelonStem extends Flowable{ $this->hardness = 0; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); @@ -44,7 +46,7 @@ class MelonStem extends Flowable{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->isTransparent === true){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get(MELON_SEEDS, 0, mt_rand(0, 2))); + //ServerAPI::request()->api->entity->drop($this, Item::get(MELON_SEEDS, 0, mt_rand(0, 2))); $this->level->setBlock($this, new Air(), false, false, true); return BLOCK_UPDATE_NORMAL; @@ -77,7 +79,7 @@ class MelonStem extends Flowable{ return false; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta = 0x07; $this->level->setBlock($this, $this, true, false, true); @@ -91,7 +93,7 @@ class MelonStem extends Flowable{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array(Item\MELON_SEEDS, 0, mt_rand(0, 2)), ); diff --git a/src/block/MossStone.php b/src/block/MossStone.php index 332f0ad05..3f47e2580 100644 --- a/src/block/MossStone.php +++ b/src/block/MossStone.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class MossStone extends Solid{ public function __construct($meta){ @@ -28,7 +29,7 @@ class MossStone extends Solid{ $this->hardness = 30; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -48,7 +49,7 @@ class MossStone extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(MOSS_STONE, $this->meta, 1), diff --git a/src/block/NetherBrick.php b/src/block/NetherBrick.php index 3a40367a7..d11b532d9 100644 --- a/src/block/NetherBrick.php +++ b/src/block/NetherBrick.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class NetherBricks extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class NetherBricks extends Solid{ $this->hardness = 30; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -48,7 +49,7 @@ class NetherBricks extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(NETHER_BRICKS, 0, 1), diff --git a/src/block/Netherrack.php b/src/block/Netherrack.php index ab34335ac..d83b51b3f 100644 --- a/src/block/Netherrack.php +++ b/src/block/Netherrack.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Netherrack extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class Netherrack extends Solid{ $this->hardness = 2; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -48,7 +49,7 @@ class Netherrack extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(NETHERRACK, 0, 1), diff --git a/src/block/Obsidian.php b/src/block/Obsidian.php index d5332b9c2..c83834938 100644 --- a/src/block/Obsidian.php +++ b/src/block/Obsidian.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Obsidian extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class Obsidian extends Solid{ $this->hardness = 6000; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -39,7 +40,7 @@ class Obsidian extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 5){ return array( array(OBSIDIAN, 0, 1), diff --git a/src/block/Potato.php b/src/block/Potato.php index ebfe8d21a..00e5d0e77 100644 --- a/src/block/Potato.php +++ b/src/block/Potato.php @@ -21,6 +21,9 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; +use PocketMine\Item\POTATO as POTATO; class Potato extends Flowable{ public function __construct($meta = 0){ @@ -29,7 +32,7 @@ class Potato extends Flowable{ $this->hardness = 0; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); @@ -40,7 +43,7 @@ class Potato extends Flowable{ return false; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta = 0x07; $this->level->setBlock($this, $this, true, false, true); @@ -58,7 +61,7 @@ class Potato extends Flowable{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->isTransparent === true){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get(POTATO, 0, 1)); + //ServerAPI::request()->api->entity->drop($this, Item::get(POTATO, 0, 1)); $this->level->setBlock($this, new Air(), false, false, true); return BLOCK_UPDATE_NORMAL; @@ -79,12 +82,12 @@ class Potato extends Flowable{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ $drops = array(); if($this->meta >= 0x07){ - $drops[] = array(Item\POTATO, 0, mt_rand(1, 4)); + $drops[] = array(POTATO, 0, mt_rand(1, 4)); } else{ - $drops[] = array(Item\POTATO, 0, 1); + $drops[] = array(POTATO, 0, 1); } return $drops; diff --git a/src/block/PumpkinStem.php b/src/block/PumpkinStem.php index 9e6ee4c95..c56727e24 100644 --- a/src/block/PumpkinStem.php +++ b/src/block/PumpkinStem.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class PumpkinStem extends Flowable{ public function __construct($meta = 0){ @@ -29,7 +31,7 @@ class PumpkinStem extends Flowable{ $this->hardness = 0; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); @@ -44,7 +46,7 @@ class PumpkinStem extends Flowable{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->isTransparent === true){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get(PUMPKIN_SEEDS, 0, mt_rand(0, 2))); + //ServerAPI::request()->api->entity->drop($this, Item::get(PUMPKIN_SEEDS, 0, mt_rand(0, 2))); $this->level->setBlock($this, new Air(), false, false, true); return BLOCK_UPDATE_NORMAL; @@ -77,7 +79,7 @@ class PumpkinStem extends Flowable{ return false; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta = 0x07; $this->level->setBlock($this, $this, true, false, true); @@ -91,7 +93,7 @@ class PumpkinStem extends Flowable{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array(Item\PUMPKIN_SEEDS, 0, mt_rand(0, 2)), ); diff --git a/src/block/Quartz.php b/src/block/Quartz.php index 3933fcaf6..c123762c5 100644 --- a/src/block/Quartz.php +++ b/src/block/Quartz.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Quartz extends Solid{ public function __construct($meta = 0){ @@ -34,7 +35,7 @@ class Quartz extends Solid{ $this->name = $names[$this->meta & 0x03]; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -54,7 +55,7 @@ class Quartz extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(QUARTZ_BLOCK, $this->meta & 0x03, 1), diff --git a/src/block/RedMushroom.php b/src/block/RedMushroom.php index 0192b20c3..d52b81e20 100644 --- a/src/block/RedMushroom.php +++ b/src/block/RedMushroom.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\ServerAPI as ServerAPI; +use PocketMine\Item\Item as Item; class RedMushroom extends Flowable{ public function __construct(){ @@ -32,7 +34,7 @@ class RedMushroom extends Flowable{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->isTransparent === true){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id)); + //ServerAPI::request()->api->entity->drop($this, Item::get($this->id)); $this->level->setBlock($this, new Air(), false); return BLOCK_UPDATE_NORMAL; @@ -42,7 +44,7 @@ class RedMushroom extends Flowable{ return false; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->isTransparent === false){ $this->level->setBlock($block, $this, true, false, true); diff --git a/src/block/RedstoneOre.php b/src/block/RedstoneOre.php index bd50bc12e..c883bb658 100644 --- a/src/block/RedstoneOre.php +++ b/src/block/RedstoneOre.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Block\Block as Block; +use PocketMine\Item\Item as Item; class RedstoneOre extends Solid{ public function __construct(){ @@ -39,7 +41,7 @@ class RedstoneOre extends Solid{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 2){ return array( array(Redstone\REDSTONE_DUST, 0, mt_rand(4, 5)), diff --git a/src/block/Sandstone.php b/src/block/Sandstone.php index 56f589323..5dc455a21 100644 --- a/src/block/Sandstone.php +++ b/src/block/Sandstone.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Sandstone extends Solid{ public function __construct($meta = 0){ @@ -34,7 +35,7 @@ class Sandstone extends Solid{ $this->hardness = 4; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -54,7 +55,7 @@ class Sandstone extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(SANDSTONE, $this->meta & 0x03, 1), diff --git a/src/block/Sapling.php b/src/block/Sapling.php index b81d29b74..58a405394 100644 --- a/src/block/Sapling.php +++ b/src/block/Sapling.php @@ -21,6 +21,10 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\Level\Generator\Object\Tree as Tree; +use PocketMine\Utils\Random as Random; +use PocketMine\ServerAPI as ServerAPI; class Sapling extends Flowable{ const OAK = 0; @@ -42,7 +46,7 @@ class Sapling extends Flowable{ $this->hardness = 0; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() === GRASS or $down->getID() === DIRT or $down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); @@ -53,9 +57,9 @@ class Sapling extends Flowable{ return false; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal - Level\Generator\Object\Tree::growTree($this->level, $this, new Utils\Random(), $this->meta & 0x03); + Tree::growTree($this->level, $this, new Random(), $this->meta & 0x03); if(($player->gamemode & 0x01) === 0){ $item->count--; } @@ -70,7 +74,7 @@ class Sapling extends Flowable{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->isTransparent === true){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id)); + //ServerAPI::request()->api->entity->drop($this, Item::get($this->id)); $this->level->setBlock($this, new Air(), false, false, true); return BLOCK_UPDATE_NORMAL; @@ -78,7 +82,7 @@ class Sapling extends Flowable{ } elseif($type === BLOCK_UPDATE_RANDOM){ //Growth if(mt_rand(1, 7) === 1){ if(($this->meta & 0x08) === 0x08){ - Level\Generator\Object\Tree::growTree($this->level, $this, new Utils\Random(), $this->meta & 0x03); + Tree::growTree($this->level, $this, new Random(), $this->meta & 0x03); } else{ $this->meta |= 0x08; $this->level->setBlock($this, $this, true, false, true); @@ -93,7 +97,7 @@ class Sapling extends Flowable{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, $this->meta & 0x03, 1), ); diff --git a/src/block/SignPost.php b/src/block/SignPost.php index b398fae79..6d7cef4c4 100644 --- a/src/block/SignPost.php +++ b/src/block/SignPost.php @@ -21,6 +21,9 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\Block\Block as Block; +use PocketMine\ServerAPI as ServerAPI; class SignPost extends Transparent{ public function __construct($meta = 0){ @@ -30,7 +33,7 @@ class SignPost extends Transparent{ $this->hardness = 5; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ if($face !== 0){ $faces = array( 2 => 2, @@ -58,7 +61,7 @@ class SignPost extends Transparent{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->getID() === AIR){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get(SIGN, 0, 1)); + //ServerAPI::request()->api->entity->drop($this, Item::get(SIGN, 0, 1)); $this->level->setBlock($this, new Air(), true, true, true); return BLOCK_UPDATE_NORMAL; @@ -68,13 +71,13 @@ class SignPost extends Transparent{ return false; } - public function onBreak(Item\Item $item, Player $player){ + public function onBreak(Item $item, Player $player){ $this->level->setBlock($this, new Air(), true, true, true); return true; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array(Item\SIGN, 0, 1), ); diff --git a/src/block/Slab.php b/src/block/Slab.php index 82c278ca8..31d2913c7 100644 --- a/src/block/Slab.php +++ b/src/block/Slab.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\Block\Block as Block; class Slab extends Transparent{ public function __construct($meta = 0){ @@ -44,7 +46,7 @@ class Slab extends Transparent{ $this->hardness = 30; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $this->meta &= 0x07; if($face === 0){ if($target->getID() === SLAB and ($target->getMetadata() & 0x08) === 0x08 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){ @@ -93,7 +95,7 @@ class Slab extends Transparent{ return true; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -113,7 +115,7 @@ class Slab extends Transparent{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array($this->id, $this->meta & 0x07, 1), diff --git a/src/block/SnowLayer.php b/src/block/SnowLayer.php index 489b8f135..3e413b63d 100644 --- a/src/block/SnowLayer.php +++ b/src/block/SnowLayer.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class SnowLayer extends Flowable{ public function __construct($meta = 0){ @@ -31,7 +32,7 @@ class SnowLayer extends Flowable{ $this->hardness = 0.5; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down instanceof Solid){ $this->level->setBlock($block, $this, true, false, true); @@ -54,7 +55,7 @@ class SnowLayer extends Flowable{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isShovel() !== false){ return array( array(Item\SNOWBALL, 0, 1), diff --git a/src/block/SpruceWoodStairs.php b/src/block/SpruceWoodStairs.php index 253e7f825..a2e200a14 100644 --- a/src/block/SpruceWoodStairs.php +++ b/src/block/SpruceWoodStairs.php @@ -21,13 +21,14 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class SpruceWoodStairs extends Stair{ public function __construct($meta = 0){ parent::__construct(SPRUCE_WOOD_STAIRS, $meta, "Spruce Wood Stairs"); } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); diff --git a/src/block/Stair.php b/src/block/Stair.php index 828e39ffc..06dd0a38e 100644 --- a/src/block/Stair.php +++ b/src/block/Stair.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Stair extends Transparent{ @@ -34,7 +35,7 @@ class Stair extends Transparent{ $this->hardness = 30; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $faces = array( 0 => 0, 1 => 2, @@ -50,7 +51,7 @@ class Stair extends Transparent{ return true; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array($this->id, 0, 1), diff --git a/src/block/Stone.php b/src/block/Stone.php index de7b906cf..fef2d1b97 100644 --- a/src/block/Stone.php +++ b/src/block/Stone.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Stone extends Solid{ public function __construct(){ @@ -28,7 +29,7 @@ class Stone extends Solid{ $this->hardness = 30; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -48,7 +49,7 @@ class Stone extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(COBBLESTONE, 0, 1), diff --git a/src/block/StoneBricks.php b/src/block/StoneBricks.php index ac5b42a4c..dba7b0279 100644 --- a/src/block/StoneBricks.php +++ b/src/block/StoneBricks.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class StoneBricks extends Solid{ public function __construct($meta = 0){ @@ -35,7 +36,7 @@ class StoneBricks extends Solid{ $this->hardness = 30; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -55,7 +56,7 @@ class StoneBricks extends Solid{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ if($item->isPickaxe() >= 1){ return array( array(STONE_BRICKS, $this->meta & 0x03, 1), diff --git a/src/block/Stonecutter.php b/src/block/Stonecutter.php index 07301ea3c..58d201200 100644 --- a/src/block/Stonecutter.php +++ b/src/block/Stonecutter.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Stonecutter extends Solid{ public function __construct($meta = 0){ @@ -28,13 +29,13 @@ class Stonecutter extends Solid{ $this->isActivable = true; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ $player->toCraft[-1] = 2; return true; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); diff --git a/src/block/Sugarcane.php b/src/block/Sugarcane.php index 23e4516d2..a6bb5d5db 100644 --- a/src/block/Sugarcane.php +++ b/src/block/Sugarcane.php @@ -21,6 +21,10 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\Item\SUGARCANE as SUGARCANE; +use PocketMine\Math\Vector3 as Vector3; +use PocketMine\ServerAPI as ServerAPI; class Sugarcane extends Flowable{ public function __construct($meta = 0){ @@ -28,17 +32,17 @@ class Sugarcane extends Flowable{ $this->hardness = 0; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( - array(Item\SUGARCANE, 0, 1), + array(SUGARCANE, 0, 1), ); } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($item->getID() === DYE and $item->getMetadata() === 0x0F){ //Bonemeal if($this->getSide(0)->getID() !== SUGARCANE_BLOCK){ for($y = 1; $y < 3; ++$y){ - $b = $this->level->getBlock(new Math\Vector3($this->x, $this->y + $y, $this->z)); + $b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z)); if($b->getID() === AIR){ $this->level->setBlock($b, new Sugarcane(), true, false, true); break; @@ -62,7 +66,7 @@ class Sugarcane extends Flowable{ $down = $this->getSide(0); if($down->isTransparent === true and $down->getID() !== SUGARCANE_BLOCK){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get(SUGARCANE)); + //ServerAPI::request()->api->entity->drop($this, Item::get(SUGARCANE)); $this->level->setBlock($this, new Air(), false, false, true); return BLOCK_UPDATE_NORMAL; @@ -71,7 +75,7 @@ class Sugarcane extends Flowable{ if($this->getSide(0)->getID() !== SUGARCANE_BLOCK){ if($this->meta === 0x0F){ for($y = 1; $y < 3; ++$y){ - $b = $this->level->getBlock(new Math\Vector3($this->x, $this->y + $y, $this->z)); + $b = $this->level->getBlock(new Vector3($this->x, $this->y + $y, $this->z)); if($b->getID() === AIR){ $this->level->setBlock($b, new Sugarcane(), true, false, true); break; @@ -91,7 +95,7 @@ class Sugarcane extends Flowable{ return false; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() === SUGARCANE_BLOCK){ $this->level->setBlock($block, new Sugarcane(), true, false, true); diff --git a/src/block/TNT.php b/src/block/TNT.php index 500406937..37e22045c 100644 --- a/src/block/TNT.php +++ b/src/block/TNT.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class TNT extends Solid{ public function __construct(){ @@ -29,7 +31,7 @@ class TNT extends Solid{ $this->isActivable = true; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($item->getID() === Item\FLINT_STEEL){ if(($player->gamemode & 0x01) === 0){ $item->useOn($this); diff --git a/src/block/Torch.php b/src/block/Torch.php index a935e5f0b..6a3578136 100644 --- a/src/block/Torch.php +++ b/src/block/Torch.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\ServerAPI as ServerAPI; +use PocketMine\Item\Item as Item; class Torch extends Flowable{ public function __construct($meta = 0){ @@ -43,7 +45,7 @@ class Torch extends Flowable{ if($this->getSide($faces[$side])->isTransparent === true and !($side === 0 and $this->getSide(0)->getID() === FENCE)){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get($this->id, 0, 1)); + //ServerAPI::request()->api->entity->drop($this, Item::get($this->id, 0, 1)); $this->level->setBlock($this, new Air(), true, false, true); return BLOCK_UPDATE_NORMAL; @@ -53,7 +55,7 @@ class Torch extends Flowable{ return false; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ if($target->isTransparent === false and $face !== 0){ $faces = array( 1 => 5, @@ -76,7 +78,7 @@ class Torch extends Flowable{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); diff --git a/src/block/Trapdoor.php b/src/block/Trapdoor.php index 7cc626fc5..bf4c8fa2e 100644 --- a/src/block/Trapdoor.php +++ b/src/block/Trapdoor.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Trapdoor extends Transparent{ public function __construct($meta = 0){ @@ -34,7 +35,7 @@ class Trapdoor extends Transparent{ $this->hardness = 15; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ if(($target->isTransparent === false or $target->getID() === SLAB) and $face !== 0 and $face !== 1){ $faces = array( 2 => 0, @@ -54,13 +55,13 @@ class Trapdoor extends Transparent{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ $this->meta ^= 0x04; $this->level->setBlock($this, $this, true, false, true); diff --git a/src/block/Water.php b/src/block/Water.php index 0fabda529..f3b60b0aa 100644 --- a/src/block/Water.php +++ b/src/block/Water.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class Water extends Liquid{ public function __construct($meta = 0){ @@ -28,7 +30,7 @@ class Water extends Liquid{ $this->hardness = 500; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $ret = $this->level->setBlock($this, $this, true, false, true); ServerAPI::request()->api->block->scheduleBlockUpdate(clone $this, 10, BLOCK_UPDATE_NORMAL); diff --git a/src/block/Wheat.php b/src/block/Wheat.php index 8f8ea0d59..153e645db 100644 --- a/src/block/Wheat.php +++ b/src/block/Wheat.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\ServerAPI as ServerAPI; class Wheat extends Flowable{ public function __construct($meta = 0){ @@ -29,7 +31,7 @@ class Wheat extends Flowable{ $this->hardness = 0; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $down = $this->getSide(0); if($down->getID() === FARMLAND){ $this->level->setBlock($block, $this, true, false, true); @@ -40,7 +42,7 @@ class Wheat extends Flowable{ return false; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ if($item->getID() === Item\DYE and $item->getMetadata() === 0x0F){ //Bonemeal $this->meta = 0x07; $this->level->setBlock($this, $this, true, false, true); @@ -58,7 +60,7 @@ class Wheat extends Flowable{ if($type === BLOCK_UPDATE_NORMAL){ if($this->getSide(0)->isTransparent === true){ //Replace with common break method //TODO - //ServerAPI::request()->api->entity->drop($this, Item\Item::get(WHEAT_SEEDS, 0, 1)); + //ServerAPI::request()->api->entity->drop($this, Item::get(WHEAT_SEEDS, 0, 1)); $this->level->setBlock($this, new Air(), false, false, true); return BLOCK_UPDATE_NORMAL; @@ -75,7 +77,7 @@ class Wheat extends Flowable{ return false; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ $drops = array(); if($this->meta >= 0x07){ $drops[] = array(Item\WHEAT, 0, 1); diff --git a/src/block/Wood.php b/src/block/Wood.php index 26b2cd2db..aaa3ddaf3 100644 --- a/src/block/Wood.php +++ b/src/block/Wood.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Wood extends Solid{ const OAK = 0; @@ -40,7 +41,7 @@ class Wood extends Solid{ $this->hardness = 10; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $faces = array( 0 => 0, 1 => 0, @@ -56,7 +57,7 @@ class Wood extends Solid{ return true; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, $this->meta & 0x03, 1), ); diff --git a/src/block/WoodDoor.php b/src/block/WoodDoor.php index a709745dd..306a6e2a2 100644 --- a/src/block/WoodDoor.php +++ b/src/block/WoodDoor.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class WoodDoor extends Door{ public function __construct($meta = 0){ @@ -29,7 +30,7 @@ class WoodDoor extends Door{ $this->hardness = 15; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array(Item\WOODEN_DOOR, 0, 1), ); diff --git a/src/block/WoodSlab.php b/src/block/WoodSlab.php index 619ae4eda..796886919 100644 --- a/src/block/WoodSlab.php +++ b/src/block/WoodSlab.php @@ -21,6 +21,8 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; +use PocketMine\Block\Block as Block; class WoodSlab extends Transparent{ public function __construct($meta = 0){ @@ -40,7 +42,7 @@ class WoodSlab extends Transparent{ $this->hardness = 15; } - public function place(Item\Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + public function place(Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ $this->meta &= 0x07; if($face === 0){ if($target->getID() === WOOD_SLAB and ($target->getMetadata() & 0x08) === 0x08 and ($target->getMetadata() & 0x07) === ($this->meta & 0x07)){ @@ -89,7 +91,7 @@ class WoodSlab extends Transparent{ return true; } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -109,7 +111,7 @@ class WoodSlab extends Transparent{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, $this->meta & 0x07, 1), ); diff --git a/src/block/WoodStairs.php b/src/block/WoodStairs.php index 7136af7e5..9836f67b0 100644 --- a/src/block/WoodStairs.php +++ b/src/block/WoodStairs.php @@ -21,13 +21,14 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class WoodStairs extends Stair{ public function __construct($meta = 0){ parent::__construct(WOOD_STAIRS, $meta, "Wood Stairs"); } - public function getBreakTime(Item\Item $item, Player $player){ + public function getBreakTime(Item $item, Player $player){ if(($player->gamemode & 0x01) === 0x01){ return 0.20; } @@ -47,7 +48,7 @@ class WoodStairs extends Stair{ } } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); diff --git a/src/block/Workbench.php b/src/block/Workbench.php index e68212b06..282ea2acf 100644 --- a/src/block/Workbench.php +++ b/src/block/Workbench.php @@ -21,6 +21,7 @@ namespace PocketMine\Block; use PocketMine; +use PocketMine\Item\Item as Item; class Workbench extends Solid{ public function __construct($meta = 0){ @@ -29,13 +30,13 @@ class Workbench extends Solid{ $this->hardness = 15; } - public function onActivate(Item\Item $item, Player $player){ + public function onActivate(Item $item, Player $player){ $player->toCraft[-1] = 1; return true; } - public function getDrops(Item\Item $item, Player $player){ + public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), ); diff --git a/src/item/Bucket.php b/src/item/Bucket.php index ad088196e..5bfdece9e 100644 --- a/src/item/Bucket.php +++ b/src/item/Bucket.php @@ -26,6 +26,7 @@ use PocketMine\Block\Block as Block; use PocketMine\Block\Air as Air; use PocketMine\Block\Water as Water; use PocketMine\Block\Lava as Lava; +use PocketMine\Block\Liquid as Liquid; class Bucket extends Item{ public function __construct($meta = 0, $count = 1){ @@ -36,7 +37,7 @@ class Bucket extends Item{ public function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ if($this->meta === AIR){ - if($target instanceof Block\Liquid){ + if($target instanceof Liquid){ $level->setBlock($target, new Air(), true, false, true); if(($player->gamemode & 0x01) === 0){ $this->meta = ($target instanceof Water) ? WATER : LAVA; diff --git a/src/item/FlintSteel.php b/src/item/FlintSteel.php index 3f5e08c8e..1a692ff0b 100644 --- a/src/item/FlintSteel.php +++ b/src/item/FlintSteel.php @@ -24,6 +24,7 @@ use PocketMine; use PocketMine\Level\Level as Level; use PocketMine\Block\Block as Block; use PocketMine\Block\Fire as Fire; +use PocketMine\Block\Solid as Solid; class FlintSteel extends Item{ public function __construct($meta = 0, $count = 1){ @@ -37,7 +38,7 @@ class FlintSteel extends Item{ $player->setSlot($player->slot, new Item(AIR, 0, 0)); } - if($block->getID() === AIR and ($target instanceof Block\Solid)){ + if($block->getID() === AIR and ($target instanceof Solid)){ $level->setBlock($block, new Fire(), true, false, true); return true; } diff --git a/src/level/Level.php b/src/level/Level.php index 317715bb6..00bba5fdf 100644 --- a/src/level/Level.php +++ b/src/level/Level.php @@ -51,7 +51,7 @@ class Level{ public $nextSave; /** - * @var PMF\LevelFormat + * @var PMFLevelFormat */ public $level; public $stopTime;