Closed tastybento closed 3 years ago
This isn't a bug in WorldGeneratorApi, that's just how Spigot works nowadays. See the JavaDoc inside the CreatureSpawnEvent over here: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/browse/src/main/java/org/bukkit/event/entity/CreatureSpawnEvent.java#55
/**
* When a creature spawns due to chunk generation
*
* @deprecated no longer called, chunks are generated with entities
* already existing. Consider using {@link ChunkLoadEvent},
* {@link ChunkLoadEvent#isNewChunk()} and {@link Chunk#getEntities()}
* for similar effect.
*/
@Deprecated
CHUNK_GEN,
Thanks, this helps.
Describe the bug When generating chunks, animal spawns do not fire the Bukkit CreatureSpawnEvent, so they cannot be canceled. I'm trying to write a plugin that will limit animal (and monster) spawning to certain areas, but the animals spawned by WorldGeneratorAPI do not seem to be controllable. I don't want to prevent all spawning, just only allow it in a specific area.
To Reproduce Steps to reproduce the behavior:
This is my chunk generator:
This is used by the WorldCreator:
I'm using the
YourNoiseGenerator
class from your tutorial. The world generates nicely and starts to be populated by animals, etc. However, I have this listener running:This should prevent all entries from spawning, but it doesn't. There are some subsequent natural spawning events it blocks, but there are many animals everywhere.
Does the Decorator spawn entities? Is there a way to fire Bukkit events when these entities spawn?
Screenshots