mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-12 17:47:32 +00:00
- Added standalone min max methods to FieldDef
- Increased lightning density and radius minmax on all energy abilities - Made AbilityOrbBarrage interruptible during active state - Renamed AbilityEnergyBeam to AbilityBeam - Updated imports
This commit is contained in:
1 parent
1a8b8fb5f3
commit
2d47aa00d8
11 files changed
+67
-32
No files matched your search
@@ -2,7 +2,6 @@ package kamkeel.npcs.controllers.data.ability;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import kamkeel.npcs.controllers.data.ability.type.AbilityGuard;
|
||||
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphInstance;
|
||||
import kamkeel.npcs.controllers.data.telegraph.TelegraphType;
|
||||
@@ -36,7 +35,6 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import somehussar.gui.annotationHandling.GuiEditable;
|
||||
|
||||
public abstract class Ability implements IAbility {
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ public class AbilityController implements IAbilityHandler {
|
||||
registerType("cnpc:dual_disc", AbilityDisc::new);
|
||||
registerType("cnpc:dual_disc", AbilityDiscDual::new);
|
||||
registerType("cnpc:laser_shot", AbilityLaserShot::new);
|
||||
registerType("cnpc:beam", AbilityEnergyBeam::new);
|
||||
registerType("cnpc:beam", AbilityBeam::new);
|
||||
registerType("cnpc:dual_beam", AbilityBeamDual::new);
|
||||
|
||||
// Movement abilities
|
||||
|
||||
+4
-4
@@ -30,7 +30,7 @@ import noppes.npcs.entity.EntityNPCInterface;
|
||||
* The beam stays attached to the origin and curves as it homes in on target.
|
||||
* Cannot cross over itself (self-intersection prevention).
|
||||
*/
|
||||
public class AbilityEnergyBeam extends Ability implements IAbilityEnergyBeam {
|
||||
public class AbilityBeam extends Ability implements IAbilityEnergyBeam {
|
||||
|
||||
// Shape properties (standalone)
|
||||
private float beamWidth = 0.4f;
|
||||
@@ -47,7 +47,7 @@ public class AbilityEnergyBeam extends Ability implements IAbilityEnergyBeam {
|
||||
// Transient state for beam entity (used during windup charging)
|
||||
private transient EntityAbilityBeam beamEntity = null;
|
||||
|
||||
public AbilityEnergyBeam() {
|
||||
public AbilityBeam() {
|
||||
this.typeId = "ability.cnpc.beam";
|
||||
this.name = "Beam";
|
||||
this.targetingMode = TargetingMode.AGGRO_TARGET;
|
||||
@@ -331,9 +331,9 @@ public class AbilityEnergyBeam extends Ability implements IAbilityEnergyBeam {
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density", this::getLightningDensity, this::setLightningDensity)
|
||||
.range(0.01f, 5.0f).visibleWhen(this::hasLightningEffect),
|
||||
.range(0.01f, 100f).visibleWhen(this::hasLightningEffect),
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
.range(0.1f, 100f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
));
|
||||
}
|
||||
@@ -444,10 +444,10 @@ public class AbilityBeamDual extends Ability {
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density",
|
||||
() -> getLightningDensity(0), v -> setLightningDensity(0, v))
|
||||
.range(0.01f, 5.0f).visibleWhen(() -> hasLightningEffect(0)),
|
||||
.range(0.01f, 100f).visibleWhen(() -> hasLightningEffect(0)),
|
||||
FieldDef.floatField("gui.radius",
|
||||
() -> getLightningRadius(0), v -> setLightningRadius(0, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(0))
|
||||
.range(0.1f, 100f).visibleWhen(() -> hasLightningEffect(0))
|
||||
).tab("ability.tab.visual"),
|
||||
// Visual tab - Beam 2
|
||||
FieldDef.enumField("ability.anchorPoint", AnchorPoint.class,
|
||||
@@ -480,10 +480,10 @@ public class AbilityBeamDual extends Ability {
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density",
|
||||
() -> getLightningDensity(1), v -> setLightningDensity(1, v))
|
||||
.range(0.01f, 5.0f).visibleWhen(() -> hasLightningEffect(1)),
|
||||
.range(0.01f, 100f).visibleWhen(() -> hasLightningEffect(1)),
|
||||
FieldDef.floatField("gui.radius",
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
.range(0.1f, 100f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
));
|
||||
}
|
||||
|
||||
@@ -329,9 +329,9 @@ public class AbilityDisc extends Ability implements IAbilityDisc {
|
||||
.tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density", this::getLightningDensity, this::setLightningDensity)
|
||||
.range(0.01f, 5.0f).visibleWhen(this::hasLightningEffect),
|
||||
.range(0.01f, 100f).visibleWhen(this::hasLightningEffect),
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
.range(0.1f, 100f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
));
|
||||
}
|
||||
|
||||
@@ -490,10 +490,10 @@ public class AbilityDiscDual extends Ability {
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density",
|
||||
() -> getLightningDensity(1), v -> setLightningDensity(1, v))
|
||||
.range(0.01f, 5.0f).visibleWhen(() -> hasLightningEffect(1)),
|
||||
.range(0.01f, 100f).visibleWhen(() -> hasLightningEffect(1)),
|
||||
FieldDef.floatField("gui.radius",
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
.range(0.1f, 100f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
));
|
||||
}
|
||||
|
||||
@@ -286,9 +286,9 @@ public class AbilityLaserShot extends Ability implements IAbilityLaserShot {
|
||||
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect).tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density", this::getLightningDensity, this::setLightningDensity)
|
||||
.range(0.01f, 5.0f).visibleWhen(this::hasLightningEffect),
|
||||
.range(0.01f, 100f).visibleWhen(this::hasLightningEffect),
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
.range(0.1f, 100f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
));
|
||||
}
|
||||
|
||||
@@ -455,9 +455,9 @@ public class AbilityOrb extends Ability implements IAbilityOrb {
|
||||
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect).tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density", this::getLightningDensity, this::setLightningDensity)
|
||||
.range(0.01f, 5.0f).visibleWhen(this::hasLightningEffect),
|
||||
.visibleWhen(this::hasLightningEffect).range(0.01f, 100f),
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
.range(0.1f, 100f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import kamkeel.npcs.util.AnchorPointHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.Constants;
|
||||
@@ -182,19 +183,36 @@ public class AbilityOrbBarrage extends Ability {
|
||||
currentOrb++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInterrupt(DamageSource source) {
|
||||
// Can be interrupted if the caster is hit when the beam is moving
|
||||
if (!interruptible) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Only direct physical hits can interrupt, not magic, fire, or other indirect damage
|
||||
if (source == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reject indirect damage types
|
||||
if (source.isMagicDamage() || source.isFireDamage() || source.isExplosion()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reject damage without a direct attacker entity
|
||||
if (source.getEntity() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Direct hit from an entity - can interrupt
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanup() {
|
||||
currentOrb = 0;
|
||||
|
||||
if (orbEntities != null && !orbEntities.isEmpty()) {
|
||||
for (EntityAbilityOrb orbEntity : orbEntities) {
|
||||
if (orbEntity != null && !orbEntity.isDead) {
|
||||
orbEntity.setDead();
|
||||
}
|
||||
}
|
||||
orbEntities.clear();
|
||||
}
|
||||
|
||||
if (chargingEntities != null) {
|
||||
for (int i = 0; i < chargingEntities.length; i++) {
|
||||
if (chargingEntities[i] != null && !chargingEntities[i].isDead) {
|
||||
@@ -204,6 +222,15 @@ public class AbilityOrbBarrage extends Ability {
|
||||
}
|
||||
chargingEntities = null;
|
||||
}
|
||||
|
||||
if (orbEntities != null && !orbEntities.isEmpty()) {
|
||||
for (EntityAbilityOrb orbEntity : orbEntities) {
|
||||
if (orbEntity != null && !orbEntity.isDead) {
|
||||
orbEntity.setDead();
|
||||
}
|
||||
}
|
||||
orbEntities.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -567,9 +594,9 @@ public class AbilityOrbBarrage extends Ability {
|
||||
FieldDef.boolField("ability.lightning", this::hasLightningEffect, this::setLightningEffect).tab("ability.tab.visual"),
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density", this::getLightningDensity, this::setLightningDensity)
|
||||
.range(0.01f, 5.0f).visibleWhen(this::hasLightningEffect),
|
||||
.range(0.01f, 100f).visibleWhen(this::hasLightningEffect),
|
||||
FieldDef.floatField("gui.radius", this::getLightningRadius, this::setLightningRadius)
|
||||
.range(0.1f, 10.0f).visibleWhen(this::hasLightningEffect)
|
||||
.range(0.1f, 100f).visibleWhen(this::hasLightningEffect)
|
||||
).tab("ability.tab.visual")
|
||||
));
|
||||
}
|
||||
|
||||
@@ -550,10 +550,10 @@ public class AbilityOrbDual extends Ability {
|
||||
FieldDef.row(
|
||||
FieldDef.floatField("gui.density",
|
||||
() -> getLightningDensity(1), v -> setLightningDensity(1, v))
|
||||
.range(0.01f, 5.0f).visibleWhen(() -> hasLightningEffect(1)),
|
||||
.range(0.01f, 100f).visibleWhen(() -> hasLightningEffect(1)),
|
||||
FieldDef.floatField("gui.radius",
|
||||
() -> getLightningRadius(1), v -> setLightningRadius(1, v))
|
||||
.range(0.1f, 10.0f).visibleWhen(() -> hasLightningEffect(1))
|
||||
.range(0.1f, 100f).visibleWhen(() -> hasLightningEffect(1))
|
||||
).tab("ability.tab.visual")
|
||||
));
|
||||
}
|
||||
|
||||
@@ -220,6 +220,16 @@ public class FieldDef {
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef min(float min) {
|
||||
this.min = min;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef max(float max) {
|
||||
this.max = max;
|
||||
return this;
|
||||
}
|
||||
|
||||
public FieldDef visibleWhen(BooleanSupplier condition) {
|
||||
this.visibleWhen = condition;
|
||||
return this;
|
||||
|
||||
Reference in new issue
Block a user