From dccf0f6a084d2fda2e45ca69ac65b55179095359 Mon Sep 17 00:00:00 2001 From: Max Lee Date: Wed, 25 Jul 2018 23:19:51 +0100 Subject: [PATCH] Apply spawner delay for cancelled pre spawn events (#1276) Setting the flag updates the spawner's delay which stops the spawner from trying to find a new spawn position each tick efter the event was cancelled/aborted which makes it usable for mob stackers/mergers and other plugins that don't actually want any mob to spawn in the spawner cycle but keep the overall behaviour close to vanilla. This might slightly effect existing plugins that use this event but I doubt anyone really relied on this behaviour, the only possible use case that I can think of is cancelling the event until you find a suitable position in your plugin... and this should be handled by the plugin itself by cancelling and spawning at the position manually. --- Spigot-Server-Patches/PreCreatureSpawnEvent.patch | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Spigot-Server-Patches/PreCreatureSpawnEvent.patch b/Spigot-Server-Patches/PreCreatureSpawnEvent.patch index b2dfcc1c6d..5cebb9ea2a 100644 --- a/Spigot-Server-Patches/PreCreatureSpawnEvent.patch +++ b/Spigot-Server-Patches/PreCreatureSpawnEvent.patch @@ -15,7 +15,7 @@ instead and save a lot of server resources. See: https://github.com/PaperMC/Paper/issues/917 diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 87fe4775f..9466bcdc7 100644 +index 87fe4775..94d0b8a3 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ @@ -44,6 +44,7 @@ index 87fe4775f..9466bcdc7 100644 + org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER + ); + if (!event.callEvent()) { ++ flag = true; + if (event.shouldAbortSpawn()) { + break; + } @@ -55,7 +56,7 @@ index 87fe4775f..9466bcdc7 100644 if (entity == null) { diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 2cd063829..e217d3340 100644 +index ed22607d..5d633774 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -0,0 +0,0 @@ public final class SpawnerCreature {