Added animations to these abilities

This commit is contained in:
Vidal committed 2026-01-27 22:19:26 -03:00
1 parent aeb0093b4d
commit e599ed67f5
6 files changed
+621 -8

No files matched your search

@@ -2,7 +2,6 @@ package kamkeel.npcs.controllers.data.ability;
import noppes.npcs.CustomNpcs;
import noppes.npcs.LogWriter;
import noppes.npcs.api.handler.data.IAnimation;
import noppes.npcs.controllers.data.Animation;
import noppes.npcs.util.NBTJsonUtil;
import org.apache.commons.io.FileUtils;
@@ -13,7 +12,9 @@ import java.util.HashMap;
import static kamkeel.npcs.controllers.data.ability.AbilityPhase.*;
public enum AbilityAnimation {;
public enum AbilityAnimation {
ABILITYORB("Ability_Orb_Windup", WINDUP),
ABILITYBEAM("Ability_Beam_Windup", "Ability_Beam_Active");
private final HashMap<AbilityPhase, String> animationNames = new HashMap<>();
AbilityAnimation(String idle, String windUp, String active, String recovery) {
@@ -49,7 +50,7 @@ public enum AbilityAnimation {;
return getFileFromName(animationNames.get(phase));
}
public IAnimation getAnimation(AbilityPhase phase) {
public Animation getAnimation(AbilityPhase phase) {
try {
File file = getFile(phase);
@@ -68,24 +69,24 @@ public enum AbilityAnimation {;
return null;
}
public IAnimation idle() {
public Animation idle() {
return getAnimation(IDLE);
}
public IAnimation windUp() {
public Animation windUp() {
return getAnimation(WINDUP);
}
public IAnimation active() {
public Animation active() {
return getAnimation(ACTIVE);
}
public IAnimation dazed() {
public Animation dazed() {
return getAnimation(DAZED);
}
private File getFileFromName(String fileName) {
try (InputStream stream = CustomNpcs.class.getResourceAsStream("/internal/data/animations/" + name() + "/" + fileName + ".json")) {
try (InputStream stream = CustomNpcs.class.getResourceAsStream("/internal/animations/" + name() + "/" + fileName + ".json")) {
File file = new File("temp");
@@ -3,6 +3,7 @@ package kamkeel.npcs.controllers.data.ability.type;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import kamkeel.npcs.controllers.data.ability.Ability;
import kamkeel.npcs.controllers.data.ability.AbilityAnimation;
import kamkeel.npcs.controllers.data.ability.AnchorPoint;
import kamkeel.npcs.controllers.data.ability.TargetingMode;
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
@@ -17,6 +18,7 @@ import net.minecraft.world.World;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityEnergyBeam;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.controllers.data.Animation;
import noppes.npcs.entity.EntityNPCInterface;
/**
@@ -70,6 +72,8 @@ public class AbilityEnergyBeam extends Ability {
// Anchor point for charging position
private AnchorPoint anchorPoint = AnchorPoint.FRONT;
private final AbilityAnimation animation = AbilityAnimation.ABILITYBEAM;
// Transient state for beam entity (used during windup charging)
private transient EntityAbilityBeam beamEntity = null;
@@ -308,4 +312,20 @@ public class AbilityEnergyBeam extends Ability {
public void setLightningRadius(float lightningRadius) { this.lightningRadius = lightningRadius; }
public AnchorPoint getAnchorPoint() { return anchorPoint; }
public void setAnchorPoint(AnchorPoint anchorPoint) { this.anchorPoint = anchorPoint; }
@Override
public Animation getWindUpAnimation() {
if (windUpAnimationId == -1)
return animation.windUp();
return super.getWindUpAnimation();
}
@Override
public Animation getActiveAnimation() {
if (activeAnimationId == -1)
return animation.active();
return super.getActiveAnimation();
}
}
@@ -3,6 +3,7 @@ package kamkeel.npcs.controllers.data.ability.type;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import kamkeel.npcs.controllers.data.ability.Ability;
import kamkeel.npcs.controllers.data.ability.AbilityAnimation;
import kamkeel.npcs.controllers.data.ability.AnchorPoint;
import kamkeel.npcs.controllers.data.ability.TargetingMode;
import kamkeel.npcs.controllers.data.telegraph.Telegraph;
@@ -17,6 +18,7 @@ import net.minecraft.world.World;
import noppes.npcs.client.gui.advanced.SubGuiAbilityConfig;
import noppes.npcs.client.gui.advanced.ability.SubGuiAbilityOrb;
import noppes.npcs.client.gui.util.IAbilityConfigCallback;
import noppes.npcs.controllers.data.Animation;
import noppes.npcs.entity.EntityNPCInterface;
/**
@@ -71,6 +73,8 @@ public class AbilityOrb extends Ability {
// Transient state for orb entity (used during windup charging)
private transient EntityAbilityOrb orbEntity = null;
private final AbilityAnimation animation = AbilityAnimation.ABILITYORB;
public AbilityOrb() {
this.typeId = "ability.cnpc.orb";
this.name = "Orb";
@@ -459,4 +463,12 @@ public class AbilityOrb extends Ability {
public void setAnchorPoint(AnchorPoint anchorPoint) {
this.anchorPoint = anchorPoint;
}
@Override
public Animation getWindUpAnimation() {
if (windUpAnimationId != -1)
return super.getWindUpAnimation();
return animation.windUp();
}
}