2018-08-17 06:10:45 +02:00
|
|
|
From 38a264062d9f7e239ee60eff8bd198197e8b77e8 Mon Sep 17 00:00:00 2001
|
2018-06-27 04:08:01 +02:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Tue, 26 Jun 2018 21:34:40 -0400
|
|
|
|
Subject: [PATCH] RangedEntity API
|
|
|
|
|
|
|
|
Allows you to determine if an entity is capable of ranged attacks,
|
|
|
|
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
|
2018-08-16 13:20:58 +02:00
|
|
|
index 000000000..ded25f214
|
2018-06-27 04:08:01 +02:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java
|
2018-08-16 13:20:58 +02:00
|
|
|
@@ -0,0 +1,29 @@
|
2018-06-27 04:08:01 +02:00
|
|
|
+package com.destroystokyo.paper.entity;
|
|
|
|
+
|
|
|
|
+import org.bukkit.entity.LivingEntity;
|
|
|
|
+
|
|
|
|
+public interface RangedEntity extends SentientNPC {
|
|
|
|
+ /**
|
|
|
|
+ * Attack the specified entity using a ranged attack.
|
|
|
|
+ *
|
2018-08-16 13:20:58 +02:00
|
|
|
+ * @param target the entity to target
|
2018-06-27 04:08:01 +02:00
|
|
|
+ * @param charge How "charged" the attack is (how far back the bow was pulled for Bow attacks).
|
|
|
|
+ * This should be a value between 0 and 1, represented as targetDistance/maxDistance.
|
|
|
|
+ */
|
|
|
|
+ void rangedAttack(LivingEntity target, float charge);
|
|
|
|
+
|
|
|
|
+ /**
|
2018-06-29 06:55:29 +02:00
|
|
|
+ * 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 raiseHands);
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Alias to {@link LivingEntity#isHandRaised()}, if the entity is charging an attack
|
|
|
|
+ * @return If entities hands are raised
|
2018-06-27 04:08:01 +02:00
|
|
|
+ */
|
2018-06-29 06:55:29 +02:00
|
|
|
+ default boolean isChargingAttack() {
|
|
|
|
+ return isHandRaised();
|
|
|
|
+ }
|
2018-06-27 04:08:01 +02:00
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Illusioner.java b/src/main/java/org/bukkit/entity/Illusioner.java
|
2018-08-16 13:20:58 +02:00
|
|
|
index 7c92c431b..14e6c5ee0 100644
|
2018-06-27 04:08:01 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Illusioner.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Illusioner.java
|
|
|
|
@@ -1,6 +1,10 @@
|
|
|
|
package org.bukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Represents an Illusioner "Illager".
|
|
|
|
*/
|
|
|
|
-public interface Illusioner extends Spellcaster { }
|
|
|
|
+public interface Illusioner extends Spellcaster, RangedEntity { // Paper
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Llama.java b/src/main/java/org/bukkit/entity/Llama.java
|
2018-08-16 13:20:58 +02:00
|
|
|
index 9422d56cd..92c30ed5a 100644
|
2018-06-27 04:08:01 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Llama.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Llama.java
|
|
|
|
@@ -1,11 +1,12 @@
|
|
|
|
package org.bukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
|
|
import org.bukkit.inventory.LlamaInventory;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents a Llama.
|
|
|
|
*/
|
|
|
|
-public interface Llama extends ChestedHorse {
|
|
|
|
+public interface Llama extends ChestedHorse, RangedEntity { // Paper
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Represents the base color that the llama has.
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java
|
2018-08-16 13:20:58 +02:00
|
|
|
index e33d00b30..40157befd 100644
|
2018-06-27 04:08:01 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Skeleton.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
|
|
|
|
@@ -1,9 +1,11 @@
|
|
|
|
package org.bukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Represents a Skeleton.
|
|
|
|
*/
|
|
|
|
-public interface Skeleton extends Monster {
|
|
|
|
+public interface Skeleton extends Monster, RangedEntity { // Paper
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the current type of this skeleton.
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java
|
2018-08-16 13:20:58 +02:00
|
|
|
index 818efe2a4..10f8f6d45 100644
|
2018-06-27 04:08:01 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Snowman.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Snowman.java
|
|
|
|
@@ -1,9 +1,11 @@
|
|
|
|
package org.bukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Represents a snowman entity
|
|
|
|
*/
|
|
|
|
-public interface Snowman extends Golem {
|
|
|
|
+public interface Snowman extends Golem, RangedEntity { // Paper
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets whether this snowman is in "derp mode", meaning it is not wearing a
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Witch.java b/src/main/java/org/bukkit/entity/Witch.java
|
2018-08-16 13:20:58 +02:00
|
|
|
index 9c5dc1f97..4b27f6890 100644
|
2018-06-27 04:08:01 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Witch.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Witch.java
|
|
|
|
@@ -1,7 +1,9 @@
|
|
|
|
package org.bukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Represents a Witch
|
|
|
|
*/
|
|
|
|
-public interface Witch extends Monster {
|
|
|
|
+public interface Witch extends Monster, RangedEntity { // Paper
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
|
2018-08-16 13:20:58 +02:00
|
|
|
index 0922c5c6a..c550ed061 100644
|
2018-06-27 04:08:01 +02:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Wither.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Wither.java
|
|
|
|
@@ -1,7 +1,9 @@
|
|
|
|
package org.bukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
|
|
+
|
|
|
|
/**
|
|
|
|
* Represents a Wither boss
|
|
|
|
*/
|
|
|
|
-public interface Wither extends Monster {
|
|
|
|
+public interface Wither extends Monster, RangedEntity { // Paper
|
|
|
|
}
|
|
|
|
--
|
|
|
|
2.18.0
|
|
|
|
|