diff options
author | Jake Potrebic <[email protected]> | 2024-04-26 16:17:13 -0700 |
---|---|---|
committer | Jake Potrebic <[email protected]> | 2024-04-26 16:17:14 -0700 |
commit | 464cc81633f36fd5e73c95593e4460b1249e6bc1 (patch) | |
tree | b6651b29d871e1079107dd8af1fb35e1c3c141f9 /patches/api/0345-Custom-Potion-Mixes.patch | |
parent | 4c53acedce9bcd8dd2bb6f0e114215c3090f9e29 (diff) | |
download | Paper-464cc81633f36fd5e73c95593e4460b1249e6bc1.tar.gz Paper-464cc81633f36fd5e73c95593e4460b1249e6bc1.zip |
fix custom potion mixes
Diffstat (limited to 'patches/api/0345-Custom-Potion-Mixes.patch')
-rw-r--r-- | patches/api/0345-Custom-Potion-Mixes.patch | 72 |
1 files changed, 39 insertions, 33 deletions
diff --git a/patches/api/0345-Custom-Potion-Mixes.patch b/patches/api/0345-Custom-Potion-Mixes.patch index bc46738ce1..b6a28f8917 100644 --- a/patches/api/0345-Custom-Potion-Mixes.patch +++ b/patches/api/0345-Custom-Potion-Mixes.patch @@ -192,74 +192,80 @@ index 43b049b68a8af548cd05c67dafc23dabd07bab27..6da6c20b684eba64b85d67db2482b4a9 // Paper end } diff --git a/src/main/java/org/bukkit/potion/PotionBrewer.java b/src/main/java/org/bukkit/potion/PotionBrewer.java -index 2072f048e10eba829cef047d854b5a22c8f055a3..f81bbaa6d4a991f265e630dc9a3d3945bac78fff 100644 +index 2072f048e10eba829cef047d854b5a22c8f055a3..c1bcbeef9cb634e6cb8c4b58bf06883c37cc028b 100644 --- a/src/main/java/org/bukkit/potion/PotionBrewer.java +++ b/src/main/java/org/bukkit/potion/PotionBrewer.java -@@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull; - * Represents a brewer that can create {@link PotionEffect}s. +@@ -4,10 +4,31 @@ import java.util.Collection; + import org.jetbrains.annotations.NotNull; + + /** +- * Represents a brewer that can create {@link PotionEffect}s. ++ * Used to manage custom {@link io.papermc.paper.potion.PotionMix}s. */ public interface PotionBrewer { -- -+ // Paper start - keep old spigot methods, removal in 1.20.6 + ++ // Paper start ++ /** ++ * Adds a new potion mix recipe. ++ * ++ * @param potionMix the potion mix to add ++ */ ++ void addPotionMix(@NotNull io.papermc.paper.potion.PotionMix potionMix); ++ ++ /** ++ * Removes a potion mix recipe. ++ * ++ * @param key the key of the mix to remove ++ */ ++ void removePotionMix(@NotNull org.bukkit.NamespacedKey key); ++ ++ /** ++ * Resets potion mixes to their default, removing all custom ones. ++ */ ++ void resetPotionMixes(); ++ // Paper end ++ /** * Creates a {@link PotionEffect} from the given {@link PotionEffectType}, * applying duration modifiers and checks. -@@ -16,9 +16,13 @@ public interface PotionBrewer { +@@ -16,9 +37,15 @@ public interface PotionBrewer { * @param duration The duration in ticks * @param amplifier The amplifier of the effect * @return The resulting potion effect + * @deprecated use {@link PotionEffectType#createEffect(int, int)} instead. */ -+ @Deprecated(forRemoval = true, since = "1.20.5") ++ @Deprecated(forRemoval = true, since = "1.20.5") // Paper @NotNull - public PotionEffect createEffect(@NotNull PotionEffectType potion, int duration, int amplifier); ++ // Paper start - make default + default PotionEffect createEffect(@NotNull PotionEffectType potion, int duration, int amplifier) { + return potion.createEffect(duration, amplifier); + } ++ // Paper end /** * Returns a collection of {@link PotionEffect} that would be applied from -@@ -28,9 +32,12 @@ public interface PotionBrewer { +@@ -28,9 +55,13 @@ public interface PotionBrewer { * @return The list of effects * @deprecated Non-Functional */ - @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.5") ++ @Deprecated(forRemoval = true, since = "1.20.5") // Paper @NotNull - public Collection<PotionEffect> getEffectsFromDamage(int damage); ++ // Paper start - make default + default Collection<PotionEffect> getEffectsFromDamage(final int damage) { + return new java.util.ArrayList<>(); + } -+ // Paper start - keep old spigot methods, removal in 1.20.6 ++ // Paper end /** * Returns a collection of {@link PotionEffect} that would be applied from -@@ -43,6 +50,27 @@ public interface PotionBrewer { +@@ -43,6 +74,6 @@ public interface PotionBrewer { * @deprecated Upgraded / extended potions are now their own {@link PotionType} use {@link PotionType#getPotionEffects()} instead */ @NotNull - @Deprecated -+ @Deprecated(forRemoval = true, since = "1.20.5") ++ @Deprecated(forRemoval = true, since = "1.20.5") // Paper public Collection<PotionEffect> getEffects(@NotNull PotionType type, boolean upgraded, boolean extended); -+ -+ // Paper start -+ /** -+ * Adds a new potion mix recipe. -+ * -+ * @param potionMix the potion mix to add -+ */ -+ void addPotionMix(@NotNull io.papermc.paper.potion.PotionMix potionMix); -+ -+ /** -+ * Removes a potion mix recipe. -+ * -+ * @param key the key of the mix to remove -+ */ -+ void removePotionMix(@NotNull org.bukkit.NamespacedKey key); -+ -+ /** -+ * Resets potion mixes to their default, removing all custom ones. -+ */ -+ void resetPotionMixes(); -+ // Paper end } |