aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/api/0370-More-Projectile-API.patch
blob: 80f2397953577807cdcc848f0184f897d46d3790 (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
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Owen1212055 <23108066+Owen1212055@users.noreply.github.com>
Date: Wed, 26 May 2021 19:34:43 -0400
Subject: [PATCH] More Projectile API

Co-authored-by: Nassim Jahnke <nassim@njahnke.dev>

diff --git a/src/main/java/org/bukkit/entity/Firework.java b/src/main/java/org/bukkit/entity/Firework.java
index 0d31aa0b22cf1e849572294e2cfe38b48c9210af..571712e17551f24b369044b8215b722f7183ae7d 100644
--- a/src/main/java/org/bukkit/entity/Firework.java
+++ b/src/main/java/org/bukkit/entity/Firework.java
@@ -16,6 +16,8 @@ public interface Firework extends Projectile {
 
     /**
      * Apply the provided meta to the fireworks
+     * <p>
+     * Adjusts detonation ticks automatically.
      *
      * @param meta The FireworkMeta to apply
      */
@@ -54,31 +56,39 @@ public interface Firework extends Projectile {
      * {@link #getMaxLife()}, the firework will detonate.
      *
      * @param ticks the ticks to set. Must be greater than or equal to 0
+     * @deprecated use {@link #setTicksFlown(int)}
      * @return true if the life was set, false if this firework has already detonated
      */
+    @Deprecated(forRemoval = true) // Paper
     boolean setLife(int ticks);
 
     /**
      * Get the ticks that this firework has been alive. When this value reaches
      * {@link #getMaxLife()}, the firework will detonate.
      *
+     * @deprecated use {@link #getTicksFlown()}
      * @return the life ticks
      */
+    @Deprecated(forRemoval = true) // Paper
     int getLife();
 
     /**
      * Set the time in ticks this firework will exist until it is detonated.
      *
      * @param ticks the ticks to set. Must be greater than 0
+     * @deprecated use {@link #setTicksToDetonate(int)}
      * @return true if the time was set, false if this firework has already detonated
      */
+    @Deprecated(forRemoval = true) // Paper
     boolean setMaxLife(int ticks);
 
     /**
      * Get the time in ticks this firework will exist until it is detonated.
      *
+     * @deprecated use {@link #getTicksToDetonate()}
      * @return the maximum life in ticks
      */
+    @Deprecated(forRemoval = true) // Paper
     int getMaxLife();
 
     /**
@@ -127,4 +137,52 @@ public interface Firework extends Projectile {
         return getAttachedTo();
     }
     // Paper end
+
+    // Paper start - Firework API
+    /**
+     * Gets the item used in the firework.
+     *
+     * @return firework item
+     */
+    @NotNull
+    public org.bukkit.inventory.ItemStack getItem();
+
+    /**
+     * Sets the item used in the firework.
+     * <p>
+     * Firework explosion effects are used from this item.
+     *
+     * @param itemStack item to set
+     */
+    void setItem(@org.jetbrains.annotations.Nullable org.bukkit.inventory.ItemStack itemStack);
+
+    /**
+     * Gets the number of ticks the firework has flown.
+     *
+     * @return ticks flown
+     */
+    int getTicksFlown();
+
+    /**
+     * Sets the number of ticks the firework has flown.
+     * Setting this greater than detonation ticks will cause the firework to explode.
+     *
+     * @param ticks ticks flown
+     */
+    void setTicksFlown(int ticks);
+
+    /**
+     * Gets the number of ticks the firework will detonate on.
+     *
+     * @return the tick to detonate on
+     */
+    int getTicksToDetonate();
+
+    /**
+     * Set the amount of ticks the firework will detonate on.
+     *
+     * @param ticks ticks to detonate on
+     */
+    void setTicksToDetonate(int ticks);
+    // Paper stop
 }
diff --git a/src/main/java/org/bukkit/entity/FishHook.java b/src/main/java/org/bukkit/entity/FishHook.java
index d1b37530319f6d37ee37f62080289c1e45848bc8..e94c7e279356c510f60508b26277d4891a4258fa 100644
--- a/src/main/java/org/bukkit/entity/FishHook.java
+++ b/src/main/java/org/bukkit/entity/FishHook.java
@@ -162,4 +162,20 @@ public interface FishHook extends Projectile {
          */
         BOBBING;
     }
+
+    // Paper start - More FishHook API
+    /**
+     * Get the number of ticks the hook needs to wait for a fish to bite.
+     *
+     * @return Number of ticks
+     */
+    int getWaitTime();
+
+    /**
+     * Sets the number of ticks the hook needs to wait for a fish to bite.
+     *
+     * @param ticks Number of ticks
+     */
+    void setWaitTime(int ticks);
+    // Paper end
 }
diff --git a/src/main/java/org/bukkit/entity/ThrownPotion.java b/src/main/java/org/bukkit/entity/ThrownPotion.java
index 7051e07b4e456aae0ec9e37808b59e5fa62a4027..225ac312613b9e8f3cf680819f2ebe350d1bf48a 100644
--- a/src/main/java/org/bukkit/entity/ThrownPotion.java
+++ b/src/main/java/org/bukkit/entity/ThrownPotion.java
@@ -32,12 +32,34 @@ public interface ThrownPotion extends ThrowableProjectile {
 
     /**
      * Set the ItemStack for this thrown potion.
-     * <p>
-     * The ItemStack must be of type {@link org.bukkit.Material#SPLASH_POTION}
-     * or {@link org.bukkit.Material#LINGERING_POTION}, otherwise an exception
-     * is thrown.
      *
      * @param item New ItemStack
      */
     public void setItem(@NotNull ItemStack item);
+
+    // Paper start - Projectile API
+    /**
+     * Gets a copy of the PotionMeta for this thrown potion.
+     * This includes what effects will be applied by this potion.
+     *
+     * @return potion meta
+     */
+    @NotNull
+    org.bukkit.inventory.meta.PotionMeta getPotionMeta();
+
+    /**
+     * Sets the PotionMeta of this thrown potion.
+     * This will modify the effects applied by this potion.
+     * <p>
+     * Note that the type of {@link #getItem()} is irrelevant
+     *
+     * @param meta potion meta
+     */
+    void setPotionMeta(@NotNull org.bukkit.inventory.meta.PotionMeta meta);
+
+    /**
+     * Splashes the potion at its current location.
+     */
+    void splash();
+    // Paper end
 }