mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-05 22:52:13 -07:00
Updated Upstream (Bukkit/CraftBukkit), deprecate SentientNPC API
Upstream has added the equivalent of our SentientNPC API, with exception to the EnderDragon. We've added Mob to the EnderDragon, and our SentientNPC API should behave the same. Vex#getOwner has been deprecated and a replacement Vex#getSummoner has been added using Mob. However, since 1.13 is not production ready, SentientNPC API is subject for removal in 1.13.1 since 1.13 API is not compatible with 1.12. Please move to the Mob interface ASAP. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: c5ab54d8 Expand GameRule API ab9a606c Improve entity hierarchy by adding Mob interface. CraftBukkit Changes:29e75648
Expand GameRule API50e6858b
Improve entity hierarchy by adding Mob interface.0e1d79b4
Correct error in previous patch
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..7e393254
|
||||
index 000000000..cb8de4629
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/entity/SentientNPC.java
|
||||
@@ -0,0 +0,0 @@
|
||||
@@ -43,112 +43,68 @@ index 00000000..7e393254
|
||||
+
|
||||
+package com.destroystokyo.paper.entity;
|
||||
+
|
||||
+import org.bukkit.entity.LivingEntity;
|
||||
+import org.bukkit.entity.Mob;
|
||||
+
|
||||
+
|
||||
+/**
|
||||
+ * Used to determine ACTUAL Living NPC's. Spigot mistakenly inversed the conditions for LivingEntity, and
|
||||
+ * used LivingEntity for Insentient Entities, and named the actual EntityLiving class EntityInsentient.
|
||||
+ *
|
||||
+ * This should of all been inversed on the implementation side. To make matters worse, Spigot never
|
||||
+ * exposed the differentiator that there are entities with AI that are not sentient/alive such as
|
||||
+ * Armor stands and Players are the only things that do not implement the REAL EntityLiving class (named Insentient internally)
|
||||
+ *
|
||||
+ * This interface lets you identify NPC entities capable of sentience, and able to move about and react to the world.
|
||||
+ * @deprecated Upstream has added this API. Use {@link Mob}. Will be removed in 1.13.1
|
||||
+ */
|
||||
+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();
|
||||
+@Deprecated
|
||||
+public interface SentientNPC extends Mob {
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Ambient.java b/src/main/java/org/bukkit/entity/Ambient.java
|
||||
index 779e3897..ef548fb4 100644
|
||||
index 613830a74..4ad71c825 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Ambient.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Ambient.java
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.entity;
|
||||
/**
|
||||
* Represents an ambient mob
|
||||
*/
|
||||
-public interface Ambient extends LivingEntity {}
|
||||
+public interface Ambient extends LivingEntity, com.destroystokyo.paper.entity.SentientNPC { // Paper
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/ComplexLivingEntity.java b/src/main/java/org/bukkit/entity/ComplexLivingEntity.java
|
||||
index f74411c3..1f00923e 100644
|
||||
--- a/src/main/java/org/bukkit/entity/ComplexLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/ComplexLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ import java.util.Set;
|
||||
* Represents a complex living entity - one that is made up of various smaller
|
||||
* parts
|
||||
*/
|
||||
-public interface ComplexLivingEntity extends LivingEntity {
|
||||
+public interface ComplexLivingEntity extends LivingEntity, com.destroystokyo.paper.entity.SentientNPC { // Paper
|
||||
/**
|
||||
* Gets a list of parts that belong to this complex entity
|
||||
*
|
||||
-public interface Ambient extends Mob {}
|
||||
+public interface Ambient extends Mob, com.destroystokyo.paper.entity.SentientNPC {} // Paper {}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Creature.java b/src/main/java/org/bukkit/entity/Creature.java
|
||||
index f223f55b..bbfb248e 100644
|
||||
index 6c9c5e85e..c796c4dc2 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;
|
||||
* Represents a Creature. Creatures are non-intelligent monsters or animals
|
||||
* which have very simple abilities.
|
||||
*/
|
||||
-public interface Creature extends LivingEntity {
|
||||
+public interface Creature extends LivingEntity, com.destroystokyo.paper.entity.SentientNPC { // Paper
|
||||
-public interface Creature extends Mob {}
|
||||
+public interface Creature extends Mob, com.destroystokyo.paper.entity.SentientNPC {} // Paper
|
||||
diff --git a/src/main/java/org/bukkit/entity/EnderDragon.java b/src/main/java/org/bukkit/entity/EnderDragon.java
|
||||
index 4ea0e44e7..8f200e6c4 100644
|
||||
--- a/src/main/java/org/bukkit/entity/EnderDragon.java
|
||||
+++ b/src/main/java/org/bukkit/entity/EnderDragon.java
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.entity;
|
||||
/**
|
||||
* Represents an Ender Dragon
|
||||
*/
|
||||
-public interface EnderDragon extends ComplexLivingEntity {
|
||||
+public interface EnderDragon extends ComplexLivingEntity, com.destroystokyo.paper.entity.SentientNPC { // Paper
|
||||
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
* Represents a phase or action that an Ender Dragon can perform.
|
||||
diff --git a/src/main/java/org/bukkit/entity/Flying.java b/src/main/java/org/bukkit/entity/Flying.java
|
||||
index 4f16a26c..207e9922 100644
|
||||
index 580ce18bf..45840ee1f 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Flying.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Flying.java
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.entity;
|
||||
/**
|
||||
* Represents a Flying Entity.
|
||||
*/
|
||||
-public interface Flying extends LivingEntity {}
|
||||
+public interface Flying extends LivingEntity, com.destroystokyo.paper.entity.SentientNPC { // Paper
|
||||
+
|
||||
+}
|
||||
-public interface Flying extends Mob {}
|
||||
+public interface Flying extends Mob, com.destroystokyo.paper.entity.SentientNPC {} // Paper
|
||||
diff --git a/src/main/java/org/bukkit/entity/Slime.java b/src/main/java/org/bukkit/entity/Slime.java
|
||||
index 0d87d203..d4eee19c 100644
|
||||
index 1119e26e2..46d03d29d 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Slime.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Slime.java
|
||||
@@ -0,0 +0,0 @@ package org.bukkit.entity;
|
||||
/**
|
||||
* Represents a Slime.
|
||||
*/
|
||||
-public interface Slime extends LivingEntity {
|
||||
+public interface Slime extends LivingEntity, com.destroystokyo.paper.entity.SentientNPC { // Paper
|
||||
-public interface Slime extends Mob {
|
||||
+public interface Slime extends Mob, com.destroystokyo.paper.entity.SentientNPC { // Paper
|
||||
|
||||
/**
|
||||
* @return The size of the slime
|
||||
|
Reference in New Issue
Block a user