entityClass = $entityClass; } public function onActivate(Player $player, Block $blockReplace, Block $blockClicked, int $face, Vector3 $clickVector) : ItemUseResult{ $nbt = EntityFactory::createBaseNBT($blockReplace->getPos()->add(0.5, 0, 0.5), null, lcg_value() * 360, 0); if($this->hasCustomName()){ $nbt->setString("CustomName", $this->getCustomName()); } $entity = EntityFactory::create($this->entityClass, $player->getWorld(), $nbt); $this->pop(); $entity->spawnToAll(); //TODO: what if the entity was marked for deletion? return ItemUseResult::SUCCESS(); } }