Used namespacer on Blocks and Items

This commit is contained in:
Shoghi Cervantes
2014-03-06 17:16:05 +01:00
parent d490972a42
commit 6a736aa822
86 changed files with 528 additions and 345 deletions

View File

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