2018-08-11 02:13:00 +00:00
|
|
|
From 271f251dfa394ddcfa8ff6364ab1eeabfc84aa89 Mon Sep 17 00:00:00 2001
|
2018-06-16 18:01:01 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Sat, 16 Jun 2018 13:41:00 -0400
|
|
|
|
Subject: [PATCH] Add SentientNPC Interface to Entities
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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
|
2018-08-11 02:13:00 +00:00
|
|
|
index 000000000..cb8de4629
|
2018-06-16 18:01:01 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/entity/SentientNPC.java
|
2018-08-11 02:13:00 +00:00
|
|
|
@@ -0,0 +1,34 @@
|
2018-06-16 18:01:01 +00:00
|
|
|
+/*
|
|
|
|
+ * Copyright (c) 2018 Daniel Ennis (Aikar) MIT License
|
|
|
|
+ *
|
|
|
|
+ * Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
+ * a copy of this software and associated documentation files (the
|
|
|
|
+ * "Software"), to deal in the Software without restriction, including
|
|
|
|
+ * without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
+ * distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
+ * permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
+ * the following conditions:
|
|
|
|
+ *
|
|
|
|
+ * The above copyright notice and this permission notice shall be
|
|
|
|
+ * included in all copies or substantial portions of the Software.
|
|
|
|
+ *
|
|
|
|
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+package com.destroystokyo.paper.entity;
|
|
|
|
+
|
2018-08-11 02:13:00 +00:00
|
|
|
+import org.bukkit.entity.Mob;
|
|
|
|
+
|
2018-06-16 18:28:13 +00:00
|
|
|
+
|
2018-06-16 18:01:01 +00:00
|
|
|
+/**
|
2018-08-11 02:13:00 +00:00
|
|
|
+ * @deprecated Upstream has added this API. Use {@link Mob}. Will be removed in 1.13.1
|
2018-06-16 18:01:01 +00:00
|
|
|
+ */
|
2018-08-11 02:13:00 +00:00
|
|
|
+@Deprecated
|
|
|
|
+public interface SentientNPC extends Mob {
|
2018-06-16 18:01:01 +00:00
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Ambient.java b/src/main/java/org/bukkit/entity/Ambient.java
|
2018-08-11 02:13:00 +00:00
|
|
|
index 613830a74..4ad71c825 100644
|
2018-06-16 18:01:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Ambient.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Ambient.java
|
2018-08-11 02:13:00 +00:00
|
|
|
@@ -3,4 +3,4 @@ package org.bukkit.entity;
|
2018-06-16 18:01:01 +00:00
|
|
|
/**
|
|
|
|
* Represents an ambient mob
|
|
|
|
*/
|
2018-08-11 02:13:00 +00:00
|
|
|
-public interface Ambient extends Mob {}
|
|
|
|
+public interface Ambient extends Mob, com.destroystokyo.paper.entity.SentientNPC {} // Paper {}
|
2018-06-16 18:01:01 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Creature.java b/src/main/java/org/bukkit/entity/Creature.java
|
2018-08-11 02:13:00 +00:00
|
|
|
index 6c9c5e85e..c796c4dc2 100644
|
2018-06-16 18:01:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Creature.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Creature.java
|
2018-08-11 02:13:00 +00:00
|
|
|
@@ -4,4 +4,4 @@ package org.bukkit.entity;
|
2018-06-16 18:01:01 +00:00
|
|
|
* Represents a Creature. Creatures are non-intelligent monsters or animals
|
|
|
|
* which have very simple abilities.
|
|
|
|
*/
|
2018-08-11 02:13:00 +00:00
|
|
|
-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
|
|
|
|
@@ -3,7 +3,7 @@ package org.bukkit.entity;
|
|
|
|
/**
|
|
|
|
* Represents an Ender Dragon
|
|
|
|
*/
|
|
|
|
-public interface EnderDragon extends ComplexLivingEntity {
|
|
|
|
+public interface EnderDragon extends ComplexLivingEntity, com.destroystokyo.paper.entity.SentientNPC { // Paper
|
2018-07-02 02:07:35 +00:00
|
|
|
|
|
|
|
/**
|
2018-08-11 02:13:00 +00:00
|
|
|
* Represents a phase or action that an Ender Dragon can perform.
|
2018-06-16 18:01:01 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Flying.java b/src/main/java/org/bukkit/entity/Flying.java
|
2018-08-11 02:13:00 +00:00
|
|
|
index 580ce18bf..45840ee1f 100644
|
2018-06-16 18:01:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Flying.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Flying.java
|
2018-08-11 02:13:00 +00:00
|
|
|
@@ -3,4 +3,4 @@ package org.bukkit.entity;
|
2018-06-16 18:01:01 +00:00
|
|
|
/**
|
|
|
|
* Represents a Flying Entity.
|
|
|
|
*/
|
2018-08-11 02:13:00 +00:00
|
|
|
-public interface Flying extends Mob {}
|
|
|
|
+public interface Flying extends Mob, com.destroystokyo.paper.entity.SentientNPC {} // Paper
|
2018-06-16 18:01:01 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Slime.java b/src/main/java/org/bukkit/entity/Slime.java
|
2018-08-11 02:13:00 +00:00
|
|
|
index 1119e26e2..46d03d29d 100644
|
2018-06-16 18:01:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Slime.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Slime.java
|
|
|
|
@@ -3,7 +3,7 @@ package org.bukkit.entity;
|
|
|
|
/**
|
|
|
|
* Represents a Slime.
|
|
|
|
*/
|
2018-08-11 02:13:00 +00:00
|
|
|
-public interface Slime extends Mob {
|
|
|
|
+public interface Slime extends Mob, com.destroystokyo.paper.entity.SentientNPC { // Paper
|
2018-06-16 18:01:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return The size of the slime
|
|
|
|
--
|
2018-07-02 02:07:35 +00:00
|
|
|
2.18.0
|
2018-06-16 18:01:01 +00:00
|
|
|
|