Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-15 02:50:09 +01:00
184 Zeilen
7.1 KiB
Diff
184 Zeilen
7.1 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 0000000000000000000000000000000000000000..f2e3233a3d1744e32fb76d3731b9858ef0067e30
|
|
--- /dev/null
|
|
+++ b/src/main/java/com/destroystokyo/paper/entity/RangedEntity.java
|
|
@@ -0,0 +1,31 @@
|
|
+package com.destroystokyo.paper.entity;
|
|
+
|
|
+import org.bukkit.entity.LivingEntity;
|
|
+import org.bukkit.entity.Mob;
|
|
+import org.jetbrains.annotations.NotNull;
|
|
+
|
|
+public interface RangedEntity extends Mob {
|
|
+ /**
|
|
+ * Attack the specified entity using a ranged attack.
|
|
+ *
|
|
+ * @param target the entity to target
|
|
+ * @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(@NotNull LivingEntity target, float charge);
|
|
+
|
|
+ /**
|
|
+ * 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
|
|
+ */
|
|
+ default boolean isChargingAttack() {
|
|
+ return isHandRaised();
|
|
+ }
|
|
+}
|
|
diff --git a/src/main/java/org/bukkit/entity/Drowned.java b/src/main/java/org/bukkit/entity/Drowned.java
|
|
index 1dee177ae6e21da000607dc8dd8fd76857f323b9..8d1ad9ef757cb1e8d72b145262df73612a76c746 100644
|
|
--- a/src/main/java/org/bukkit/entity/Drowned.java
|
|
+++ b/src/main/java/org/bukkit/entity/Drowned.java
|
|
@@ -1,6 +1,8 @@
|
|
package org.bukkit.entity;
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
+
|
|
/**
|
|
* Drowned zombie.
|
|
*/
|
|
-public interface Drowned extends Zombie { }
|
|
+public interface Drowned extends Zombie, RangedEntity { } // Paper
|
|
diff --git a/src/main/java/org/bukkit/entity/Illusioner.java b/src/main/java/org/bukkit/entity/Illusioner.java
|
|
index 7c92c431b32754dca12b4d584bd6fa93ff73badf..14e6c5ee06ece3d1bbc1239afa67c847a479948f 100644
|
|
--- 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
|
|
index c43854298548391679c1d280bd42edbeed7759b9..d23226ccb0f6c25028f000ce31346cd0a8898e6a 100644
|
|
--- a/src/main/java/org/bukkit/entity/Llama.java
|
|
+++ b/src/main/java/org/bukkit/entity/Llama.java
|
|
@@ -1,12 +1,13 @@
|
|
package org.bukkit.entity;
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity;
|
|
import org.bukkit.inventory.LlamaInventory;
|
|
import org.jetbrains.annotations.NotNull;
|
|
|
|
/**
|
|
* 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/Piglin.java b/src/main/java/org/bukkit/entity/Piglin.java
|
|
index b96e57552245e2c6d452755d4227c572266fcec7..6fdc0e0bb62189dbf3cf9ce7a87b7fbb995956a3 100644
|
|
--- a/src/main/java/org/bukkit/entity/Piglin.java
|
|
+++ b/src/main/java/org/bukkit/entity/Piglin.java
|
|
@@ -8,7 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
|
/**
|
|
* Represents a Piglin.
|
|
*/
|
|
-public interface Piglin extends PiglinAbstract, InventoryHolder {
|
|
+public interface Piglin extends PiglinAbstract, InventoryHolder, com.destroystokyo.paper.entity.RangedEntity { // Paper
|
|
|
|
/**
|
|
* Get whether the piglin is able to hunt hoglins.
|
|
diff --git a/src/main/java/org/bukkit/entity/Pillager.java b/src/main/java/org/bukkit/entity/Pillager.java
|
|
index 9a2252fef56be1ed3ae2169aea46cb567e965c6c..11f38187fca830d974be01fea2966a31936184cb 100644
|
|
--- a/src/main/java/org/bukkit/entity/Pillager.java
|
|
+++ b/src/main/java/org/bukkit/entity/Pillager.java
|
|
@@ -1,8 +1,10 @@
|
|
package org.bukkit.entity;
|
|
|
|
+import com.destroystokyo.paper.entity.RangedEntity; // Paper
|
|
+
|
|
import org.bukkit.inventory.InventoryHolder;
|
|
|
|
/**
|
|
* Illager entity.
|
|
*/
|
|
-public interface Pillager extends Illager, InventoryHolder { }
|
|
+public interface Pillager extends Illager, InventoryHolder, RangedEntity { } // Paper
|
|
diff --git a/src/main/java/org/bukkit/entity/Skeleton.java b/src/main/java/org/bukkit/entity/Skeleton.java
|
|
index 01d838a60d056bf4b4a8ef9d0ac18c6f91f412e6..b7e424ea8a282f45fb8b91c919e4e4526c00be8b 100644
|
|
--- a/src/main/java/org/bukkit/entity/Skeleton.java
|
|
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
|
|
@@ -7,7 +7,7 @@ package org.bukkit.entity;
|
|
* Other skeleton-like entities, such as the {@link WitherSkeleton} or the
|
|
* {@link Stray} are not related to this type.
|
|
*/
|
|
-public interface Skeleton extends AbstractSkeleton {
|
|
+public interface Skeleton extends AbstractSkeleton, com.destroystokyo.paper.entity.RangedEntity { // Paper
|
|
|
|
/**
|
|
* Computes whether or not this skeleton is currently in the process of
|
|
diff --git a/src/main/java/org/bukkit/entity/Snowman.java b/src/main/java/org/bukkit/entity/Snowman.java
|
|
index 818efe2a4d1ac0c4d8dca6c757850d99cdc2cb4b..10f8f6d45ae9280651c3ebddd1f90acbd7d6ff29 100644
|
|
--- 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
|
|
index b4343903b66a7fb5250c1da2e09c9e5863c20daf..aa88aede6c4e66a608a63d07bc66d60357b0bee9 100644
|
|
--- 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 Raider {
|
|
+public interface Witch extends Raider, RangedEntity { // Paper
|
|
}
|
|
diff --git a/src/main/java/org/bukkit/entity/Wither.java b/src/main/java/org/bukkit/entity/Wither.java
|
|
index 3bc332ee7f7d428bef6e2566ddded8b941858e2e..426d3693317cd303d35d8203026b528d87e401d5 100644
|
|
--- 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, Boss {
|
|
+public interface Wither extends Monster, Boss, RangedEntity { // Paper
|
|
}
|