PHP: $nbt = Entity::createBaseNBT($pos);$entity = Entity::createEntity($entityIds/$entityClass, $level, $nbt);$entity->spawnToAll();
oh wait you edited thread? why! first register entity in onEnable ev and spawn in other fuctions (i mean you can spawn in InteractEvent or what ever you want) use his code to spawn :