Add PhantomSpawnEvent (#1375)
This commit is contained in:
parent
2d7e5dce25
commit
2d0c9eea98
3 changed files with 146 additions and 1 deletions
63
Spigot-API-Patches/0142-Add-PhantomPreSpawnEvent.patch
Normal file
63
Spigot-API-Patches/0142-Add-PhantomPreSpawnEvent.patch
Normal file
|
@ -0,0 +1,63 @@
|
|||
From 7afd89928f309b7d009f38af76e51235e65762ef Mon Sep 17 00:00:00 2001
|
||||
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
||||
Date: Sat, 25 Aug 2018 19:56:42 -0500
|
||||
Subject: [PATCH] Add PhantomPreSpawnEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
||||
new file mode 100644
|
||||
index 00000000..303a1ec9
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
||||
@@ -0,0 +1,30 @@
|
||||
+package com.destroystokyo.paper.event.entity;
|
||||
+
|
||||
+import org.bukkit.Location;
|
||||
+import org.bukkit.entity.Entity;
|
||||
+import org.bukkit.entity.EntityType;
|
||||
+import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
+
|
||||
+import javax.annotation.Nullable;
|
||||
+
|
||||
+/**
|
||||
+ * Called when a phantom is spawned for an exhausted player
|
||||
+ */
|
||||
+public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent {
|
||||
+ private final Entity entity;
|
||||
+
|
||||
+ public PhantomPreSpawnEvent(Location location, Entity entity, CreatureSpawnEvent.SpawnReason reason) {
|
||||
+ super(location, EntityType.PHANTOM, reason);
|
||||
+ this.entity = entity;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
+ * Get the entity this phantom is spawning for
|
||||
+ *
|
||||
+ * @return Entity
|
||||
+ */
|
||||
+ @Nullable
|
||||
+ public Entity getSpawningEntity() {
|
||||
+ return entity;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Phantom.java b/src/main/java/org/bukkit/entity/Phantom.java
|
||||
index 1a1044ed..65b703a2 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Phantom.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Phantom.java
|
||||
@@ -14,4 +14,13 @@ public interface Phantom extends Flying {
|
||||
* @param sz The new size of the phantom.
|
||||
*/
|
||||
public void setSize(int sz);
|
||||
+
|
||||
+ // Paper start
|
||||
+ /**
|
||||
+ * Get the UUID of the entity that caused this phantom to spawn
|
||||
+ *
|
||||
+ * @return UUID
|
||||
+ */
|
||||
+ public java.util.UUID getSpawningEntity();
|
||||
+ // Paper end
|
||||
}
|
||||
--
|
||||
2.18.0
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
From a924b59822d15436017aaa9ab10288a06f7e5263 Mon Sep 17 00:00:00 2001
|
||||
From 30d73a5a4ab4628f42ac527d63715e8e16d5dfbe Mon Sep 17 00:00:00 2001
|
||||
From: Sotr <i@omc.hk>
|
||||
Date: Thu, 23 Aug 2018 16:14:25 +0800
|
||||
Subject: [PATCH] Add source block to BlockPhysicsEvent
|
Loading…
Add table
Add a link
Reference in a new issue