2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2018-09-18 23:34:11 +00:00
|
|
|
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.
|
|
|
|
|
2021-03-16 07:19:45 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
2021-03-16 15:50:45 +00:00
|
|
|
index d4b8126f12fdf7d9b4f882d3ed7d8da544ed9e8a..867478484c0ba4ff467b96e458689937299b981d 100644
|
2021-03-16 07:19:45 +00:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
2021-03-16 15:50:45 +00:00
|
|
|
@@ -132,11 +132,11 @@ public abstract class MobSpawnerAbstract {
|
2019-06-15 05:06:36 +00:00
|
|
|
|
2020-08-25 02:22:08 +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(
|
2018-09-18 23:34:11 +00:00
|
|
|
+ com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent event;
|
|
|
|
+ event = new com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent(
|
2020-08-25 02:22:08 +00:00
|
|
|
MCUtil.toLocation(world, d3, d4, d5),
|
|
|
|
type,
|
|
|
|
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
|
2019-05-05 08:33:44 +00:00
|
|
|
+ MCUtil.toLocation(world, blockposition)
|
2020-08-25 02:22:08 +00:00
|
|
|
);
|
|
|
|
if (!event.callEvent()) {
|
|
|
|
flag = true;
|