aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-API-Patches/0115-RangedEntity-API.patch
blob: 9d154dd5001a2a61ce9a72cf516857426f38eab5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
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 eefe96c997af7d4547de3e047c2d36f0e09e25e2..6e106e1291370416f53a597b48822d3e839ee73d 100644
--- a/src/main/java/org/bukkit/entity/Piglin.java
+++ b/src/main/java/org/bukkit/entity/Piglin.java
@@ -1,9 +1,11 @@
 package org.bukkit.entity;
 
+import com.destroystokyo.paper.entity.RangedEntity; // Paper
+
 /**
  * Represents a Piglin.
  */
-public interface Piglin extends PiglinAbstract {
+public interface Piglin extends PiglinAbstract, 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 16b1293887cee2bc5267f3da771fb5a6ece1b4e9..1c367f78eadf24850061a84ce63b950b79d3c435 100644
--- a/src/main/java/org/bukkit/entity/Skeleton.java
+++ b/src/main/java/org/bukkit/entity/Skeleton.java
@@ -2,11 +2,12 @@ package org.bukkit.entity;
 
 import org.jetbrains.annotations.Contract;
 import org.jetbrains.annotations.NotNull;
+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
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
 }