98 $world = $this->position->getWorld();
100 if($this->plant !==
null){
101 if($this->isValidPlant($plant)){
107 $removedItems = [$this->plant->asItem()];
108 if($player !==
null){
111 $removedItems = $player->getInventory()->addItem(...$removedItems);
113 foreach($removedItems as $drops){
114 $world->dropItem($this->position->add(0.5, 0.5, 0.5), $drops);
117 $this->setPlant(
null);
118 $world->setBlock($this->position, $this);
120 }elseif($this->isValidPlant($plant)){
121 $this->setPlant($plant);
123 $world->setBlock($this->position, $this);