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 API 50e6858b 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
|
||||
|
||||
@@ -10,7 +10,7 @@ This adds a new Builder API which is much friendlier to use.
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/ParticleBuilder.java b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
|
||||
new file mode 100644
|
||||
index 00000000..2bccc409
|
||||
index 000000000..2bccc4098
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/com/destroystokyo/paper/ParticleBuilder.java
|
||||
@@ -0,0 +0,0 @@
|
||||
@@ -380,7 +380,7 @@ index 00000000..2bccc409
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java
|
||||
index 4d0acaf5..0ae85d85 100644
|
||||
index 4d0acaf5b..0ae85d855 100644
|
||||
--- a/src/main/java/org/bukkit/Particle.java
|
||||
+++ b/src/main/java/org/bukkit/Particle.java
|
||||
@@ -0,0 +0,0 @@ public enum Particle {
|
||||
@@ -410,7 +410,7 @@ index 4d0acaf5..0ae85d85 100644
|
||||
* Options which can be applied to redstone dust particles - a particle
|
||||
* color and size.
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 49d2cc45..fd3a63fa 100644
|
||||
index cf5bd1540..a7964fb1e 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
||||
|
||||
@@ -6,7 +6,7 @@ Subject: [PATCH] Fix upstream javadoc warnings and errors
|
||||
Upstream still refuses to use Java 8 with the API so they are likely unaware these are even issues.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/NamespacedKey.java b/src/main/java/org/bukkit/NamespacedKey.java
|
||||
index 43239f84..fe8d3468 100644
|
||||
index 43239f844..fe8d34685 100644
|
||||
--- a/src/main/java/org/bukkit/NamespacedKey.java
|
||||
+++ b/src/main/java/org/bukkit/NamespacedKey.java
|
||||
@@ -0,0 +0,0 @@ public final class NamespacedKey {
|
||||
@@ -21,7 +21,7 @@ index 43239f84..fe8d3468 100644
|
||||
*/
|
||||
@Deprecated
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index d461c382..4e07af2e 100644
|
||||
index e2559c024..9f3d805c2 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
||||
@@ -73,7 +73,7 @@ index d461c382..4e07af2e 100644
|
||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/AbstractHorse.java b/src/main/java/org/bukkit/entity/AbstractHorse.java
|
||||
index 10757454..6d5410ea 100644
|
||||
index 107574546..6d5410eab 100644
|
||||
--- a/src/main/java/org/bukkit/entity/AbstractHorse.java
|
||||
+++ b/src/main/java/org/bukkit/entity/AbstractHorse.java
|
||||
@@ -0,0 +0,0 @@ public interface AbstractHorse extends Animals, Vehicle, InventoryHolder, Tameab
|
||||
@@ -86,7 +86,7 @@ index 10757454..6d5410ea 100644
|
||||
*/
|
||||
@Deprecated
|
||||
diff --git a/src/main/java/org/bukkit/entity/Guardian.java b/src/main/java/org/bukkit/entity/Guardian.java
|
||||
index 98af0563..ec6890ae 100644
|
||||
index 98af0563c..ec6890ae6 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Guardian.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Guardian.java
|
||||
@@ -0,0 +0,0 @@ public interface Guardian extends Monster {
|
||||
@@ -99,7 +99,7 @@ index 98af0563..ec6890ae 100644
|
||||
*/
|
||||
@Deprecated
|
||||
diff --git a/src/main/java/org/bukkit/entity/Horse.java b/src/main/java/org/bukkit/entity/Horse.java
|
||||
index cfce8fa5..8660070b 100644
|
||||
index cfce8fa57..8660070bb 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Horse.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Horse.java
|
||||
@@ -0,0 +0,0 @@ public interface Horse extends AbstractHorse {
|
||||
@@ -112,7 +112,7 @@ index cfce8fa5..8660070b 100644
|
||||
*/
|
||||
@Deprecated
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 98c6039b..7c008237 100644
|
||||
index 98c6039b9..7c008237a 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -0,0 +0,0 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
|
||||
@@ -205,7 +205,7 @@ index 98c6039b..7c008237 100644
|
||||
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data);
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
index 2a02ab85..e33d00b3 100644
|
||||
index 2a02ab855..e33d00b30 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
|
||||
@@ -0,0 +0,0 @@ public interface Skeleton extends Monster {
|
||||
@@ -217,7 +217,7 @@ index 2a02ab85..e33d00b3 100644
|
||||
*/
|
||||
@Deprecated
|
||||
diff --git a/src/main/java/org/bukkit/entity/Zombie.java b/src/main/java/org/bukkit/entity/Zombie.java
|
||||
index cf53ea22..62923379 100644
|
||||
index cf53ea22f..629233796 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Zombie.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Zombie.java
|
||||
@@ -0,0 +0,0 @@ public interface Zombie extends Monster {
|
||||
@@ -238,7 +238,7 @@ index cf53ea22..62923379 100644
|
||||
*/
|
||||
@Deprecated
|
||||
diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
|
||||
index de4fb37f..f1de2af6 100644
|
||||
index de4fb37f3..f1de2af6e 100644
|
||||
--- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
|
||||
+++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java
|
||||
@@ -0,0 +0,0 @@ public class PlayerLoginEvent extends PlayerEvent {
|
||||
@@ -258,7 +258,7 @@ index de4fb37f..f1de2af6 100644
|
||||
public PlayerLoginEvent(final Player player, String hostname, final InetAddress address, final Result result, final String message, final InetAddress realAddress) { // Spigot
|
||||
this(player, hostname, address, realAddress); // Spigot
|
||||
diff --git a/src/main/java/org/bukkit/inventory/Merchant.java b/src/main/java/org/bukkit/inventory/Merchant.java
|
||||
index c8e68570..45431b36 100644
|
||||
index c8e68570f..45431b360 100644
|
||||
--- a/src/main/java/org/bukkit/inventory/Merchant.java
|
||||
+++ b/src/main/java/org/bukkit/inventory/Merchant.java
|
||||
@@ -0,0 +0,0 @@ public interface Merchant {
|
||||
@@ -280,7 +280,7 @@ index c8e68570..45431b36 100644
|
||||
void setRecipe(int i, MerchantRecipe recipe) throws IndexOutOfBoundsException;
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/potion/Potion.java b/src/main/java/org/bukkit/potion/Potion.java
|
||||
index 1413b361..b4a8051c 100644
|
||||
index 1413b361b..b4a8051cc 100644
|
||||
--- a/src/main/java/org/bukkit/potion/Potion.java
|
||||
+++ b/src/main/java/org/bukkit/potion/Potion.java
|
||||
@@ -0,0 +0,0 @@ public class Potion {
|
||||
@@ -292,7 +292,7 @@ index 1413b361..b4a8051c 100644
|
||||
*/
|
||||
@Deprecated
|
||||
diff --git a/src/main/java/org/bukkit/potion/PotionBrewer.java b/src/main/java/org/bukkit/potion/PotionBrewer.java
|
||||
index 40f8d12b..33d19228 100644
|
||||
index 40f8d12b9..33d192287 100644
|
||||
--- a/src/main/java/org/bukkit/potion/PotionBrewer.java
|
||||
+++ b/src/main/java/org/bukkit/potion/PotionBrewer.java
|
||||
@@ -0,0 +0,0 @@ public interface PotionBrewer {
|
||||
@@ -305,7 +305,7 @@ index 40f8d12b..33d19228 100644
|
||||
*/
|
||||
public Collection<PotionEffect> getEffects(PotionType type, boolean upgraded, boolean extended);
|
||||
diff --git a/src/main/java/org/bukkit/potion/PotionType.java b/src/main/java/org/bukkit/potion/PotionType.java
|
||||
index 034421a7..f1a54c23 100644
|
||||
index 034421a76..f1a54c23c 100644
|
||||
--- a/src/main/java/org/bukkit/potion/PotionType.java
|
||||
+++ b/src/main/java/org/bukkit/potion/PotionType.java
|
||||
@@ -0,0 +0,0 @@ public enum PotionType {
|
||||
@@ -335,7 +335,7 @@ index 034421a7..f1a54c23 100644
|
||||
*/
|
||||
@Deprecated
|
||||
diff --git a/src/main/java/org/bukkit/scoreboard/Team.java b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
index ab71f3c3..358ea386 100644
|
||||
index ab71f3c31..358ea386b 100644
|
||||
--- a/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
+++ b/src/main/java/org/bukkit/scoreboard/Team.java
|
||||
@@ -0,0 +0,0 @@ public interface Team {
|
||||
|
||||
20
Spigot-API-Patches/Make-EnderDragon-extend-Mob.patch
Normal file
20
Spigot-API-Patches/Make-EnderDragon-extend-Mob.patch
Normal file
@@ -0,0 +1,20 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 10 Aug 2018 22:08:34 -0400
|
||||
Subject: [PATCH] Make EnderDragon extend Mob
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/EnderDragon.java b/src/main/java/org/bukkit/entity/EnderDragon.java
|
||||
index 8f200e6c4..dad0b3141 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, com.destroystokyo.paper.entity.SentientNPC { // Paper
|
||||
+public interface EnderDragon extends ComplexLivingEntity, com.destroystokyo.paper.entity.SentientNPC, org.bukkit.entity.Mob { // Paper - add Mob
|
||||
|
||||
/**
|
||||
* Represents a phase or action that an Ender Dragon can perform.
|
||||
--
|
||||
@@ -1,12 +1,12 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Wed, 4 Jul 2018 15:29:21 -0400
|
||||
Subject: [PATCH] Vex#getOwner API
|
||||
Subject: [PATCH] Vex#getSummoner API
|
||||
|
||||
Get's the NPC that summoned this Vex
|
||||
Get's the Mob that summoned this Vex
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/Vex.java b/src/main/java/org/bukkit/entity/Vex.java
|
||||
index a2f2fcae..540135c3 100644
|
||||
index a2f2fcaec..734683763 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Vex.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Vex.java
|
||||
@@ -0,0 +0,0 @@
|
||||
@@ -21,7 +21,12 @@ index a2f2fcae..540135c3 100644
|
||||
+public interface Vex extends Monster {
|
||||
+ /**
|
||||
+ * @return What Entity (most likely an Evoker, but not guaranteed) summoned this Vex
|
||||
+ * @deprecated Use {@link #getSummoner()}
|
||||
+ */
|
||||
+ SentientNPC getOwner(); // Paper
|
||||
+ @Deprecated
|
||||
+ default SentientNPC getOwner() { return (SentientNPC) getSummoner(); } // Paper
|
||||
+
|
||||
+ Mob getSummoner(); // Paper
|
||||
+
|
||||
+}
|
||||
--
|
||||
Reference in New Issue
Block a user