aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0357-PreSpawnerSpawnEvent.patch
blob: ee6783f597d6034360be5621f9e48be01353064f (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
30
31
32
From 27d86dafa2b1b6763d579bfcb34efef889ffa7ec 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/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index eca3f85ad2..b2d2de7f81 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -102,11 +102,11 @@ public abstract class MobSpawnerAbstract {
                     String key = this.getMobName().getKey();
                     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(
                                 MCUtil.toLocation(world, d3, d4, d5),
                                 type,
-                                org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
+                                MCUtil.toLocation(world, blockposition)
                         );
                         if (!event.callEvent()) {
                             flag = true;
-- 
2.21.0