summaryrefslogtreecommitdiffstats
path: root/nms-patches/EntityAreaEffectCloud.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/EntityAreaEffectCloud.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/EntityAreaEffectCloud.patch')
-rw-r--r--nms-patches/EntityAreaEffectCloud.patch39
1 files changed, 38 insertions, 1 deletions
diff --git a/nms-patches/EntityAreaEffectCloud.patch b/nms-patches/EntityAreaEffectCloud.patch
index 0be2ccd8..08cb2e41 100644
--- a/nms-patches/EntityAreaEffectCloud.patch
+++ b/nms-patches/EntityAreaEffectCloud.patch
@@ -1,6 +1,17 @@
--- a/net/minecraft/server/EntityAreaEffectCloud.java
+++ b/net/minecraft/server/EntityAreaEffectCloud.java
-@@ -91,6 +91,22 @@
+@@ -8,6 +8,10 @@
+ import java.util.List;
+ import java.util.Map;
+ import java.util.UUID;
++
++import org.bukkit.craftbukkit.entity.CraftLivingEntity; // CraftBukkit
++import org.bukkit.entity.LivingEntity; // CraftBukkit
++
+ import java.util.Map.Entry;
+
+ public class EntityAreaEffectCloud extends Entity {
+@@ -91,6 +95,22 @@
}
@@ -23,3 +34,29 @@
public int getColor() {
return ((Integer) this.getDataWatcher().get(EntityAreaEffectCloud.b)).intValue();
}
+@@ -237,6 +257,7 @@
+ if (!list.isEmpty()) {
+ Iterator iterator2 = list.iterator();
+
++ List<LivingEntity> entities = new ArrayList<LivingEntity>(); // CraftBukkit
+ while (iterator2.hasNext()) {
+ EntityLiving entityliving = (EntityLiving) iterator2.next();
+
+@@ -246,6 +267,17 @@
+ double d2 = d0 * d0 + d1 * d1;
+
+ if (d2 <= (double) (f * f)) {
++ // CraftBukkit start
++ entities.add((LivingEntity) entityliving.getBukkitEntity());
++ }
++ }
++ }
++ org.bukkit.event.entity.AreaEffectCloudApplyEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callAreaEffectCloudApplyEvent(this, entities);
++ if (true) { // Preserve NMS spacing and bracket count for smallest diff
++ for (LivingEntity entity : event.getAffectedEntities()) {
++ if (entity instanceof CraftLivingEntity) {
++ EntityLiving entityliving = ((CraftLivingEntity) entity).getHandle();
++ // CraftBukkit end
+ this.g.put(entityliving, Integer.valueOf(this.ticksLived + this.reapplicationDelay));
+ Iterator iterator3 = arraylist.iterator();
+