x - 1, $this->x + 1); $y = mt_rand($this->y - 2, $this->y + 2); $z = mt_rand($this->z - 1, $this->z + 1); $block = $this->getLevel()->getBlockIdAt($x, $y, $z); if($block === Block::DIRT){ $block = Block::get($block, $this->getLevel()->getBlockDataAt($x, $y, $z), Position::createPosition($x, $y, $z, $this->getLevel())); if($block->getSide(1) instanceof Transparent){ Server::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Grass())); if(!$ev->isCancelled()){ $this->getLevel()->setBlock($block, $ev->getNewState()); } } } } } public function onActivate(Item $item, Player $player = null){ if($item->getID() === Item::DYE and $item->getDamage() === 0x0F){ $item->count--; TallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2); return true; }elseif($item->isHoe()){ $item->useOn($this); $this->getLevel()->setBlock($this, new Farmland()); return true; } return false; } }