Added Block and Item namespaces

This commit is contained in:
Shoghi Cervantes
2014-03-06 17:14:15 +01:00
parent 2e0d9153b3
commit 6f74ef80f9
120 changed files with 1190 additions and 876 deletions

View File

@ -19,7 +19,10 @@
*
*/
class GlowingRedstoneOreBlock extends SolidBlock{
namespace PocketMine\Block;
use PocketMine;
class GlowingRedstoneOre extends Solid{
public function __construct(){
parent::__construct(GLOWING_REDSTONE_ORE, 0, "Glowing Redstone Ore");
$this->hardness = 15;
@ -27,18 +30,18 @@ class GlowingRedstoneOreBlock extends SolidBlock{
public function onUpdate($type){
if($type === BLOCK_UPDATE_SCHEDULED or $type === BLOCK_UPDATE_RANDOM){
$this->level->setBlock($this, Block\Block::get(REDSTONE_ORE, $this->meta), false, false, true);
$this->level->setBlock($this, Block::get(REDSTONE_ORE, $this->meta), false, false, true);
return BLOCK_UPDATE_WEAK;
} else{
$this->level->scheduleBlockUpdate(new Position($this, 0, 0, $this->level), Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
$this->level->scheduleBlockUpdate(new Level\Position($this, 0, 0, $this->level), Utils\Utils::getRandomUpdateTicks(), BLOCK_UPDATE_RANDOM);
}
return false;
}
public function getBreakTime(Item $item, Player $player){
public function getBreakTime(Item\Item $item, Player $player){
if(($player->gamemode & 0x01) === 0x01){
return 0.20;
}
@ -52,10 +55,10 @@ class GlowingRedstoneOreBlock extends SolidBlock{
}
}
public function getDrops(Item $item, Player $player){
public function getDrops(Item\Item $item, Player $player){
if($item->isPickaxe() >= 4){
return array(
array(REDSTONE_DUST, 0, mt_rand(4, 5)),
array(Item\REDSTONE_DUST, 0, mt_rand(4, 5)),
);
} else{
return array();