fix custom potion mixes

This commit is contained in:
Jake Potrebic 2024-04-26 16:17:13 -07:00
parent 4c53acedce
commit 464cc81633
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
60 changed files with 268 additions and 230 deletions

View file

@ -192,56 +192,18 @@ 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
/**
* Creates a {@link PotionEffect} from the given {@link PotionEffectType},
* applying duration modifiers and checks.
@@ -16,9 +16,13 @@ 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")
@NotNull
- public PotionEffect createEffect(@NotNull PotionEffectType potion, int duration, int amplifier);
+ default PotionEffect createEffect(@NotNull PotionEffectType potion, int duration, int amplifier) {
+ return potion.createEffect(duration, amplifier);
+ }
/**
* Returns a collection of {@link PotionEffect} that would be applied from
@@ -28,9 +32,12 @@ public interface PotionBrewer {
* @return The list of effects
* @deprecated Non-Functional
*/
- @Deprecated
+ @Deprecated(forRemoval = true, since = "1.20.5")
@NotNull
- public Collection<PotionEffect> getEffectsFromDamage(int damage);
+ default Collection<PotionEffect> getEffectsFromDamage(final int damage) {
+ return new java.util.ArrayList<>();
+ }
+ // Paper start - keep old spigot methods, removal in 1.20.6
/**
* Returns a collection of {@link PotionEffect} that would be applied from
@@ -43,6 +50,27 @@ 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")
public Collection<PotionEffect> getEffects(@NotNull PotionType type, boolean upgraded, boolean extended);
+
+ // Paper start
+ /**
+ * Adds a new potion mix recipe.
@ -262,4 +224,48 @@ index 2072f048e10eba829cef047d854b5a22c8f055a3..f81bbaa6d4a991f265e630dc9a3d3945
+ */
+ void resetPotionMixes();
+ // Paper end
+
/**
* Creates a {@link PotionEffect} from the given {@link PotionEffectType},
* applying duration modifiers and checks.
@@ -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") // 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 +55,13 @@ public interface PotionBrewer {
* @return The list of effects
* @deprecated Non-Functional
*/
- @Deprecated
+ @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 end
/**
* Returns a collection of {@link PotionEffect} that would be applied from
@@ -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") // Paper
public Collection<PotionEffect> getEffects(@NotNull PotionType type, boolean upgraded, boolean extended);
}