2021-06-15 07:44:37 +02: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
|
2023-06-13 09:10:07 +02:00
|
|
|
index fc7719d12b5f6011aec2e41a36b4bacd77672b6d..a9be524edb03c51300bc45d424fcf87c7491a8c0 100644
|
2021-06-15 07:44:37 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
2022-12-07 20:22:28 +01:00
|
|
|
@@ -134,11 +134,11 @@ public abstract class BaseSpawner {
|
2021-06-15 07:44:37 +02: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 21:43:46 +02:00
|
|
|
io.papermc.paper.util.MCUtil.toLocation(world, d0, d1, d2),
|
2021-06-15 07:44:37 +02:00
|
|
|
type,
|
|
|
|
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
|
2022-10-24 21:43:46 +02:00
|
|
|
+ io.papermc.paper.util.MCUtil.toLocation(world, pos)
|
2021-06-15 07:44:37 +02:00
|
|
|
);
|
|
|
|
if (!event.callEvent()) {
|
|
|
|
flag = true;
|