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();
}
}
@@ -0,0 +1,230 @@
{
"Loop": -1,
"Speed": 1.0f,
"Frames": [
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 1.0f,
"FrameParts": [
{
"Pivot2": -5.0f,
"Part": "LEFT_ARM",
"Rotation1": 107.0f,
"Rotation0": -94.0f,
"Pivot0": -5.0f,
"Pivot1": 3.0f,
"Rotation2": -31.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_ARM",
"Rotation1": 88.0f,
"Rotation0": -56.0f,
"Pivot0": 1.0f,
"Pivot1": 0.0f,
"Rotation2": -18.0f
},
{
"Pivot2": -3.0f,
"Part": "HEAD",
"Rotation1": 12.0f,
"Rotation0": 18.0f,
"Pivot0": -1.0f,
"Pivot1": 1.0f,
"Rotation2": -6.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": 56.0f,
"Rotation0": 6.0f,
"Pivot0": -2.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -3.0f,
"Part": "BODY",
"Rotation1": 25.0f,
"Rotation0": 18.0f,
"Pivot0": -1.0f,
"Pivot1": 1.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -5.0f,
"Part": "LEFT_LEG",
"Rotation1": -25.0f,
"Rotation0": 12.0f,
"Pivot0": 2.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": 0.0f,
"Part": "FULL_MODEL",
"Rotation1": 25.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
}
],
"Smooth": 0b,
"Duration": 5
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 2.0f,
"FrameParts": [
{
"Pivot2": -5.0f,
"Part": "LEFT_ARM",
"Rotation1": 12.0f,
"Rotation0": -75.0f,
"Pivot0": -2.0f,
"Pivot1": 3.0f,
"Rotation2": 50.0f
},
{
"Pivot2": -5.0f,
"Part": "RIGHT_ARM",
"Rotation1": -18.0f,
"Rotation0": -107.0f,
"Pivot0": -1.0f,
"Pivot1": 2.0f,
"Rotation2": 50.0f
},
{
"Pivot2": -3.0f,
"Part": "HEAD",
"Rotation1": 0.0f,
"Rotation0": 0.0f,
"Pivot0": -1.0f,
"Pivot1": 1.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -4.0f,
"Part": "RIGHT_LEG",
"Rotation1": 56.0f,
"Rotation0": 18.0f,
"Pivot0": -4.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -3.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 0.0f,
"Pivot0": -1.0f,
"Pivot1": 1.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -6.0f,
"Part": "LEFT_LEG",
"Rotation1": 0.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": 0.0f,
"Part": "FULL_MODEL",
"Rotation1": 0.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
}
],
"Smooth": 0b,
"Duration": 5
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 0.75f,
"FrameParts": [
{
"Pivot2": -5.0f,
"Part": "LEFT_ARM",
"Rotation1": 12.0f,
"Rotation0": -75.0f,
"Pivot0": -2.0f,
"Pivot1": 3.0f,
"Rotation2": 50.0f
},
{
"Pivot2": -5.0f,
"Part": "RIGHT_ARM",
"Rotation1": -18.0f,
"Rotation0": -107.0f,
"Pivot0": -1.0f,
"Pivot1": 2.0f,
"Rotation2": 50.0f
},
{
"Pivot2": -3.0f,
"Part": "HEAD",
"Rotation1": 0.0f,
"Rotation0": 0.0f,
"Pivot0": -1.0f,
"Pivot1": 1.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -4.0f,
"Part": "RIGHT_LEG",
"Rotation1": 56.0f,
"Rotation0": 18.0f,
"Pivot0": -4.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -3.0f,
"Part": "BODY",
"Rotation1": 0.0f,
"Rotation0": 0.0f,
"Pivot0": -1.0f,
"Pivot1": 1.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -6.0f,
"Part": "LEFT_LEG",
"Rotation1": 0.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": 0.0f,
"Part": "FULL_MODEL",
"Rotation1": 0.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
}
],
"Smooth": 0b,
"Duration": 20
}
],
"CurrentFrameTime": 0,
"CurrentFrame": 0,
"Smooth": 0b,
"ID": 2,
"WhileAttacking": 1b,
"WhileWalking": 1b,
"Name": "Ability_Beam_Active",
"WhileStanding": 1b
}
@@ -0,0 +1,158 @@
{
"Loop": -1,
"Speed": 1.0f,
"Frames": [
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 0.5f,
"FrameParts": [
{
"Pivot2": -5.0f,
"Part": "LEFT_ARM",
"Rotation1": 94.0f,
"Rotation0": -94.0f,
"Pivot0": -4.0f,
"Pivot1": 3.0f,
"Rotation2": -31.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_ARM",
"Rotation1": 75.0f,
"Rotation0": -56.0f,
"Pivot0": 1.0f,
"Pivot1": 0.0f,
"Rotation2": -18.0f
},
{
"Pivot2": -3.0f,
"Part": "HEAD",
"Rotation1": 0.0f,
"Rotation0": 18.0f,
"Pivot0": -1.0f,
"Pivot1": 1.0f,
"Rotation2": -6.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": 50.0f,
"Rotation0": 6.0f,
"Pivot0": -2.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -3.0f,
"Part": "BODY",
"Rotation1": 18.0f,
"Rotation0": 18.0f,
"Pivot0": -1.0f,
"Pivot1": 1.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -5.0f,
"Part": "LEFT_LEG",
"Rotation1": -25.0f,
"Rotation0": 12.0f,
"Pivot0": 2.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": 0.0f,
"Part": "FULL_MODEL",
"Rotation1": 25.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
}
],
"Smooth": 0b,
"Duration": 5
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 0.5f,
"FrameParts": [
{
"Pivot2": -5.0f,
"Part": "LEFT_ARM",
"Rotation1": 107.0f,
"Rotation0": -94.0f,
"Pivot0": -5.0f,
"Pivot1": 3.0f,
"Rotation2": -31.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_ARM",
"Rotation1": 88.0f,
"Rotation0": -56.0f,
"Pivot0": 1.0f,
"Pivot1": 0.0f,
"Rotation2": -18.0f
},
{
"Pivot2": -3.0f,
"Part": "HEAD",
"Rotation1": 12.0f,
"Rotation0": 18.0f,
"Pivot0": -1.0f,
"Pivot1": 1.0f,
"Rotation2": -6.0f
},
{
"Pivot2": 0.0f,
"Part": "RIGHT_LEG",
"Rotation1": 56.0f,
"Rotation0": 6.0f,
"Pivot0": -2.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -3.0f,
"Part": "BODY",
"Rotation1": 25.0f,
"Rotation0": 18.0f,
"Pivot0": -1.0f,
"Pivot1": 1.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -5.0f,
"Part": "LEFT_LEG",
"Rotation1": -25.0f,
"Rotation0": 12.0f,
"Pivot0": 2.0f,
"Pivot1": 0.0f,
"Rotation2": -6.0f
},
{
"Pivot2": 0.0f,
"Part": "FULL_MODEL",
"Rotation1": 25.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
}
],
"Smooth": 0b,
"Duration": 35
}
],
"CurrentFrameTime": 0,
"CurrentFrame": 0,
"Smooth": 0b,
"ID": 1,
"WhileAttacking": 1b,
"WhileWalking": 1b,
"Name": "Ability_Beam_Windup",
"WhileStanding": 1b
}
@@ -0,0 +1,192 @@
{
"Loop": -1,
"Speed": 1.0f,
"Frames": [
{
"ColorMarker": 16777215,
"Comment": "",
"FrameParts": [
{
"Pivot2": 0.0f,
"Part": "BODY",
"Rotation1": 31.0f,
"Rotation0": 0.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 3.0f,
"Part": "RIGHT_LEG",
"Rotation1": 69.0f,
"Rotation0": 12.0f,
"Pivot0": -2.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 5.0f,
"Part": "RIGHT_ARM",
"Rotation1": 37.0f,
"Rotation0": -101.0f,
"Pivot0": 2.0f,
"Pivot1": 1.0f,
"Rotation2": -25.0f
},
{
"Pivot2": 0.0f,
"Part": "LEFT_ARM",
"Rotation1": 0.0f,
"Rotation0": -88.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": -90.0f
},
{
"Pivot2": -3.0f,
"Part": "LEFT_LEG",
"Rotation1": -18.0f,
"Rotation0": 12.0f,
"Pivot0": 1.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
}
],
"Duration": 20
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 1.0f,
"FrameParts": [
{
"Pivot2": 0.0f,
"Part": "BODY",
"Rotation1": -44.0f,
"Rotation0": 12.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -3.0f,
"Part": "RIGHT_LEG",
"Rotation1": -18.0f,
"Rotation0": 12.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "HEAD",
"Rotation1": -37.0f,
"Rotation0": 25.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -6.0f,
"Part": "RIGHT_ARM",
"Rotation1": 0.0f,
"Rotation0": -90.0f,
"Pivot0": 2.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 4.0f,
"Part": "LEFT_ARM",
"Rotation1": -50.0f,
"Rotation0": 50.0f,
"Pivot0": -3.0f,
"Pivot1": 0.0f,
"Rotation2": -56.0f
},
{
"Pivot2": 4.0f,
"Part": "LEFT_LEG",
"Rotation1": -75.0f,
"Rotation0": 12.0f,
"Pivot0": -1.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
}
],
"Smooth": 0b,
"Duration": 5
},
{
"ColorMarker": 16777215,
"Comment": "",
"Speed": 0.5f,
"FrameParts": [
{
"Pivot2": 0.0f,
"Part": "BODY",
"Rotation1": -44.0f,
"Rotation0": 12.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -3.0f,
"Part": "RIGHT_LEG",
"Rotation1": -18.0f,
"Rotation0": 12.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 0.0f,
"Part": "HEAD",
"Rotation1": -37.0f,
"Rotation0": 25.0f,
"Pivot0": 0.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": -6.0f,
"Part": "RIGHT_ARM",
"Rotation1": 0.0f,
"Rotation0": -90.0f,
"Pivot0": 2.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
},
{
"Pivot2": 4.0f,
"Part": "LEFT_ARM",
"Rotation1": -50.0f,
"Rotation0": 50.0f,
"Pivot0": -3.0f,
"Pivot1": 0.0f,
"Rotation2": -56.0f
},
{
"Pivot2": 4.0f,
"Part": "LEFT_LEG",
"Rotation1": -75.0f,
"Rotation0": 12.0f,
"Pivot0": -1.0f,
"Pivot1": 0.0f,
"Rotation2": 0.0f
}
],
"Smooth": 0b,
"Duration": 5
}
],
"CurrentFrameTime": 0,
"CurrentFrame": 0,
"Smooth": 0b,
"ID": 3,
"WhileAttacking": 1b,
"WhileWalking": 1b,
"Name": "Ability_Orb_Windup",
"WhileStanding": 1b
}