Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by ImMarvolo, Jul 19, 2018.
How to spawn random mobs on world.
generate a world
Gonna have to be more descriptive than that if you want help
I need spawn ramond mobs on world. Ex: In a game of skywars spawn random mobs to island.
Get all the islands, loop through the locations. You could use a chance system to determine if the location has an entity, you could then choose a random entitytype using the same chance system and then spawn a certain type of mob in that location, you could do it in one "for" loop
A cheapskate method would be to listen for CreatureSpawnEvent, and then spawn your custom mob when a certain mob type (Like let's say, a cow) spawns. You could also easily add a spawn chance that multiplies with the cow's spawnrate. Lastly, you could cancel the spawn event so the cow doesn't spawn alongside the custom mob.
Many ways to go about it, depending on what you need.