95 $world = $this->position->getWorld();
97 if($this->plant !==
null){
98 if($this->isValidPlant($plant)){
104 $removedItems = [$this->plant->asItem()];
105 if($player !==
null){
108 $removedItems = $player->getInventory()->addItem(...$removedItems);
110 foreach($removedItems as $drops){
111 $world->dropItem($this->position->add(0.5, 0.5, 0.5), $drops);
114 $this->setPlant(
null);
115 $world->setBlock($this->position, $this);
117 }elseif($this->isValidPlant($plant)){
118 $this->setPlant($plant);
120 $world->setBlock($this->position, $this);