mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 12:42:05 -07:00
Add Critical missing Bukkit API - setTarget/getTarget moved down to SentientNPC
This fixes a CRITICAL missing part of the Bukkit API due to mistakes on upstream refusing to implement the Sentient NPC baseclass of all NPC's. Until now, the Bukkit API has not provided a way for accessing and setting a non creature entities target. Although Flying, Slime, Ambient, and Water mobs all supported targets internally, you were unable to get/set it. Now with the SentientNPC API and these API's moved down, every sentient NPC has access to target data.
This commit is contained in:
@@ -14,7 +14,7 @@ This interface lets you identify NPC entities capable of sentience, and able to
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/entity/SentientNPC.java b/src/main/java/com/destroystokyo/paper/entity/SentientNPC.java
|
||||
new file mode 100644
|
||||
index 00000000..231e8af1
|
||||
index 00000000..7e393254
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/SentientNPC.java
|
||||
@@ -0,0 +0,0 @@
|
||||
@@ -56,6 +56,24 @@ index 00000000..231e8af1
|
||||
+ * This interface lets you identify NPC entities capable of sentience, and able to move about and react to the world.
|
||||
+ */
|
||||
+public interface SentientNPC extends LivingEntity {
|
||||
+
|
||||
+ /**
|
||||
+ * Instructs this Creature to set the specified LivingEntity as its
|
||||
+ * target.
|
||||
+ * <p>
|
||||
+ * Hostile creatures may attack their target, and friendly creatures may
|
||||
+ * follow their target.
|
||||
+ *
|
||||
+ * @param target New LivingEntity to target, or null to clear the target
|
||||
+ */
|
||||
+ public void setTarget(LivingEntity target);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets the current target of this Creature
|
||||
+ *
|
||||
+ * @return Current target of this creature, or null if none exists
|
||||
+ */
|
||||
+ public LivingEntity getTarget();
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Ambient.java b/src/main/java/org/bukkit/entity/Ambient.java
|
||||
index 779e3897..ef548fb4 100644
|
||||
@@ -82,7 +100,7 @@ index f74411c3..1f00923e 100644
|
||||
* Gets a list of parts that belong to this complex entity
|
||||
*
|
||||
diff --git a/src/main/java/org/bukkit/entity/Creature.java b/src/main/java/org/bukkit/entity/Creature.java
|
||||
index f223f55b..77cbefcb 100644
|
||||
index f223f55b..bbfb248e 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Creature.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Creature.java
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.entity;
|
||||
@@ -94,6 +112,21 @@ index f223f55b..77cbefcb 100644
|
||||
|
||||
/**
|
||||
* Instructs this Creature to set the specified LivingEntity as its
|
||||
@@ -0,0 +0,0 @@ public interface Creature extends LivingEntity {
|
||||
*
|
||||
* @param target New LivingEntity to target, or null to clear the target
|
||||
*/
|
||||
- public void setTarget(LivingEntity target);
|
||||
+ //public void setTarget(LivingEntity target); // Paper - moved to SentientNPC
|
||||
|
||||
/**
|
||||
* Gets the current target of this Creature
|
||||
*
|
||||
* @return Current target of this creature, or null if none exists
|
||||
*/
|
||||
- public LivingEntity getTarget();
|
||||
+ //public LivingEntity getTarget(); // Paper - moved to SentientNPC
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Flying.java b/src/main/java/org/bukkit/entity/Flying.java
|
||||
index 4f16a26c..207e9922 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Flying.java
|
||||
|
Reference in New Issue
Block a user