farmland and grass path should die when a solid block is above them

This commit is contained in:
Dylan K. Taylor
2017-10-12 11:11:33 +01:00
parent 35e7aca88f
commit 63fccd4682
2 changed files with 16 additions and 1 deletions

View File

@ -28,6 +28,7 @@ use pocketmine\item\ItemFactory;
use pocketmine\item\Tool;
use pocketmine\level\Level;
use pocketmine\math\AxisAlignedBB;
use pocketmine\math\Vector3;
class Farmland extends Transparent{
@ -65,7 +66,10 @@ class Farmland extends Transparent{
}
public function onUpdate(int $type){
if($type === Level::BLOCK_UPDATE_RANDOM){
if($type === Level::BLOCK_UPDATE_NORMAL and $this->getSide(Vector3::SIDE_UP)->isSolid()){
$this->level->setBlock($this, BlockFactory::get(Block::DIRT), true);
return $type;
}elseif($type === Level::BLOCK_UPDATE_RANDOM){
//TODO: hydration
}