From 5a12442f223f04b36ee78454419c7cb19e915aa7 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 22 Jul 2017 09:51:22 +1000 Subject: [PATCH] SPIGOT-3433: Improve AreaEffectCloud#getSource --- nms-patches/EntityCreeper.patch | 8 ++++++++ nms-patches/EntityPotion.patch | 10 +--------- .../craftbukkit/entity/CraftAreaEffectCloud.java | 5 +++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/nms-patches/EntityCreeper.patch b/nms-patches/EntityCreeper.patch index b29ed0a487..5721057fff 100644 --- a/nms-patches/EntityCreeper.patch +++ b/nms-patches/EntityCreeper.patch @@ -72,3 +72,11 @@ } } +@@ -202,6 +225,7 @@ + if (!collection.isEmpty()) { + EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX, this.locY, this.locZ); + ++ entityareaeffectcloud.setSource(this); // CraftBukkit + entityareaeffectcloud.setRadius(2.5F); + entityareaeffectcloud.setRadiusOnUse(-0.5F); + entityareaeffectcloud.setWaitTime(10); diff --git a/nms-patches/EntityPotion.patch b/nms-patches/EntityPotion.patch index f7ce861078..117e59dc99 100644 --- a/nms-patches/EntityPotion.patch +++ b/nms-patches/EntityPotion.patch @@ -91,15 +91,7 @@ } } } -@@ -167,6 +199,7 @@ - private void a(ItemStack itemstack, PotionRegistry potionregistry) { - EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX, this.locY, this.locZ); - -+ entityareaeffectcloud.projectileSource = this.projectileSource; // CraftBukkit - entityareaeffectcloud.setSource(this.getShooter()); - entityareaeffectcloud.setRadius(3.0F); - entityareaeffectcloud.setRadiusOnUse(-0.5F); -@@ -187,7 +220,14 @@ +@@ -187,7 +219,14 @@ entityareaeffectcloud.setColor(nbttagcompound.getInt("CustomPotionColor")); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java index 42f6ea4a23..5f0684162f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java @@ -14,6 +14,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.potion.CraftPotionUtil; import org.bukkit.entity.AreaEffectCloud; import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.projectiles.ProjectileSource; @@ -206,7 +207,8 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud } public ProjectileSource getSource() { - return getHandle().projectileSource; + EntityLiving source = getHandle().y(); // PAIL: rename + return (source == null) ? null : (LivingEntity) source.getBukkitEntity(); } public void setSource(ProjectileSource shooter) { @@ -215,6 +217,5 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud } else { getHandle().setSource((EntityLiving) null); } - getHandle().projectileSource = shooter; } }