2016-03-03 09:43:58 +08:00
|
|
|
--- a/net/minecraft/server/EntityAreaEffectCloud.java
|
|
|
|
+++ b/net/minecraft/server/EntityAreaEffectCloud.java
|
2018-07-15 08:00:00 +08:00
|
|
|
@@ -10,6 +10,10 @@
|
2016-03-13 01:12:25 +08:00
|
|
|
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;
|
2016-05-10 19:47:39 +08:00
|
|
|
import javax.annotation.Nullable;
|
2018-07-15 08:00:00 +08:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
@@ -102,6 +106,22 @@
|
2016-03-03 09:43:58 +08:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // CraftBukkit start accessor methods
|
|
|
|
+ public void refreshEffects() {
|
2016-05-10 19:47:39 +08:00
|
|
|
+ if (!this.hasColor) {
|
2018-07-15 08:00:00 +08:00
|
|
|
+ this.getDataWatcher().set(EntityAreaEffectCloud.c, Integer.valueOf(PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects)))); // PAIL: rename
|
2016-03-03 09:43:58 +08:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public String getType() {
|
2018-08-26 10:00:00 +08:00
|
|
|
+ return ((MinecraftKey) IRegistry.POTION.getKey(this.potionRegistry)).toString();
|
2016-03-03 09:43:58 +08:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void setType(String string) {
|
2018-08-26 10:00:00 +08:00
|
|
|
+ a(IRegistry.POTION.get(new MinecraftKey(string)));
|
2016-03-03 09:43:58 +08:00
|
|
|
+ }
|
|
|
|
+ // CraftBukkit end
|
|
|
|
+
|
|
|
|
public int getColor() {
|
2018-12-06 07:00:00 +08:00
|
|
|
return (Integer) this.getDataWatcher().get(EntityAreaEffectCloud.c);
|
2016-03-03 09:43:58 +08:00
|
|
|
}
|
2018-07-15 08:00:00 +08:00
|
|
|
@@ -245,6 +265,7 @@
|
2016-03-13 01:12:25 +08:00
|
|
|
if (!list.isEmpty()) {
|
|
|
|
Iterator iterator2 = list.iterator();
|
|
|
|
|
|
|
|
+ List<LivingEntity> entities = new ArrayList<LivingEntity>(); // CraftBukkit
|
|
|
|
while (iterator2.hasNext()) {
|
|
|
|
EntityLiving entityliving = (EntityLiving) iterator2.next();
|
|
|
|
|
2018-07-15 08:00:00 +08:00
|
|
|
@@ -254,6 +275,17 @@
|
2016-03-13 01:12:25 +08:00
|
|
|
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
|
2018-12-06 07:00:00 +08:00
|
|
|
this.h.put(entityliving, this.ticksLived + this.reapplicationDelay);
|
2016-03-13 01:12:25 +08:00
|
|
|
Iterator iterator3 = arraylist.iterator();
|
|
|
|
|
2018-07-20 14:04:37 +08:00
|
|
|
@@ -263,7 +295,7 @@
|
|
|
|
if (mobeffect1.getMobEffect().isInstant()) {
|
|
|
|
mobeffect1.getMobEffect().applyInstantEffect(this, this.getSource(), entityliving, mobeffect1.getAmplifier(), 0.5D);
|
|
|
|
} else {
|
|
|
|
- entityliving.addEffect(new MobEffect(mobeffect1));
|
|
|
|
+ entityliving.addEffect(new MobEffect(mobeffect1), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|