3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 19:10:09 +01:00
Paper/patches/unapplied/server/0267-PreSpawnerSpawnEvent.patch
2024-04-23 13:36:31 -07:00

28 Zeilen
1.7 KiB
Diff

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 0166c5ff685490cbf67a9d26f48cb1a0be754488..cae8c508972d771ad96228ace8a7e6cbc34d5489 100644
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
@@ -131,10 +131,10 @@ public abstract class BaseSpawner {
continue;
}
// Paper start - PreCreatureSpawnEvent
- com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent event = new com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent(
+ com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent event = new com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent(
io.papermc.paper.util.MCUtil.toLocation(world, d0, d1, d2),
org.bukkit.craftbukkit.entity.CraftEntityType.minecraftToBukkit(optional.get()),
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
+ io.papermc.paper.util.MCUtil.toLocation(world, pos)
);
if (!event.callEvent()) {
flag = true;