aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0268-PreSpawnerSpawnEvent.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0268-PreSpawnerSpawnEvent.patch')
-rw-r--r--patches/server/0268-PreSpawnerSpawnEvent.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/patches/server/0268-PreSpawnerSpawnEvent.patch b/patches/server/0268-PreSpawnerSpawnEvent.patch
new file mode 100644
index 0000000000..0e9cb1f017
--- /dev/null
+++ b/patches/server/0268-PreSpawnerSpawnEvent.patch
@@ -0,0 +1,29 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Phoenix616 <[email protected]>
+Date: Tue, 18 Sep 2018 23:53:23 +0100
+Subject: [PATCH] PreSpawnerSpawnEvent
+
+This adds a separate event before an entity is spawned by a spawner
+which contains the location of the spawner too similarly to how the
+SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for
+spawners.
+
+diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
+index 18b1b7c05665ee1fb06670ceded719b19f3a4ee3..1c76a59eb25148bf2523e9d68cc165b6cd3e1d23 100644
+--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
++++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
+@@ -128,11 +128,11 @@ public abstract class BaseSpawner {
+
+ org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key);
+ if (type != null) {
+- com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event;
+- event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
++ com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent event;
++ event = new com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent(
+ net.minecraft.server.MCUtil.toLocation(world, d0, d1, d2),
+ type,
+- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
++ net.minecraft.server.MCUtil.toLocation(world, pos)
+ );
+ if (!event.callEvent()) {
+ flag = true;