Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-21 05:50:05 +01:00
30 Zeilen
1.7 KiB
Diff
30 Zeilen
1.7 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 ac572eba10a7239d71dfae060f623b076d4252ce..1ce675d0d24ceb5724f5ac2d8f671e38f2735f74 100644
|
||
|
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||
|
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
||
|
@@ -132,11 +132,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(
|
||
|
MCUtil.toLocation(world, d3, d4, d5),
|
||
|
type,
|
||
|
- org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER
|
||
|
+ MCUtil.toLocation(world, blockposition)
|
||
|
);
|
||
|
if (!event.callEvent()) {
|
||
|
flag = true;
|