37 lines
1.9 KiB
Diff
37 lines
1.9 KiB
Diff
From 4f7ce2bba482d32179e6b76b5bec2aa4d3010fec 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/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
index 55764dee..b2e6e2a7 100644
|
|
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
@@ -105,14 +105,14 @@ public abstract class MobSpawnerAbstract {
|
|
|
|
// Paper start
|
|
EntityTypes entityType = optional.get();
|
|
- String key = entityType.getKey().getKey();
|
|
+ String key = EntityTypes.getName(entityType).getKey();
|
|
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(
|
|
MCUtil.toLocation(world, d3, d4, d5),
|
|
type,
|
|
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
|
|
+ MCUtil.toLocation(world, blockposition)
|
|
);
|
|
if (!event.callEvent()) {
|
|
flag = true;
|
|
--
|
|
2.20.1
|
|
|