mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-26 12:36:07 +01:00
17b58d00d8
This was a useless exception wrapper that ends up making stack traces harder to read as well as the JVM cutting off the important parts Nothing catches this exception, so its safe to just get rid of it and let the REAL exception bubble down
47 lines
1.7 KiB
Diff
47 lines
1.7 KiB
Diff
From ee6aedc0ee7297256b3da0dcb2d1b3237617a0a1 Mon Sep 17 00:00:00 2001
|
|
From: Phoenix616 <mail@moep.tv>
|
|
Date: Tue, 18 Sep 2018 23:50:10 +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/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
|
|
new file mode 100644
|
|
index 00000000..d7221210
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PreSpawnerSpawnEvent.java
|
|
@@ -0,0 +1,27 @@
|
|
+package com.destroystokyo.paper.event.entity;
|
|
+
|
|
+
|
|
+import com.google.common.base.Preconditions;
|
|
+import org.bukkit.Location;
|
|
+import org.bukkit.entity.EntityType;
|
|
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
|
+
|
|
+/**
|
|
+ * Called before an entity is spawned into a world by a spawner.
|
|
+ *
|
|
+ * This only includes the spawner's location and not the full BlockState snapshot for performance reasons.
|
|
+ * If you really need it you have to get the spawner yourself.
|
|
+ */
|
|
+
|
|
+public class PreSpawnerSpawnEvent extends PreCreatureSpawnEvent {
|
|
+ private final Location spawnerLocation;
|
|
+
|
|
+ public PreSpawnerSpawnEvent(Location location, EntityType type, Location spawnerLocation) {
|
|
+ super(location, type, CreatureSpawnEvent.SpawnReason.SPAWNER);
|
|
+ this.spawnerLocation = Preconditions.checkNotNull(spawnerLocation, "Spawner location may not be null");
|
|
+ }
|
|
+
|
|
+ public Location getSpawnerLocation() {
|
|
+ return spawnerLocation;
|
|
+ }
|
|
+}
|
|
--
|
|
2.20.1
|
|
|