mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 19:34:09 +01:00
117 lines
6 KiB
Diff
117 lines
6 KiB
Diff
--- a/net/minecraft/world/entity/AreaEffectCloud.java
|
|
+++ b/net/minecraft/world/entity/AreaEffectCloud.java
|
|
@@ -47,7 +_,7 @@
|
|
public float radiusOnUse;
|
|
public float radiusPerTick;
|
|
@Nullable
|
|
- private LivingEntity owner;
|
|
+ private net.minecraft.world.entity.LivingEntity owner;
|
|
@Nullable
|
|
public UUID ownerUUID;
|
|
|
|
@@ -128,6 +_,18 @@
|
|
this.duration = duration;
|
|
}
|
|
|
|
+ // Spigot start - copied from below
|
|
+ @Override
|
|
+ public void inactiveTick() {
|
|
+ super.inactiveTick();
|
|
+
|
|
+ if (this.tickCount >= this.waitTime + this.duration) {
|
|
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
+ return;
|
|
+ }
|
|
+ }
|
|
+ // Spigot end
|
|
+
|
|
@Override
|
|
public void tick() {
|
|
super.tick();
|
|
@@ -177,7 +_,7 @@
|
|
|
|
private void serverTick(ServerLevel level) {
|
|
if (this.tickCount >= this.waitTime + this.duration) {
|
|
- this.discard();
|
|
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
} else {
|
|
boolean isWaiting = this.isWaiting();
|
|
boolean flag = this.tickCount < this.waitTime;
|
|
@@ -190,7 +_,7 @@
|
|
if (this.radiusPerTick != 0.0F) {
|
|
radius += this.radiusPerTick;
|
|
if (radius < 0.5F) {
|
|
- this.discard();
|
|
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
return;
|
|
}
|
|
|
|
@@ -220,6 +_,7 @@
|
|
list.addAll(this.potionContents.customEffects());
|
|
List<LivingEntity> entitiesOfClass = this.level().getEntitiesOfClass(LivingEntity.class, this.getBoundingBox());
|
|
if (!entitiesOfClass.isEmpty()) {
|
|
+ List<org.bukkit.entity.LivingEntity> entities = new java.util.ArrayList<>(); // CraftBukkit
|
|
for (LivingEntity livingEntity : entitiesOfClass) {
|
|
if (!this.victims.containsKey(livingEntity)
|
|
&& livingEntity.isAffectedByPotions()
|
|
@@ -228,6 +_,17 @@
|
|
double d1 = livingEntity.getZ() - this.getZ();
|
|
double d2 = d * d + d1 * d1;
|
|
if (d2 <= radius * radius) {
|
|
+ // CraftBukkit start
|
|
+ entities.add((org.bukkit.entity.LivingEntity) livingEntity.getBukkitEntity());
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ org.bukkit.event.entity.AreaEffectCloudApplyEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callAreaEffectCloudApplyEvent(this, entities);
|
|
+ if (!event.isCancelled()) {
|
|
+ for (org.bukkit.entity.LivingEntity entity : event.getAffectedEntities()) {
|
|
+ if (entity instanceof org.bukkit.craftbukkit.entity.CraftLivingEntity) {
|
|
+ net.minecraft.world.entity.LivingEntity livingEntity = ((org.bukkit.craftbukkit.entity.CraftLivingEntity) entity).getHandle();
|
|
+ // CraftBukkit end
|
|
this.victims.put(livingEntity, this.tickCount + this.reapplicationDelay);
|
|
|
|
for (MobEffectInstance mobEffectInstance1 : list) {
|
|
@@ -236,14 +_,14 @@
|
|
.value()
|
|
.applyInstantenousEffect(level, this, this.getOwner(), livingEntity, mobEffectInstance1.getAmplifier(), 0.5);
|
|
} else {
|
|
- livingEntity.addEffect(new MobEffectInstance(mobEffectInstance1), this);
|
|
+ livingEntity.addEffect(new MobEffectInstance(mobEffectInstance1), this, org.bukkit.event.entity.EntityPotionEffectEvent.Cause.AREA_EFFECT_CLOUD); // CraftBukkit
|
|
}
|
|
}
|
|
|
|
if (this.radiusOnUse != 0.0F) {
|
|
radius += this.radiusOnUse;
|
|
if (radius < 0.5F) {
|
|
- this.discard();
|
|
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
return;
|
|
}
|
|
|
|
@@ -253,7 +_,7 @@
|
|
if (this.durationOnUse != 0) {
|
|
this.duration = this.duration + this.durationOnUse;
|
|
if (this.duration <= 0) {
|
|
- this.discard();
|
|
+ this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
|
|
return;
|
|
}
|
|
}
|
|
@@ -299,14 +_,14 @@
|
|
this.waitTime = waitTime;
|
|
}
|
|
|
|
- public void setOwner(@Nullable LivingEntity owner) {
|
|
+ public void setOwner(@Nullable net.minecraft.world.entity.LivingEntity owner) {
|
|
this.owner = owner;
|
|
this.ownerUUID = owner == null ? null : owner.getUUID();
|
|
}
|
|
|
|
@Nullable
|
|
@Override
|
|
- public LivingEntity getOwner() {
|
|
+ public net.minecraft.world.entity.LivingEntity getOwner() {
|
|
if (this.owner != null && !this.owner.isRemoved()) {
|
|
return this.owner;
|
|
} else {
|