mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 08:00:02 +03:00
98 lines
4.4 KiB
Diff
98 lines
4.4 KiB
Diff
--- ../src-base/minecraft/net/minecraft/entity/EntityAreaEffectCloud.java
|
|
+++ ../src-work/minecraft/net/minecraft/entity/EntityAreaEffectCloud.java
|
|
@@ -2,6 +2,8 @@
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Maps;
|
|
+
|
|
+import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
@@ -23,7 +25,12 @@
|
|
import net.minecraft.util.math.MathHelper;
|
|
import net.minecraft.world.World;
|
|
import net.minecraft.world.WorldServer;
|
|
+import org.bukkit.craftbukkit.entity.CraftLivingEntity; // CraftBukkit
|
|
+import org.bukkit.entity.LivingEntity; // CraftBukkit
|
|
|
|
+import org.bukkit.craftbukkit.entity.CraftLivingEntity;
|
|
+import org.bukkit.entity.LivingEntity;
|
|
+
|
|
public class EntityAreaEffectCloud extends Entity
|
|
{
|
|
private static final DataParameter<Float> RADIUS = EntityDataManager.<Float>createKey(EntityAreaEffectCloud.class, DataSerializers.FLOAT);
|
|
@@ -33,15 +40,15 @@
|
|
private static final DataParameter<Integer> PARTICLE_PARAM_1 = EntityDataManager.<Integer>createKey(EntityAreaEffectCloud.class, DataSerializers.VARINT);
|
|
private static final DataParameter<Integer> PARTICLE_PARAM_2 = EntityDataManager.<Integer>createKey(EntityAreaEffectCloud.class, DataSerializers.VARINT);
|
|
private PotionType potion;
|
|
- private final List<PotionEffect> effects;
|
|
+ public final List<PotionEffect> effects;
|
|
private final Map<Entity, Integer> reapplicationDelayMap;
|
|
private int duration;
|
|
- private int waitTime;
|
|
- private int reapplicationDelay;
|
|
+ public int waitTime;
|
|
+ public int reapplicationDelay;
|
|
private boolean colorSet;
|
|
- private int durationOnUse;
|
|
- private float radiusOnUse;
|
|
- private float radiusPerTick;
|
|
+ public int durationOnUse;
|
|
+ public float radiusOnUse;
|
|
+ public float radiusPerTick;
|
|
private EntityLivingBase owner;
|
|
private UUID ownerUniqueId;
|
|
|
|
@@ -64,6 +71,21 @@
|
|
this(worldIn);
|
|
this.setPosition(x, y, z);
|
|
}
|
|
+ // CraftBukkit start accessor methods
|
|
+ public void refreshEffects() {
|
|
+ if (!this.colorSet) {
|
|
+ this.getDataManager().set(EntityAreaEffectCloud.COLOR, Integer.valueOf(PotionUtils.getPotionColorFromEffectList(PotionUtils.mergeEffects(this.potion, this.effects)))); // PAIL: rename
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public String getType() {
|
|
+ return PotionType.REGISTRY.getNameForObject(this.potion).toString();
|
|
+ }
|
|
+
|
|
+ public void setType(String string) {
|
|
+ this.setPotion(PotionType.REGISTRY.getObject(new ResourceLocation(string)));
|
|
+ }
|
|
+ // CraftBukkit end
|
|
|
|
protected void entityInit()
|
|
{
|
|
@@ -321,6 +343,7 @@
|
|
|
|
if (!list.isEmpty())
|
|
{
|
|
+ List<LivingEntity> entities = new ArrayList<LivingEntity>(); // CraftBukkit
|
|
for (EntityLivingBase entitylivingbase : list)
|
|
{
|
|
if (!this.reapplicationDelayMap.containsKey(entitylivingbase) && entitylivingbase.canBeHitWithPotion())
|
|
@@ -329,8 +352,18 @@
|
|
double d1 = entitylivingbase.posZ - this.posZ;
|
|
double d2 = d0 * d0 + d1 * d1;
|
|
|
|
- if (d2 <= (double)(f * f))
|
|
- {
|
|
+ if (d2 <= (double)(f * f)) {
|
|
+ // CraftBukkit start
|
|
+ entities.add((LivingEntity) entitylivingbase.getBukkitEntity());
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ org.bukkit.event.entity.AreaEffectCloudApplyEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callAreaEffectCloudApplyEvent(this, entities);
|
|
+ if (true) { // Preserve NMS spacing and bracket count for smallest diff
|
|
+ for (LivingEntity entity : event.getAffectedEntities()) {
|
|
+ if (entity instanceof CraftLivingEntity) {
|
|
+ EntityLivingBase entitylivingbase = ((CraftLivingEntity) entity).getHandle();
|
|
+ // CraftBukkit end
|
|
this.reapplicationDelayMap.put(entitylivingbase, Integer.valueOf(this.ticksExisted + this.reapplicationDelay));
|
|
|
|
for (PotionEffect potioneffect : potions)
|