mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 16:54:30 +00:00
Fixes to some GUI and Chained Abiltiy Logic for Clearing States
This commit is contained in:
1 parent
48f6c162d5
commit
40a02b73e2
8 files changed
+196
-65
No files matched your search
@@ -14,6 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import noppes.npcs.DataAbilities;
|
||||
import noppes.npcs.NpcDamageSource;
|
||||
@@ -281,6 +282,17 @@ public abstract class Ability implements IAbility, IAbilityAction {
|
||||
public void onComplete(EntityLivingBase caster, EntityLivingBase target) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when the ability enters BURST_DELAY between burst iterations.
|
||||
* Override in subclasses to reset transient state that should not carry
|
||||
* across burst repetitions (e.g., movement direction, hit entity lists).
|
||||
* <p>
|
||||
* Unlike {@link #cleanup()}, this does NOT kill spawned entities (they may
|
||||
* still be in flight for overlap mode).
|
||||
*/
|
||||
public void resetForBurst() {
|
||||
}
|
||||
|
||||
public void onDamageTaken(EntityLivingBase caster, EntityLivingBase attacker, DamageSource source, float damage) {
|
||||
}
|
||||
|
||||
@@ -535,6 +547,10 @@ public abstract class Ability implements IAbility, IAbilityAction {
|
||||
.tab("General"));
|
||||
defs.add(FieldDef.stringField("gui.displayName", this::getRawDisplayName, this::setDisplayName)
|
||||
.tab("General"));
|
||||
defs.add(FieldDef.labelField("ability.validFor", () ->
|
||||
StatCollector.translateToLocal("ability.validFor") + ": \u00A7e"
|
||||
+ StatCollector.translateToLocal("ability.userType." + getAllowedBy().name()))
|
||||
.tab("General"));
|
||||
defs.add(FieldDef.row(
|
||||
FieldDef.intField("ability.weight", this::getWeight, this::setWeight).range(1, 1000),
|
||||
FieldDef.boolField("gui.enabled", this::isEnabled, this::setEnabled)
|
||||
@@ -979,9 +995,9 @@ public abstract class Ability implements IAbility, IAbilityAction {
|
||||
if (phase == AbilityPhase.ACTIVE) {
|
||||
// Check if more burst iterations remain
|
||||
if (burstEnabled && burstAmount > 0 && burstIndex < burstAmount) {
|
||||
// Don't cleanup here - entities may still be in flight
|
||||
// For non-overlap: cleaned up when next burst starts (in onExecute)
|
||||
// For overlap: entities continue flying indefinitely
|
||||
// Reset transient state for next burst iteration (e.g., movement direction, hit lists)
|
||||
// Does NOT kill entities - they may still be in flight (overlap mode)
|
||||
resetForBurst();
|
||||
burstIndex++;
|
||||
phase = AbilityPhase.BURST_DELAY;
|
||||
currentTick = 0;
|
||||
|
||||
@@ -171,6 +171,12 @@ public class AbilityCharge extends AbilityMovement implements IAbilityCharge {
|
||||
hitEntities.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetForBurst() {
|
||||
super.resetForBurst();
|
||||
hitEntities.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getTelegraphLength() {
|
||||
return maxRange;
|
||||
|
||||
@@ -196,6 +196,12 @@ public class AbilityDash extends AbilityMovement implements IAbilityDash {
|
||||
chosenDirection = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetForBurst() {
|
||||
super.resetForBurst();
|
||||
chosenDirection = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxPreviewDuration() {
|
||||
return (int) Math.ceil(dashDistance / dashSpeed) + 5;
|
||||
|
||||
@@ -53,6 +53,12 @@ public abstract class AbilityMovement extends Ability {
|
||||
maxActiveTicks = 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resetForBurst() {
|
||||
movementDirection = null;
|
||||
maxActiveTicks = 0;
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
// DIRECTION HELPERS
|
||||
// ═══════════════════════════════════════════════════════════════════
|
||||
|
||||
+1
@@ -68,6 +68,7 @@ public abstract class AbilityEnergyProjectile<E extends EntityEnergyProjectile>
|
||||
this.homingData = homingData;
|
||||
this.lifespanData = lifespanData;
|
||||
this.trajectoryData = new EnergyTrajectoryData();
|
||||
this.burstOverlap = true;
|
||||
initProjectiles(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user