mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 11:27:35 +01:00
36f34f01c0
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: da9ef3c5 #496: Add methods to get/set ItemStacks in EquipmentSlots 3abebc9f #492: Let Tameable extend Animals rather than Entity 941111a0 #495: Expose ItemStack and hand used in PlayerShearEntityEvent 4fe19cae #494: InventoryView - Add missing Brewing FUEL_TIME CraftBukkit Changes:933e9094
#664: Add methods to get/set ItemStacks in EquipmentSlots18722312
#662: Expose ItemStack and hand used in PlayerShearEntityEvent
72 lines
2.3 KiB
Diff
72 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..9022f697ab244df43074e48c9150f39d44217531
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/event/entity/PhantomPreSpawnEvent.java
|
|
@@ -0,0 +1,31 @@
|
|
+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 org.jetbrains.annotations.NotNull;
|
|
+import org.jetbrains.annotations.Nullable;
|
|
+
|
|
+
|
|
+/**
|
|
+ * Called when a phantom is spawned for an exhausted player
|
|
+ */
|
|
+public class PhantomPreSpawnEvent extends PreCreatureSpawnEvent {
|
|
+ @NotNull private final Entity entity;
|
|
+
|
|
+ public PhantomPreSpawnEvent(@NotNull Location location, @NotNull Entity entity, @NotNull 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 1a1044edc57078f96c4a95c994d0865da382c152..ed4d417c2deefb78807cb61b01df5afcd334d754 100644
|
|
--- a/src/main/java/org/bukkit/entity/Phantom.java
|
|
+++ b/src/main/java/org/bukkit/entity/Phantom.java
|
|
@@ -1,5 +1,8 @@
|
|
package org.bukkit.entity;
|
|
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+import org.jetbrains.annotations.Nullable;
|
|
+
|
|
/**
|
|
* Represents a phantom.
|
|
*/
|
|
@@ -14,4 +17,14 @@ 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
|
|
+ */
|
|
+ @Nullable
|
|
+ public java.util.UUID getSpawningEntity();
|
|
+ // Paper end
|
|
}
|