mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 19:49:35 +01:00
8a3c8cfcd4
By: md_5 <git@md-5.net>
50 lines
2.7 KiB
Diff
50 lines
2.7 KiB
Diff
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
|
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
|
@@ -31,6 +31,12 @@
|
|
import net.minecraft.world.level.material.EnumPistonReaction;
|
|
import org.slf4j.Logger;
|
|
|
|
+// CraftBukkit start
|
|
+import net.minecraft.resources.MinecraftKey;
|
|
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
|
+import org.bukkit.entity.LivingEntity;
|
|
+// CraftBukkit end
|
|
+
|
|
public class EntityAreaEffectCloud extends Entity implements TraceableEntity {
|
|
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
|
@@ -264,6 +270,7 @@
|
|
if (!list1.isEmpty()) {
|
|
Iterator iterator1 = list1.iterator();
|
|
|
|
+ List<LivingEntity> entities = new java.util.ArrayList<LivingEntity>(); // CraftBukkit
|
|
while (iterator1.hasNext()) {
|
|
EntityLiving entityliving = (EntityLiving) iterator1.next();
|
|
|
|
@@ -273,6 +280,17 @@
|
|
double d8 = d6 * d6 + d7 * d7;
|
|
|
|
if (d8 <= (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 (!event.isCancelled()) {
|
|
+ for (LivingEntity entity : event.getAffectedEntities()) {
|
|
+ if (entity instanceof CraftLivingEntity) {
|
|
+ EntityLiving entityliving = ((CraftLivingEntity) entity).getHandle();
|
|
+ // CraftBukkit end
|
|
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
|
|
Iterator iterator2 = list.iterator();
|
|
|
|
@@ -282,7 +300,7 @@
|
|
if (mobeffect1.getEffect().isInstantenous()) {
|
|
mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
|
|
} else {
|
|
- entityliving.addEffect(new MobEffect(mobeffect1), this);
|
|
+ entityliving.addEffect(new MobEffect(mobeffect1), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit
|
|
}
|
|
}
|
|
|