summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityPotion.patch
diff options
context:
space:
mode:
authort00thpick1 <t00thpick1dirko@gmail.com>2016-03-12 12:12:25 -0500
committermd_5 <git@md-5.net>2016-03-20 11:29:03 +1100
commitb3f6de0da51ba476bb6792f6fdf44cec472d3cce (patch)
treea75a41f796c59b827f2e3cfa00786b621b6c9c87 /nms-patches/EntityPotion.patch
parent02b26eec0e4be4f8e6df1f7d6c8b3601c7c604a5 (diff)
downloadcraftbukkit-b3f6de0da51ba476bb6792f6fdf44cec472d3cce.tar
craftbukkit-b3f6de0da51ba476bb6792f6fdf44cec472d3cce.tar.gz
craftbukkit-b3f6de0da51ba476bb6792f6fdf44cec472d3cce.tar.lz
craftbukkit-b3f6de0da51ba476bb6792f6fdf44cec472d3cce.tar.xz
craftbukkit-b3f6de0da51ba476bb6792f6fdf44cec472d3cce.zip
SPIGOT-1904: AreaEffectCloud events and additional API
Diffstat (limited to 'nms-patches/EntityPotion.patch')
-rw-r--r--nms-patches/EntityPotion.patch31
1 files changed, 20 insertions, 11 deletions
diff --git a/nms-patches/EntityPotion.patch b/nms-patches/EntityPotion.patch
index f4731684..e7574eba 100644
--- a/nms-patches/EntityPotion.patch
+++ b/nms-patches/EntityPotion.patch
@@ -14,7 +14,7 @@
public class EntityPotion extends EntityProjectile {
private static final DataWatcherObject<Optional<ItemStack>> d = DataWatcher.a(EntityItem.class, DataWatcherRegistry.f);
-@@ -77,7 +84,7 @@
+@@ -77,10 +84,11 @@
this.world.triggerEffect(2002, new BlockPosition(this), PotionRegistry.a(potionregistry));
this.die();
} else {
@@ -23,15 +23,24 @@
if (this.n()) {
EntityAreaEffectCloud entityareaeffectcloud = new EntityAreaEffectCloud(this.world, this.locX, this.locY, this.locZ);
-@@ -89,6 +96,7 @@
- entityareaeffectcloud.a(potionregistry);
- iterator = PotionUtil.b(itemstack).iterator();
-
-+ // PAIL: Add events
- while (iterator.hasNext()) {
- MobEffect mobeffect = (MobEffect) iterator.next();
++ entityareaeffectcloud.projectileSource = this.projectileSource; // CraftBukkit
+ entityareaeffectcloud.a(this.getShooter());
+ entityareaeffectcloud.setRadius(3.0F);
+ entityareaeffectcloud.setRadiusOnUse(-0.5F);
+@@ -95,11 +103,21 @@
+ entityareaeffectcloud.a(new MobEffect(mobeffect.getMobEffect(), mobeffect.getDuration(), mobeffect.getAmplifier()));
+ }
-@@ -100,6 +108,9 @@
+- this.world.addEntity(entityareaeffectcloud);
++ // CraftBukkit start
++ org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, entityareaeffectcloud);
++ if (!(event.isCancelled() || entityareaeffectcloud.dead)) {
++ this.world.addEntity(entityareaeffectcloud);
++ } else {
++ entityareaeffectcloud.dead = true;
++ }
++ // CraftBukkit end
+ } else {
AxisAlignedBB axisalignedbb = this.getBoundingBox().grow(4.0D, 2.0D, 4.0D);
List list1 = this.world.a(EntityLiving.class, axisalignedbb);
@@ -41,7 +50,7 @@
if (!list1.isEmpty()) {
Iterator iterator1 = list1.iterator();
-@@ -116,21 +127,45 @@
+@@ -116,21 +134,45 @@
d1 = 1.0D;
}
@@ -101,7 +110,7 @@
}
}
}
-@@ -138,19 +173,20 @@
+@@ -138,19 +180,20 @@
}
}
}