mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 23:10:16 +01:00
Fix empty effect clouds from lingering potions (#8641)
This commit is contained in:
parent
8b951a41ae
commit
09c45d4cab
1 changed files with 20 additions and 0 deletions
|
@ -126,6 +126,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
Entity entity = this.getOwner();
|
||||
|
||||
@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
entityareaeffectcloud.setPotion(potion);
|
||||
Iterator iterator = PotionUtils.getCustomEffects(stack).iterator();
|
||||
|
||||
+ boolean noEffects = potion.getEffects().isEmpty(); // Paper
|
||||
while (iterator.hasNext()) {
|
||||
MobEffectInstance mobeffect = (MobEffectInstance) iterator.next();
|
||||
|
||||
entityareaeffectcloud.addEffect(new MobEffectInstance(mobeffect));
|
||||
+ noEffects = false; // Paper
|
||||
}
|
||||
|
||||
CompoundTag nbttagcompound = stack.getTag();
|
||||
@@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
|
||||
// CraftBukkit start
|
||||
org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, entityareaeffectcloud);
|
||||
- if (!(event.isCancelled() || entityareaeffectcloud.isRemoved())) {
|
||||
+ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (noEffects && entityareaeffectcloud.effects.isEmpty() && entityareaeffectcloud.getPotion().getEffects().isEmpty()))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling
|
||||
this.level.addFreshEntity(entityareaeffectcloud);
|
||||
} else {
|
||||
entityareaeffectcloud.discard();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
|
Loading…
Reference in a new issue