2019-04-23 04:47:07 +00:00
|
|
|
From b4ed810ded91c4e5d07423ad94e4ffc685a89257 Mon Sep 17 00:00:00 2001
|
2018-06-27 02:08:01 +00: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
|
2019-04-23 04:47:07 +00:00
|
|
|
index 00000000..f2e3233a
|
2018-06-27 02:08:01 +00:00
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -0,0 +1,31 @@
|
2018-06-27 02:08:01 +00:00
|
|
|
+package com.destroystokyo.paper.entity;
|
|
|
|
+
|
|
|
|
+import org.bukkit.entity.LivingEntity;
|
2018-08-26 18:11:49 +00:00
|
|
|
+import org.bukkit.entity.Mob;
|
2019-03-20 00:28:15 +00:00
|
|
|
+import org.jetbrains.annotations.NotNull;
|
2018-06-27 02:08:01 +00:00
|
|
|
+
|
2018-08-26 18:11:49 +00:00
|
|
|
+public interface RangedEntity extends Mob {
|
2018-06-27 02:08:01 +00:00
|
|
|
+ /**
|
|
|
|
+ * Attack the specified entity using a ranged attack.
|
|
|
|
+ *
|
2018-08-16 11:20:58 +00:00
|
|
|
+ * @param target the entity to target
|
2018-06-27 02:08:01 +00: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.
|
|
|
|
+ */
|
2019-03-20 00:28:15 +00:00
|
|
|
+ void rangedAttack(@NotNull LivingEntity target, float charge);
|
2018-06-27 02:08:01 +00:00
|
|
|
+
|
|
|
|
+ /**
|
2018-06-29 04:55:29 +00: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 02:08:01 +00:00
|
|
|
+ */
|
2018-06-29 04:55:29 +00:00
|
|
|
+ default boolean isChargingAttack() {
|
|
|
|
+ return isHandRaised();
|
|
|
|
+ }
|
2018-06-27 02:08:01 +00:00
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Illusioner.java b/src/main/java/org/bukkit/entity/Illusioner.java
|
2019-04-23 04:47:07 +00:00
|
|
|
index 7c92c431..14e6c5ee 100644
|
2018-06-27 02:08:01 +00: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
|
2019-04-23 04:47:07 +00:00
|
|
|
index c4385429..d23226cc 100644
|
2018-06-27 02:08:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Llama.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Llama.java
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -1,12 +1,13 @@
|
2018-06-27 02:08:01 +00:00
|
|
|
package org.bukkit.entity;
|
|
|
|
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
|
|
import org.bukkit.inventory.LlamaInventory;
|
2019-03-20 00:28:15 +00:00
|
|
|
import org.jetbrains.annotations.NotNull;
|
2018-06-27 02:08:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
2019-04-23 04:47:07 +00:00
|
|
|
index 2ac30c0f..d42a4e12 100644
|
2018-06-27 02:08:01 +00:00
|
|
|
--- a/src/main/java/org/bukkit/entity/Skeleton.java
|
|
|
|
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
|
2019-03-20 00:28:15 +00:00
|
|
|
@@ -2,11 +2,12 @@ package org.bukkit.entity;
|
2018-06-27 02:08:01 +00:00
|
|
|
|
2019-03-20 00:28:15 +00:00
|
|
|
import org.jetbrains.annotations.Contract;
|
|
|
|
import org.jetbrains.annotations.NotNull;
|
2018-06-27 02:08:01 +00:00
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
2019-03-20 00:28:15 +00:00
|
|
|
|
2018-06-27 02:08:01 +00:00
|
|
|
/**
|
|
|
|
* 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
|
2019-04-23 04:47:07 +00:00
|
|
|
index 818efe2a..10f8f6d4 100644
|
2018-06-27 02:08:01 +00: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
|
2019-04-23 04:47:07 +00:00
|
|
|
index b4343903..aa88aede 100644
|
2018-06-27 02:08:01 +00: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
|
|
|
|
*/
|
2019-04-23 04:47:07 +00:00
|
|
|
-public interface Witch extends Raider {
|
|
|
|
+public interface Witch extends Raider, RangedEntity { // Paper
|
2018-06-27 02:08:01 +00:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
|
2019-04-23 04:47:07 +00:00
|
|
|
index 3bc332ee..426d3693 100644
|
2018-06-27 02:08:01 +00: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
|
|
|
|
*/
|
2018-11-11 05:37:15 +00:00
|
|
|
-public interface Wither extends Monster, Boss {
|
|
|
|
+public interface Wither extends Monster, Boss, RangedEntity { // Paper
|
2018-06-27 02:08:01 +00:00
|
|
|
}
|
2019-04-23 04:47:07 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/inventory/ItemStack.java b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
|
|
index 72e268c1..76da06d1 100644
|
|
|
|
--- a/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
|
|
+++ b/src/main/java/org/bukkit/inventory/ItemStack.java
|
|
|
|
@@ -18,7 +18,7 @@ import org.jetbrains.annotations.NotNull;
|
|
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
|
|
|
|
/**
|
|
|
|
- * Represents a stack of items
|
|
|
|
+ * Represents a stack of item
|
|
|
|
*/
|
|
|
|
public class ItemStack implements Cloneable, ConfigurationSerializable {
|
|
|
|
private Material type = Material.AIR;
|
2018-06-27 02:08:01 +00:00
|
|
|
--
|
2019-03-20 00:28:15 +00:00
|
|
|
2.21.0
|
2018-06-27 02:08:01 +00:00
|
|
|
|