Paper/patches/api/0371-More-Projectile-API.patch
Nassim Jahnke 2da891fcfa
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
0b32cbaa PR-782: ThrownPotion now extends ThrowableProjectile
474238ca SPIGOT-7138: Can't retrieve pixel color from map

CraftBukkit Changes:
cdef8fc72 PR-1097: CraftThrownPotion now extends CraftThrowableProjectile
419010b13 SPIGOT-7112: Mobs added 1.17 and after do not create an EntityTargetEvent properly
e71426201 SPIGOT-7079: Allays don't call EntityTargetEvent on ground items
f80adb8b9 SPIGOT-7138: Can't retrieve pixel color from map
2022-08-17 13:02:35 +02:00

142 lines
4.4 KiB
Diff

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 d616d5941b3c7b85e350e845901da798601b9a3c..b7a6e3b1ac327c4e03f9d73952c1ce4d54967cf4 100644
--- a/src/main/java/org/bukkit/entity/Firework.java
+++ b/src/main/java/org/bukkit/entity/Firework.java
@@ -15,6 +15,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,4 +56,52 @@ public interface Firework extends Projectile {
@org.jetbrains.annotations.Nullable
public LivingEntity getBoostedEntity();
// 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
}