3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-15 11:00:06 +01:00
Paper/patches/api/0372-More-Projectile-API.patch
Nassim Jahnke 385f313a8b
Updated Upstream (Bukkit/CraftBukkit/Spigot) (#8092)
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:
d41796de SPIGOT-7071: Add Player#stopSound(SoundCategory category)
61dae5b2 SPIGOT-7011, SPIGOT-7065: Overhaul of structures

CraftBukkit Changes:
991aeda12 SPIGOT-1729, SPIGOT-7090: Keep precision in teleportation between worlds
5c9a5f628 SPIGOT-7071: Add Player#stopSound(SoundCategory category)
68f888ded SPIGOT-7011, SPIGOT-7065: Overhaul of structures
0231a3746 Remove outdated build delay.

Spigot Changes:
475f6008 Rebuild patches
8ce1761f Rebuild patches
2022-07-04 16:38:06 +02:00

136 Zeilen
4.3 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
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 10a3c297bd87ad3ab4555054858f47a479e76e1a..1afda5d6d948b7e8589e69d3cd2c045763b5e784 100644
--- a/src/main/java/org/bukkit/entity/ThrownPotion.java
+++ b/src/main/java/org/bukkit/entity/ThrownPotion.java
@@ -32,12 +32,29 @@ public interface ThrownPotion extends Projectile {
/**
* 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);
+ // Paper end
}