3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/patches/server/0370-Fix-PotionEffect-ignores-icon-flag.patch

61 Zeilen
3.9 KiB
Diff

2021-06-14 07:32:56 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kickash32 <kickash32@gmail.com>
Date: Fri, 8 May 2020 00:49:18 -0400
Subject: [PATCH] Fix PotionEffect ignores icon flag
Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com>
2021-06-14 07:32:56 +02:00
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
2024-04-24 08:44:48 +02:00
index 539280a0265a4746ebc9ede6667df3699dfb8125..a5026d470b8651ddf4b79fc29cbc598ac55217ff 100644
2021-06-14 07:32:56 +02:00
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
2024-04-24 08:44:48 +02:00
@@ -483,7 +483,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
2021-06-14 07:32:56 +02:00
@Override
public boolean addPotionEffect(PotionEffect effect, boolean force) {
2024-04-24 08:44:48 +02:00
- this.getHandle().addEffect(new MobEffectInstance(CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()), EntityPotionEffectEvent.Cause.PLUGIN);
+ this.getHandle().addEffect(org.bukkit.craftbukkit.potion.CraftPotionUtil.fromBukkit(effect), EntityPotionEffectEvent.Cause.PLUGIN); // Paper - Don't ignore icon
2021-06-14 07:32:56 +02:00
return true;
}
2024-04-24 08:44:48 +02:00
@@ -504,7 +504,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public PotionEffect getPotionEffect(PotionEffectType type) {
2024-04-24 08:44:48 +02:00
MobEffectInstance handle = this.getHandle().getEffect(CraftPotionEffectType.bukkitToMinecraftHolder(type));
- return (handle == null) ? null : new PotionEffect(CraftPotionEffectType.minecraftHolderToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible());
+ return (handle == null) ? null : org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(handle); // Paper
}
@Override
2024-04-24 08:44:48 +02:00
@@ -516,7 +516,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public Collection<PotionEffect> getActivePotionEffects() {
List<PotionEffect> effects = new ArrayList<PotionEffect>();
for (MobEffectInstance handle : this.getHandle().activeEffects.values()) {
2024-04-24 08:44:48 +02:00
- effects.add(new PotionEffect(CraftPotionEffectType.minecraftHolderToBukkit(handle.getEffect()), handle.getDuration(), handle.getAmplifier(), handle.isAmbient(), handle.isVisible()));
+ effects.add(org.bukkit.craftbukkit.potion.CraftPotionUtil.toBukkit(handle)); // Paper
}
return effects;
}
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 08:44:48 +02:00
index a91fd77d3a3aec302cb4a17e358d04bdf0cff6c3..068a9b2d7b6895f14077d9647a8c9fed3e3d3ade 100644
--- a/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
+++ b/src/main/java/org/bukkit/craftbukkit/potion/CraftPotionUtil.java
2024-04-24 08:44:48 +02:00
@@ -10,7 +10,7 @@ public class CraftPotionUtil {
public static MobEffectInstance fromBukkit(PotionEffect effect) {
2024-04-24 08:44:48 +02:00
Holder<MobEffect> type = CraftPotionEffectType.bukkitToMinecraftHolder(effect.getType());
- return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles());
+ return new MobEffectInstance(type, effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles(), effect.hasIcon()); // Paper
}
public static PotionEffect toBukkit(MobEffectInstance effect) {
2024-04-24 08:44:48 +02:00
@@ -19,7 +19,7 @@ public class CraftPotionUtil {
int duration = effect.getDuration();
boolean ambient = effect.isAmbient();
boolean particles = effect.isVisible();
- return new PotionEffect(type, duration, amp, ambient, particles);
+ return new PotionEffect(type, duration, amp, ambient, particles, effect.showIcon()); // Paper
}
2024-04-24 08:44:48 +02:00
public static boolean equals(Holder<MobEffect> mobEffect, PotionEffectType type) {