LivingEntity Hand Raised/Item Use API

How long an entity has raised hands to charge an attack or use an item

Also aliased isHandsRaised for isChargingAttack in RangedEntity
This commit is contained in:
Aikar
2018-06-29 00:55:29 -04:00
parent 278780623d
commit d9c9b9a3d2
10 changed files with 167 additions and 20 deletions

View File

@@ -8,7 +8,7 @@ and to perform an attack.
diff --git a/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java b/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java
new file mode 100644
index 00000000..5153efab
index 00000000..7b07f10c
--- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java
@@ -0,0 +0,0 @@
@@ -26,10 +26,19 @@ index 00000000..5153efab
+ void rangedAttack(LivingEntity target, float charge);
+
+ /**
+ * Sets that the Entity is "charging" up an attack, by raising its arms
+ * @param charging Whether the entities arms are raised to charge attack
+ * Sets that the Entity is "charging" up an attack, by raising its hands
+ *
+ * @param raiseHands Whether the entities hands are raised to charge attack
+ */
+ void setChargingAttack(boolean charging);
+ void setChargingAttack(boolean raiseHands);
+
+ /**
+ * Alias to {@link LivingEntity#isHandRaised()}, if the entity is charging an attack
+ * @return If entities hands are raised
+ */
+ default boolean isChargingAttack() {
+ return isHandRaised();
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Illusioner.java b/src/main/java/org/bukkit/entity/Illusioner.java
index 7c92c431..14e6c5ee 100644