mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 12:36:07 +01:00
afe633df08
* convert API tests to mockito * convert server tests to mockito * add co-author
30 lines
1.8 KiB
Diff
30 lines
1.8 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 64d1f0ed579ef6f6f2e24e795d8dd0e1bdb5f39d..eab8634dbf5bbb7eaa65e7e9a3d4a94a2d45ea2a 100644
|
|
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
|
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
|
@@ -134,11 +134,11 @@ public abstract class BaseSpawner {
|
|
|
|
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(
|
|
io.papermc.paper.util.MCUtil.toLocation(world, d0, d1, d2),
|
|
type,
|
|
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
|
|
+ io.papermc.paper.util.MCUtil.toLocation(world, pos)
|
|
);
|
|
if (!event.callEvent()) {
|
|
flag = true;
|