aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0264-PreSpawnerSpawnEvent.patch
blob: c1f27a722aa015a61b2de4f9461608a79844170b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv>
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 3294e5b5ed0288af08067c36ca34514d02d200d3..b5d605feff68181269f23d95d60a3ed555133d85 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -134,11 +134,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(
                                 io.papermc.paper.util.MCUtil.toLocation(world, d0, d1, d2),
                                 type,
-                                org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
+                                io.papermc.paper.util.MCUtil.toLocation(world, pos)
                             );
                             if (!event.callEvent()) {
                                 flag = true;