2020-05-02 06:03:47 +08:00
|
|
|
From b5db507c149f5d4a0013fc3547cd106217921d9b Mon Sep 17 00:00:00 2001
|
2018-09-19 07:34:11 +08: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.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
2020-05-02 06:03:47 +08:00
|
|
|
index 43c491f71b..cb7cb789b8 100644
|
2018-09-19 07:34:11 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
2019-12-13 00:20:43 +08:00
|
|
|
@@ -111,11 +111,11 @@ public abstract class MobSpawnerAbstract {
|
2019-06-15 13:06:36 +08:00
|
|
|
|
2019-12-13 00:20:43 +08: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-19 07:34:11 +08:00
|
|
|
+ com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent event;
|
|
|
|
+ event = new com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent(
|
2019-12-13 00:20:43 +08:00
|
|
|
MCUtil.toLocation(world, d3, d4, d5),
|
|
|
|
type,
|
|
|
|
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
|
2019-05-05 16:33:44 +08:00
|
|
|
+ MCUtil.toLocation(world, blockposition)
|
2019-12-13 00:20:43 +08:00
|
|
|
);
|
|
|
|
if (!event.callEvent()) {
|
|
|
|
flag = true;
|
2018-09-19 07:34:11 +08:00
|
|
|
--
|
2020-05-02 06:03:47 +08:00
|
|
|
2.26.2
|
2018-09-19 07:34:11 +08:00
|
|
|
|