PaperMC/patches/server/0542-Add-HiddenPotionEffect-API.patch

30 lines
1.7 KiB
Diff
Raw Normal View History

2023-12-29 01:38:44 +01:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tamion <70228790+notTamion@users.noreply.github.com>
Date: Sun, 5 Nov 2023 09:51:28 +0100
Subject: [PATCH] Add HiddenPotionEffect API
== AT ==
public net.minecraft.world.effect.MobEffectInstance hiddenEffect
diff --git a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
2024-04-24 15:46:45 +02:00
index 068a9b2d7b6895f14077d9647a8c9fed3e3d3ade..14c58cf8d255c51473fd3d0092faeaf5a3c1ae0c 100644
2023-12-29 01:38:44 +01:00
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
2024-04-24 15:46:45 +02:00
@@ -10,6 +10,7 @@ public class CraftPotionUtil {
2023-12-29 01:38:44 +01:00
public static MobEffectInstance fromBukkit(PotionEffect effect) {
2024-04-24 15:46:45 +02:00
Holder<MobEffect> type = CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType());
2023-12-29 01:38:44 +01:00
+ // Paper - Note: do not copy over the hidden effect, as this method is only used for applying to entities which we do not want to convert over.
return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()); // Paper
}
2024-04-24 15:46:45 +02:00
@@ -19,7 +20,7 @@ public class CraftPotionUtil {
2023-12-29 01:38:44 +01:00
int duration = effect.getDuration();
boolean ambient = effect.isAmbient();
boolean particles = effect.isVisible();
- return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon()); // Paper
+ return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon(), effect.hiddenEffect == null ? null : toBukkit(effect.hiddenEffect)); // Paper
}
2024-04-24 15:46:45 +02:00
public static boolean equals(Holder<MobEffect> mobEffect, PotionEffectType type) {