Cleaned up random-block-ticking registration

This commit is contained in:
Dylan K. Taylor
2017-06-25 19:42:32 +01:00
parent 6553c82320
commit ebda6ec19b
17 changed files with 94 additions and 86 deletions

View File

@ -23,19 +23,10 @@ declare(strict_types=1);
namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\level\Level;
use pocketmine\math\Vector3;
use pocketmine\Player;
class BrownMushroom extends Flowable{
class BrownMushroom extends RedMushroom{
protected $id = self::BROWN_MUSHROOM;
public function __construct(int $meta = 0){
$this->meta = $meta;
}
public function getName() : string{
return "Brown Mushroom";
}
@ -43,28 +34,4 @@ class BrownMushroom extends Flowable{
public function getLightLevel() : int{
return 1;
}
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_NORMAL){
if($this->getSide(Vector3::SIDE_DOWN)->isTransparent() === true){
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}
}
return false;
}
public function place(Item $item, Block $block, Block $target, int $face, Vector3 $facePos, Player $player = null) : bool{
$down = $this->getSide(Vector3::SIDE_DOWN);
if($down->isTransparent() === false){
$this->getLevel()->setBlock($block, $this, true, true);
return true;
}
return false;
}
}