# SpawnEntity

TIP

  • spawnEntity(<type>, <world>, <x>, <y>, <z>)
  • This function spawns an entity at the given position, once the entity is spawned, the function will return a unique ID for the entity, you can use this ID to control the entity with other functions, so it's highly recommended to store the ID using the saveData() function.
  • You can despawn the entity by either using the despawnEntity() function, or by having the entity killed.
  • There are various types of entities that you could spawn, here is a list of available ones:

Bat, Blaze, Cat, CaveSpider, Chicken, Cow, Creeper, Donkey, Drowned, ElderGuardian, EnderMan, EnderMite, EvocationIllager, Ghast, Guardian, Horse, Husk, IronGolem, Llama, MagmaCube, Mooshroom, Mule, Ocelot, Parrot, Phantom, Pig, PolarBear, Rabbit, Sheep, SilverFish, SkeletonHorse, Skeleton, Slime, SnowGolem, Spider, Vex, Vindicator, Witch, Wither, Wolf, ZombieHorse, Zombie, ZombiePigman.

# Parameters

  • <type> The entity type as string
  • <world> The world to spawn the entity in as string
  • <x> The X coordinate to spawn the entity as int or float
  • <y> The Y coordinate to spawn the entity as int or float
  • <z> The Z coordinate to spawn the entity as int or float

# Example

1: $id$ = spawnEntity("Zombie", $world$, $x$, $y$, $z$)
2: $data$ = getData('spawned-entities')
3: $data$[] = $id$
4: saveData("spawned-entities", $data$)