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

@ -26,6 +26,7 @@ namespace pocketmine\block;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
class Farmland extends Transparent{
@ -48,6 +49,10 @@ class Farmland extends Transparent{
return Tool::TYPE_SHOVEL;
}
public function ticksRandomly() : bool{
return true;
}
protected function recalculateBoundingBox(){
return new AxisAlignedBB(
$this->x,
@ -59,6 +64,14 @@ class Farmland extends Transparent{
);
}
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_RANDOM){
//TODO: hydration
}
return false;
}
public function getDrops(Item $item) : array{
return [
ItemFactory::get(Item::DIRT, 0, 1)