2021-06-15 05:44:37 +00:00
|
|
|
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
|
2022-10-24 19:43:46 +00:00
|
|
|
index c41c1fa8085f502363c8273cd9fce1cf1743fe71..92e3bb8b59d79cbe79fa55a7db443bd7a1957914 100644
|
2021-06-15 05:44:37 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
2022-06-08 00:42:07 +00:00
|
|
|
@@ -130,11 +130,11 @@ public abstract class BaseSpawner {
|
2021-06-15 05:44:37 +00:00
|
|
|
|
|
|
|
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(
|
2022-10-24 19:43:46 +00:00
|
|
|
io.papermc.paper.util.MCUtil.toLocation(world, d0, d1, d2),
|
2021-06-15 05:44:37 +00:00
|
|
|
type,
|
|
|
|
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
|
2022-10-24 19:43:46 +00:00
|
|
|
+ io.papermc.paper.util.MCUtil.toLocation(world, pos)
|
2021-06-15 05:44:37 +00:00
|
|
|
);
|
|
|
|
if (!event.callEvent()) {
|
|
|
|
flag = true;
|