2021-03-15 23:00:00 +01:00
|
|
|
--- a/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
|
|
|
+++ b/net/minecraft/world/entity/EntityAreaEffectCloud.java
|
2024-10-22 17:15:00 +02:00
|
|
|
@@ -33,6 +33,12 @@
|
2022-02-28 16:00:00 +01:00
|
|
|
import net.minecraft.world.level.material.EnumPistonReaction;
|
|
|
|
import org.slf4j.Logger;
|
2021-03-08 22:47:33 +01:00
|
|
|
|
2018-12-25 22:00:00 +01:00
|
|
|
+// CraftBukkit start
|
|
|
|
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
|
|
|
+import org.bukkit.entity.LivingEntity;
|
2024-02-21 10:55:34 +01:00
|
|
|
+import org.bukkit.event.entity.EntityRemoveEvent;
|
2018-12-25 22:00:00 +01:00
|
|
|
+// CraftBukkit end
|
2021-03-08 22:47:33 +01:00
|
|
|
+
|
2023-03-14 17:30:00 +01:00
|
|
|
public class EntityAreaEffectCloud extends Entity implements TraceableEntity {
|
2018-12-25 22:00:00 +01:00
|
|
|
|
2022-02-28 16:00:00 +01:00
|
|
|
private static final Logger LOGGER = LogUtils.getLogger();
|
2024-10-22 17:15:00 +02:00
|
|
|
@@ -200,7 +206,7 @@
|
2024-02-21 10:55:34 +01:00
|
|
|
|
2024-10-22 17:15:00 +02:00
|
|
|
private void serverTick(WorldServer worldserver) {
|
|
|
|
if (this.tickCount >= this.waitTime + this.duration) {
|
|
|
|
- this.discard();
|
|
|
|
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
|
|
} else {
|
|
|
|
boolean flag = this.isWaiting();
|
|
|
|
boolean flag1 = this.tickCount < this.waitTime;
|
|
|
|
@@ -215,7 +221,7 @@
|
|
|
|
if (this.radiusPerTick != 0.0F) {
|
|
|
|
f += this.radiusPerTick;
|
|
|
|
if (f < 0.5F) {
|
|
|
|
- this.discard();
|
|
|
|
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
|
|
return;
|
|
|
|
}
|
2024-02-21 10:55:34 +01:00
|
|
|
|
2024-10-22 17:15:00 +02:00
|
|
|
@@ -249,11 +255,12 @@
|
|
|
|
if (!list1.isEmpty()) {
|
|
|
|
Iterator iterator1 = list1.iterator();
|
2016-03-12 18:12:25 +01:00
|
|
|
|
2024-10-22 17:15:00 +02:00
|
|
|
+ List<LivingEntity> entities = new java.util.ArrayList<LivingEntity>(); // CraftBukkit
|
|
|
|
while (iterator1.hasNext()) {
|
|
|
|
EntityLiving entityliving = (EntityLiving) iterator1.next();
|
2016-03-12 18:12:25 +01:00
|
|
|
|
2024-10-22 17:15:00 +02:00
|
|
|
if (!this.victims.containsKey(entityliving) && entityliving.isAffectedByPotions()) {
|
|
|
|
- Stream stream = list.stream();
|
|
|
|
+ Stream<MobEffect> stream = list.stream(); // CraftBukkit - decompile error
|
2016-03-12 18:12:25 +01:00
|
|
|
|
2024-10-22 17:15:00 +02:00
|
|
|
Objects.requireNonNull(entityliving);
|
|
|
|
if (!stream.noneMatch(entityliving::canBeAffected)) {
|
|
|
|
@@ -262,6 +269,19 @@
|
|
|
|
double d2 = d0 * d0 + d1 * d1;
|
2024-06-13 17:05:00 +02:00
|
|
|
|
2024-10-22 17:15:00 +02:00
|
|
|
if (d2 <= (double) (f * f)) {
|
|
|
|
+ // CraftBukkit start
|
|
|
|
+ entities.add((LivingEntity) entityliving.getBukkitEntity());
|
|
|
|
+ }
|
2024-06-13 17:05:00 +02:00
|
|
|
+ }
|
2016-03-12 18:12:25 +01:00
|
|
|
+ }
|
|
|
|
+ }
|
2024-10-22 17:15:00 +02:00
|
|
|
+ {
|
|
|
|
+ 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();
|
2016-03-12 18:12:25 +01:00
|
|
|
|
2024-10-22 17:15:00 +02:00
|
|
|
@@ -271,14 +291,14 @@
|
|
|
|
if (((MobEffectList) mobeffect1.getEffect().value()).isInstantenous()) {
|
|
|
|
((MobEffectList) mobeffect1.getEffect().value()).applyInstantenousEffect(worldserver, 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
|
|
|
|
}
|
2024-06-13 17:05:00 +02:00
|
|
|
}
|
2018-07-20 08:04:37 +02:00
|
|
|
|
2024-10-22 17:15:00 +02:00
|
|
|
if (this.radiusOnUse != 0.0F) {
|
|
|
|
f += this.radiusOnUse;
|
|
|
|
if (f < 0.5F) {
|
|
|
|
- this.discard();
|
|
|
|
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
|
|
return;
|
|
|
|
}
|
2024-02-21 10:55:34 +01:00
|
|
|
|
2024-10-22 17:15:00 +02:00
|
|
|
@@ -288,7 +308,7 @@
|
|
|
|
if (this.durationOnUse != 0) {
|
|
|
|
this.duration += this.durationOnUse;
|
|
|
|
if (this.duration <= 0) {
|
|
|
|
- this.discard();
|
|
|
|
+ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
|
|
return;
|
|
|
|
}
|
2024-06-13 17:05:00 +02:00
|
|
|
}
|