57 $world = $this->position->getWorld();
58 $lightAbove = $world->getFullLightAt($this->position->x, $this->position->y + 1, $this->position->z);
59 if($lightAbove < 4 && $world->getBlockAt($this->position->x, $this->position->y + 1, $this->position->z)->getLightFilter() >= 2){
61 BlockEventHelper::spread($this, VanillaBlocks::DIRT(), $this);
62 }elseif($lightAbove >= 9){
64 for($i = 0; $i < 4; ++$i){
65 $x = mt_rand($this->position->x - 1, $this->position->x + 1);
66 $y = mt_rand($this->position->y - 3, $this->position->y + 1);
67 $z = mt_rand($this->position->z - 1, $this->position->z + 1);
69 $b = $world->getBlockAt($x, $y, $z);
71 !($b instanceof
Dirt) ||
72 $b->getDirtType() !== DirtType::NORMAL ||
73 $world->getFullLightAt($x, $y + 1, $z) < 4 ||
74 $world->getBlockAt($x, $y + 1, $z)->getLightFilter() >= 2
79 BlockEventHelper::spread($b, VanillaBlocks::GRASS(), $this);
88 $world = $this->position->getWorld();
91 TallGrassObject::growGrass($world, $this->position,
new Random(mt_rand()), 8, 2);
95 if($face !== Facing::DOWN){
96 if($item instanceof Hoe){
97 $item->applyDamage(1);
98 $newBlock = VanillaBlocks::FARMLAND();
99 $world->addSound($this->position->add(0.5, 0.5, 0.5),
new ItemUseOnBlockSound($newBlock));
100 $world->setBlock($this->position, $newBlock);
103 }elseif($item instanceof Shovel){
104 $item->applyDamage(1);
105 $newBlock = VanillaBlocks::GRASS_PATH();
106 $world->addSound($this->position->add(0.5, 0.5, 0.5),
new ItemUseOnBlockSound($newBlock));
107 $world->setBlock($this->position, $newBlock);