craftbukkit/nms-patches/net/minecraft/world/entity/EntityAreaEffectCloud.patch

51 lines
2.7 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
2022-12-08 03:00:00 +11:00
@@ -31,6 +31,12 @@
2022-03-01 02:00:00 +11:00
import net.minecraft.world.level.material.EnumPistonReaction;
import org.slf4j.Logger;
2021-03-09 08:47:33 +11:00
2018-12-26 08:00:00 +11:00
+// CraftBukkit start
2021-03-16 09:00:00 +11:00
+import net.minecraft.resources.MinecraftKey;
2018-12-26 08:00:00 +11:00
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
+import org.bukkit.entity.LivingEntity;
+// CraftBukkit end
2021-03-09 08:47:33 +11:00
+
2023-03-15 03:30:00 +11:00
public class EntityAreaEffectCloud extends Entity implements TraceableEntity {
2018-12-26 08:00:00 +11:00
2022-03-01 02:00:00 +11:00
private static final Logger LOGGER = LogUtils.getLogger();
2023-09-22 02:40:00 +10:00
@@ -264,6 +270,7 @@
2018-12-26 08:00:00 +11:00
if (!list1.isEmpty()) {
2021-06-11 15:00:00 +10:00
Iterator iterator1 = list1.iterator();
2018-12-26 08:00:00 +11:00
+ List<LivingEntity> entities = new java.util.ArrayList<LivingEntity>(); // CraftBukkit
2021-06-11 15:00:00 +10:00
while (iterator1.hasNext()) {
EntityLiving entityliving = (EntityLiving) iterator1.next();
2023-09-22 02:40:00 +10:00
@@ -273,6 +280,17 @@
2021-06-11 15:00:00 +10:00
double d8 = d6 * d6 + d7 * d7;
2021-06-11 15:00:00 +10:00
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
2021-06-11 15:00:00 +10:00
this.victims.put(entityliving, this.tickCount + this.reapplicationDelay);
Iterator iterator2 = list.iterator();
2023-09-22 02:40:00 +10:00
@@ -282,7 +300,7 @@
2021-11-22 09:00:00 +11:00
if (mobeffect1.getEffect().isInstantenous()) {
mobeffect1.getEffect().applyInstantenousEffect(this, this.getOwner(), entityliving, mobeffect1.getAmplifier(), 0.5D);
} else {
2021-06-11 15:00:00 +10:00
- entityliving.addEffect(new MobEffect(mobeffect1), this);
+ entityliving.addEffect(new MobEffect(mobeffect1), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit
}
}