diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/Ability.java b/src/main/java/kamkeel/npcs/controllers/data/ability/Ability.java index 9e2482fc6..891558b96 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/Ability.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/Ability.java @@ -103,7 +103,7 @@ public abstract class Ability implements IAbility { protected boolean ignoreCooldown = false; // Configurable potion effects - protected List effects = new ArrayList<>(); + protected List effects = new ArrayList<>(); // Burst protected boolean burstEnabled = false; @@ -378,7 +378,7 @@ public abstract class Ability implements IAbility { if (entity == null || effects.isEmpty()) { return; } - for (AbilityEffect effect : effects) { + for (AbilityPotionEffect effect : effects) { effect.apply(entity); } } @@ -1164,7 +1164,7 @@ public abstract class Ability implements IAbility { // Effects NBTTagList effectList = new NBTTagList(); - for (AbilityEffect effect : effects) { + for (AbilityPotionEffect effect : effects) { effectList.appendTag(effect.writeNBT()); } nbt.setTag("effects", effectList); @@ -1235,7 +1235,7 @@ public abstract class Ability implements IAbility { if (nbt.hasKey("effects")) { NBTTagList effectList = nbt.getTagList("effects", 10); for (int i = 0; i < effectList.tagCount(); i++) { - AbilityEffect effect = AbilityEffect.fromNBT(effectList.getCompoundTagAt(i)); + AbilityPotionEffect effect = AbilityPotionEffect.fromNBT(effectList.getCompoundTagAt(i)); if (effect != null && effect.isValid()) { effects.add(effect); } @@ -1727,15 +1727,15 @@ public abstract class Ability implements IAbility { this.ignoreCooldown = ignoreCooldown; } - public List getEffects() { + public List getEffects() { return effects; } - public void setEffects(List effects) { + public void setEffects(List effects) { this.effects = effects != null ? effects : new ArrayList<>(); } - public void addEffect(AbilityEffect effect) { + public void addEffect(AbilityPotionEffect effect) { if (effect != null && effect.isValid()) { effects.add(effect); } diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityEffect.java b/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityPotionEffect.java similarity index 87% rename from src/main/java/kamkeel/npcs/controllers/data/ability/AbilityEffect.java rename to src/main/java/kamkeel/npcs/controllers/data/ability/AbilityPotionEffect.java index e2c1da87d..cb2984946 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityEffect.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityPotionEffect.java @@ -9,17 +9,17 @@ import noppes.npcs.constants.EnumPotionType; * Represents a configurable potion effect that can be applied by abilities. * Uses the unified EnumPotionType enum shared across melee, ranged, and ability systems. */ -public class AbilityEffect { +public class AbilityPotionEffect { private EnumPotionType type = EnumPotionType.None; private int manualPotionId = 0; private int durationTicks = 60; private int amplifier = 0; // 0-10 - public AbilityEffect() { + public AbilityPotionEffect() { } - public AbilityEffect(EnumPotionType type, int durationTicks, int amplifier) { + public AbilityPotionEffect(EnumPotionType type, int durationTicks, int amplifier) { this.type = type; this.durationTicks = Math.max(1, durationTicks); this.amplifier = Math.max(0, Math.min(10, amplifier)); @@ -28,8 +28,8 @@ public class AbilityEffect { /** * Creates a copy of this effect. */ - public AbilityEffect copy() { - AbilityEffect copy = new AbilityEffect(type, durationTicks, amplifier); + public AbilityPotionEffect copy() { + AbilityPotionEffect copy = new AbilityPotionEffect(type, durationTicks, amplifier); copy.manualPotionId = this.manualPotionId; return copy; } @@ -81,10 +81,10 @@ public class AbilityEffect { } /** - * Creates an AbilityEffect from NBT. + * Creates an AbilityPotionEffect from NBT. */ - public static AbilityEffect fromNBT(NBTTagCompound nbt) { - AbilityEffect effect = new AbilityEffect(); + public static AbilityPotionEffect fromNBT(NBTTagCompound nbt) { + AbilityPotionEffect effect = new AbilityPotionEffect(); effect.readNBT(nbt); return effect; } diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/gui/AbilityFieldBuilder.java b/src/main/java/kamkeel/npcs/controllers/data/ability/gui/AbilityFieldBuilder.java index 219479614..d41418d91 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/gui/AbilityFieldBuilder.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/gui/AbilityFieldBuilder.java @@ -2,7 +2,7 @@ package kamkeel.npcs.controllers.data.ability.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import kamkeel.npcs.controllers.data.ability.AbilityEffect; +import kamkeel.npcs.controllers.data.ability.AbilityPotionEffect; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiButton; import noppes.npcs.client.gui.builder.FieldDef; @@ -55,14 +55,14 @@ public class AbilityFieldBuilder extends GuiFieldBuilder { sw.addLabel(new GuiNpcLabel(labelId++, def.getLabel(), colLLabel, y + 2, 0xFFFF55)); y += 15; - List effects = (List) def.getValue(); + List effects = (List) def.getValue(); if (effects == null) effects = new ArrayList<>(); String[] typeNames = EnumPotionType.getLangKeysNoNone(); String[] ampValues = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}; for (int e = 0; e < effects.size() && e < 5; e++) { - AbilityEffect effect = effects.get(e); + AbilityPotionEffect effect = effects.get(e); // Type selector button (index offset by -1 since None is excluded) int typeIdx = effect.getType().ordinal() - 1; @@ -144,7 +144,7 @@ public class AbilityFieldBuilder extends GuiFieldBuilder { FieldDef def = buttonFieldMap.get(buttonId); if (def == null) def = clearFieldMap.get(buttonId); if (def != null && def.getType() == FieldType.EFFECTS_LIST) { - List effects = (List) def.getValue(); + List effects = (List) def.getValue(); if (effects == null) return false; int effectIdx = meta[0]; int action = meta[1]; @@ -167,7 +167,7 @@ public class AbilityFieldBuilder extends GuiFieldBuilder { return true; case 4: // Add if (effects.size() < 5) { - effects.add(new AbilityEffect(EnumPotionType.Slowness, 60, 0)); + effects.add(new AbilityPotionEffect(EnumPotionType.Slowness, 60, 0)); } return true; } @@ -184,7 +184,7 @@ public class AbilityFieldBuilder extends GuiFieldBuilder { if (meta != null) { FieldDef def = textFieldMap.get(textFieldId); if (def != null && def.getType() == FieldType.EFFECTS_LIST) { - List effects = (List) def.getValue(); + List effects = (List) def.getValue(); if (effects != null && meta[0] < effects.size()) { if (meta[1] == 1) { // duration field effects.get(meta[0]).setDurationTicks(field.getInteger()); diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/gui/AbilityFieldDefs.java b/src/main/java/kamkeel/npcs/controllers/data/ability/gui/AbilityFieldDefs.java index 6e419b943..be7b29aa6 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/gui/AbilityFieldDefs.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/gui/AbilityFieldDefs.java @@ -2,7 +2,7 @@ package kamkeel.npcs.controllers.data.ability.gui; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import kamkeel.npcs.controllers.data.ability.AbilityEffect; +import kamkeel.npcs.controllers.data.ability.AbilityPotionEffect; import noppes.npcs.client.gui.builder.FieldDef; import noppes.npcs.client.gui.builder.FieldType; @@ -18,10 +18,10 @@ import java.util.function.Supplier; public class AbilityFieldDefs { @SuppressWarnings("unchecked") - public static FieldDef effectsListField(String label, Supplier> getter, Consumer> setter) { + public static FieldDef effectsListField(String label, Supplier> getter, Consumer> setter) { return FieldDef.custom(label, FieldType.EFFECTS_LIST, () -> getter.get(), - v -> setter.accept((List) v)); + v -> setter.accept((List) v)); } } diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityTrap.java b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityTrap.java index 62471c051..a8782122f 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityTrap.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityTrap.java @@ -1,6 +1,6 @@ package kamkeel.npcs.controllers.data.ability.type; -import kamkeel.npcs.controllers.data.ability.AbilityEffect; +import kamkeel.npcs.controllers.data.ability.AbilityPotionEffect; import kamkeel.npcs.controllers.data.ability.data.EnergyDisplayData; import kamkeel.npcs.controllers.data.ability.gui.AbilityFieldDefs; import kamkeel.npcs.entity.EntityAbilityZone; @@ -119,7 +119,7 @@ public class AbilityTrap extends AbilityZone implements IAbilityTrap { particleMotion = 1; particleDir = "mc:mobSpell"; colorData.innerColor = 0x44DD44; colorData.outerColor = 0x116611; windUpColor = 0x6044DD44; activeColor = 0xC044FF44; - effects.add(new AbilityEffect(EnumPotionType.Poison, 100, 0)); + effects.add(new AbilityPotionEffect(EnumPotionType.Poison, 100, 0)); break; case "EXPLOSIVE": groundAlpha = 0.04f; @@ -127,7 +127,7 @@ public class AbilityTrap extends AbilityZone implements IAbilityTrap { particleMotion = 0; particleDir = "mc:smoke"; colorData.innerColor = 0xFF6611; colorData.outerColor = 0xCC2200; windUpColor = 0x60FF6611; activeColor = 0xC0FF4400; - effects.add(new AbilityEffect(EnumPotionType.Fire, 60, 0)); + effects.add(new AbilityPotionEffect(EnumPotionType.Fire, 60, 0)); break; case "CURSED": groundAlpha = 0.04f; @@ -135,7 +135,7 @@ public class AbilityTrap extends AbilityZone implements IAbilityTrap { particleMotion = 1; particleDir = "mc:portal"; colorData.innerColor = 0xAA44FF; colorData.outerColor = 0x6622BB; windUpColor = 0x60AA44FF; activeColor = 0xC0CC66FF; - effects.add(new AbilityEffect(EnumPotionType.Weakness, 100, 0)); + effects.add(new AbilityPotionEffect(EnumPotionType.Weakness, 100, 0)); break; case "SHOCK": groundAlpha = 0.04f; @@ -143,7 +143,7 @@ public class AbilityTrap extends AbilityZone implements IAbilityTrap { particleMotion = 2; particleDir = "mc:enchantmenttable"; colorData.innerColor = 0x4488FF; colorData.outerColor = 0x2244BB; windUpColor = 0x604488FF; activeColor = 0xC066AAFF; - effects.add(new AbilityEffect(EnumPotionType.MiningFatigue, 80, 1)); + effects.add(new AbilityPotionEffect(EnumPotionType.MiningFatigue, 80, 1)); break; case "SNARE": groundAlpha = 0.04f; @@ -151,7 +151,7 @@ public class AbilityTrap extends AbilityZone implements IAbilityTrap { particleMotion = 1; particleDir = "mc:snowshovel"; colorData.innerColor = 0x88CCFF; colorData.outerColor = 0x4488CC; windUpColor = 0x6088CCFF; activeColor = 0xC0AADDFF; - effects.add(new AbilityEffect(EnumPotionType.Slowness, 100, 1)); + effects.add(new AbilityPotionEffect(EnumPotionType.Slowness, 100, 1)); break; case "HIDDEN": default: diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityZone.java b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityZone.java index 0d4b0ce8f..b75e41c3e 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityZone.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityZone.java @@ -1,14 +1,13 @@ package kamkeel.npcs.controllers.data.ability.type; import kamkeel.npcs.controllers.data.ability.Ability; -import kamkeel.npcs.controllers.data.ability.AbilityEffect; +import kamkeel.npcs.controllers.data.ability.AbilityPotionEffect; import kamkeel.npcs.controllers.data.ability.LockMovementType; import kamkeel.npcs.controllers.data.ability.TargetingMode; import kamkeel.npcs.controllers.data.ability.UserType; import kamkeel.npcs.controllers.data.ability.data.EnergyDisplayData; import kamkeel.npcs.controllers.data.telegraph.Telegraph; import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance; -import kamkeel.npcs.controllers.data.telegraph.TelegraphType; import kamkeel.npcs.entity.EntityAbilityZone; import kamkeel.npcs.entity.EntityAbilityZone.AccentStyle; import kamkeel.npcs.entity.EntityAbilityZone.ParticleMotion; @@ -220,7 +219,7 @@ public abstract class AbilityZone extends Ability { particleMotion = 1; particleGlow = true; particleDir = "mc:mobSpell"; colorData.innerColor = 0x44DD44; colorData.outerColor = 0x116611; windUpColor = 0x6044DD44; activeColor = 0xC044FF44; - effects.add(new AbilityEffect(EnumPotionType.Poison, 100, 0)); + effects.add(new AbilityPotionEffect(EnumPotionType.Poison, 100, 0)); break; case "INFERNO": groundFill = true; groundAlpha = 0.35f; rings = true; ringCount = 3; @@ -229,7 +228,7 @@ public abstract class AbilityZone extends Ability { particleMotion = 0; particleGlow = true; particleDir = "mc:flame"; colorData.innerColor = 0xFF6611; colorData.outerColor = 0xCC2200; windUpColor = 0x60FF6611; activeColor = 0xC0FF4400; - effects.add(new AbilityEffect(EnumPotionType.Fire, 60, 0)); + effects.add(new AbilityPotionEffect(EnumPotionType.Fire, 60, 0)); break; case "ARCANE": groundFill = true; groundAlpha = 0.20f; rings = true; ringCount = 1; @@ -238,7 +237,7 @@ public abstract class AbilityZone extends Ability { particleMotion = 1; particleGlow = true; particleDir = "mc:portal"; colorData.innerColor = 0xAA44FF; colorData.outerColor = 0x6622BB; windUpColor = 0x60AA44FF; activeColor = 0xC0CC66FF; - effects.add(new AbilityEffect(EnumPotionType.Weakness, 100, 0)); + effects.add(new AbilityPotionEffect(EnumPotionType.Weakness, 100, 0)); break; case "ELECTRIC": groundFill = true; groundAlpha = 0.15f; rings = false; ringCount = 1; @@ -247,7 +246,7 @@ public abstract class AbilityZone extends Ability { particleMotion = 2; particleGlow = true; particleDir = "mc:enchantmenttable"; colorData.innerColor = 0x4488FF; colorData.outerColor = 0x2244BB; windUpColor = 0x604488FF; activeColor = 0xC066AAFF; - effects.add(new AbilityEffect(EnumPotionType.MiningFatigue, 80, 1)); + effects.add(new AbilityPotionEffect(EnumPotionType.MiningFatigue, 80, 1)); break; case "FROST": groundFill = true; groundAlpha = 0.25f; rings = true; ringCount = 3; @@ -256,7 +255,7 @@ public abstract class AbilityZone extends Ability { particleMotion = 1; particleGlow = true; particleDir = "mc:snowshovel"; colorData.innerColor = 0x88CCFF; colorData.outerColor = 0x4488CC; windUpColor = 0x6088CCFF; activeColor = 0xC0AADDFF; - effects.add(new AbilityEffect(EnumPotionType.Slowness, 100, 1)); + effects.add(new AbilityPotionEffect(EnumPotionType.Slowness, 100, 1)); break; case "DEFAULT": groundFill = true; groundAlpha = 0.25f; rings = true; ringCount = 3; diff --git a/src/main/java/kamkeel/npcs/entity/EntityAbilityZone.java b/src/main/java/kamkeel/npcs/entity/EntityAbilityZone.java index 34156e362..11eaade79 100644 --- a/src/main/java/kamkeel/npcs/entity/EntityAbilityZone.java +++ b/src/main/java/kamkeel/npcs/entity/EntityAbilityZone.java @@ -6,7 +6,7 @@ import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import io.netty.buffer.ByteBuf; import kamkeel.npcs.controllers.data.ability.Ability; -import kamkeel.npcs.controllers.data.ability.AbilityEffect; +import kamkeel.npcs.controllers.data.ability.AbilityPotionEffect; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; @@ -121,7 +121,7 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD private boolean particleGlow = true; private long deathWorldTime = -1; - private List effects = new ArrayList<>(); + private List effects = new ArrayList<>(); // ═══════════════════════════════════════════════════════════════════ // TRAP-SPECIFIC PROPERTIES @@ -194,7 +194,7 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD float particleDensity, float particleScale, float animSpeed, float lightningDensity, boolean visible, - List effects) { + List effects) { EntityAbilityZone zone = new EntityAbilityZone(world, ZoneType.TRAP, owner, x, y, z); zone.shape = shape; zone.radius = triggerRadius; @@ -217,7 +217,7 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD zone.lightningDensity = lightningDensity; zone.visible = visible; if (effects != null) { - for (AbilityEffect e : effects) { + for (AbilityPotionEffect e : effects) { zone.effects.add(e.copy()); } } @@ -236,7 +236,7 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD float zoneHeight, float particleDensity, float particleScale, float animSpeed, float lightningDensity, - List effects) { + List effects) { EntityAbilityZone zone = new EntityAbilityZone(world, ZoneType.HAZARD, owner, x, y, z); zone.shape = shape; zone.radius = radius; @@ -255,7 +255,7 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD zone.animSpeed = animSpeed; zone.lightningDensity = lightningDensity; if (effects != null) { - for (AbilityEffect e : effects) { + for (AbilityPotionEffect e : effects) { zone.effects.add(e.copy()); } } @@ -499,7 +499,7 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD private void applyEffects(EntityLivingBase entity) { if (entity == null || effects.isEmpty()) return; - for (AbilityEffect effect : effects) { + for (AbilityPotionEffect effect : effects) { effect.apply(entity); } } @@ -668,7 +668,7 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD if (nbt.hasKey("Effects")) { NBTTagList effectList = nbt.getTagList("Effects", 10); for (int i = 0; i < effectList.tagCount(); i++) { - AbilityEffect effect = AbilityEffect.fromNBT(effectList.getCompoundTagAt(i)); + AbilityPotionEffect effect = AbilityPotionEffect.fromNBT(effectList.getCompoundTagAt(i)); if (effect != null && effect.isValid()) { effects.add(effect); } @@ -728,7 +728,7 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD // Effects NBTTagList effectList = new NBTTagList(); - for (AbilityEffect effect : effects) { + for (AbilityPotionEffect effect : effects) { effectList.appendTag(effect.writeNBT()); } nbt.setTag("Effects", effectList); @@ -778,7 +778,7 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD // Effects NBTTagCompound effectsNbt = new NBTTagCompound(); NBTTagList effectList = new NBTTagList(); - for (AbilityEffect effect : effects) { + for (AbilityPotionEffect effect : effects) { effectList.appendTag(effect.writeNBT()); } effectsNbt.setTag("Effects", effectList); @@ -832,7 +832,7 @@ public class EntityAbilityZone extends Entity implements IEntityAdditionalSpawnD if (effectsNbt != null && effectsNbt.hasKey("Effects")) { NBTTagList effectList = effectsNbt.getTagList("Effects", 10); for (int i = 0; i < effectList.tagCount(); i++) { - AbilityEffect effect = AbilityEffect.fromNBT(effectList.getCompoundTagAt(i)); + AbilityPotionEffect effect = AbilityPotionEffect.fromNBT(effectList.getCompoundTagAt(i)); if (effect != null && effect.isValid()) { effects.add(effect); } diff --git a/src/main/java/kamkeel/npcs/entity/EntityEnergyProjectile.java b/src/main/java/kamkeel/npcs/entity/EntityEnergyProjectile.java index 32ffcec5a..9b111bde9 100644 --- a/src/main/java/kamkeel/npcs/entity/EntityEnergyProjectile.java +++ b/src/main/java/kamkeel/npcs/entity/EntityEnergyProjectile.java @@ -3,7 +3,7 @@ package kamkeel.npcs.entity; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import kamkeel.npcs.controllers.data.ability.AbilityController; -import kamkeel.npcs.controllers.data.ability.AbilityEffect; +import kamkeel.npcs.controllers.data.ability.AbilityPotionEffect; import kamkeel.npcs.controllers.data.ability.AnchorPoint; import kamkeel.npcs.controllers.data.ability.data.*; import kamkeel.npcs.util.AnchorPointHelper; @@ -77,7 +77,7 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility { protected EnergyCombatData combatData = new EnergyCombatData(); // ==================== EFFECT PROPERTIES ==================== - protected List effects = new ArrayList<>(); + protected List effects = new ArrayList<>(); // ==================== ANCHOR PROPERTIES ==================== protected EnergyAnchorData anchorData = new EnergyAnchorData(AnchorPoint.FRONT); @@ -416,7 +416,7 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility { } protected void applyEffects(EntityLivingBase target) { - for (AbilityEffect effect : effects) { + for (AbilityPotionEffect effect : effects) { effect.apply(target); } } @@ -424,7 +424,7 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility { /** * Set the effects list from the ability's configured effects. */ - public void setEffects(List effects) { + public void setEffects(List effects) { this.effects = effects != null ? effects : new ArrayList<>(); } @@ -789,7 +789,7 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility { if (nbt.hasKey("Effects")) { NBTTagList effectsList = nbt.getTagList("Effects", 10); // 10 = compound tag for (int i = 0; i < effectsList.tagCount(); i++) { - effects.add(AbilityEffect.fromNBT(effectsList.getCompoundTagAt(i))); + effects.add(AbilityPotionEffect.fromNBT(effectsList.getCompoundTagAt(i))); } } @@ -828,7 +828,7 @@ public abstract class EntityEnergyProjectile extends EntityEnergyAbility { // Write effects list if (!effects.isEmpty()) { NBTTagList effectsList = new NBTTagList(); - for (AbilityEffect effect : effects) { + for (AbilityPotionEffect effect : effects) { effectsList.appendTag(effect.writeNBT()); } nbt.setTag("Effects", effectsList);