public function onUpdate($type)
{
if ($type === Level::BLOCK_UPDATE_NORMAL) {
if ($this->getSide(0)->isTransparent() === true) {
$this->getLevel()->useBreakOn($this);
return Level::BLOCK_UPDATE_NORMAL;
}
} elseif ($type === Level::BLOCK_UPDATE_RANDOM) {
//Growth
if (mt_rand(1, 7) === 1) {
if (($this->meta & 0x8) === 0x8) {
Tree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x7, false);
} else {
$this->meta |= 0x8;
$this->getLevel()->setBlock($this, $this, true);
return Level::BLOCK_UPDATE_RANDOM;
}
} else {
return Level::BLOCK_UPDATE_RANDOM;
}
}
return false;
}