Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-21 14:00:11 +01:00
72 Zeilen
3.3 KiB
Diff
72 Zeilen
3.3 KiB
Diff
--- a/net/minecraft/server/EntityAreaEffectCloud.java
|
|
+++ b/net/minecraft/server/EntityAreaEffectCloud.java
|
|
@@ -13,6 +13,10 @@
|
|
import javax.annotation.Nullable;
|
|
import org.apache.logging.log4j.LogManager;
|
|
import org.apache.logging.log4j.Logger;
|
|
+// CraftBukkit start
|
|
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
|
+import org.bukkit.entity.LivingEntity;
|
|
+// CraftBukkit end
|
|
|
|
public class EntityAreaEffectCloud extends Entity {
|
|
|
|
@@ -105,6 +109,22 @@
|
|
|
|
}
|
|
|
|
+ // CraftBukkit start accessor methods
|
|
+ public void refreshEffects() {
|
|
+ if (!this.hasColor) {
|
|
+ this.getDataWatcher().set(EntityAreaEffectCloud.COLOR, PotionUtil.a((Collection) PotionUtil.a(this.potionRegistry, (Collection) this.effects))); // PAIL: rename
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public String getType() {
|
|
+ return ((MinecraftKey) IRegistry.POTION.getKey(this.potionRegistry)).toString();
|
|
+ }
|
|
+
|
|
+ public void setType(String string) {
|
|
+ a(IRegistry.POTION.get(new MinecraftKey(string)));
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
public int getColor() {
|
|
return (Integer) this.getDataWatcher().get(EntityAreaEffectCloud.COLOR);
|
|
}
|
|
@@ -249,6 +269,7 @@
|
|
if (!list1.isEmpty()) {
|
|
Iterator iterator2 = list1.iterator();
|
|
|
|
+ List<LivingEntity> entities = new java.util.ArrayList<LivingEntity>(); // CraftBukkit
|
|
while (iterator2.hasNext()) {
|
|
EntityLiving entityliving = (EntityLiving) iterator2.next();
|
|
|
|
@@ -258,6 +279,17 @@
|
|
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 (!event.isCancelled()) {
|
|
+ for (LivingEntity entity : event.getAffectedEntities()) {
|
|
+ if (entity instanceof CraftLivingEntity) {
|
|
+ EntityLiving entityliving = ((CraftLivingEntity) entity).getHandle();
|
|
+ // CraftBukkit end
|
|
this.affectedEntities.put(entityliving, this.ticksLived + this.reapplicationDelay);
|
|
Iterator iterator3 = list.iterator();
|
|
|
|
@@ -267,7 +299,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
|
|
}
|
|
}
|
|
|