From e599ed67f5a9186b47db3be7168af592b67499e3 Mon Sep 17 00:00:00 2001 From: Vidal Date: Tue, 27 Jan 2026 22:19:26 -0300 Subject: [PATCH] Added animations to these abilities --- .../data/ability/AbilityAnimation.java | 17 +- .../data/ability/type/AbilityEnergyBeam.java | 20 ++ .../data/ability/type/AbilityOrb.java | 12 + .../ABILITYBEAM/Ability_Beam_Active.json | 230 ++++++++++++++++++ .../ABILITYBEAM/Ability_Beam_Windup.json | 158 ++++++++++++ .../ABILITYORB/Ability_Orb_Windup.json | 192 +++++++++++++++ 6 files changed, 621 insertions(+), 8 deletions(-) create mode 100644 src/main/resources/internal/animations/ABILITYBEAM/Ability_Beam_Active.json create mode 100644 src/main/resources/internal/animations/ABILITYBEAM/Ability_Beam_Windup.json create mode 100644 src/main/resources/internal/animations/ABILITYORB/Ability_Orb_Windup.json diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityAnimation.java b/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityAnimation.java index 3aea051f3..190be70d3 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityAnimation.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/AbilityAnimation.java @@ -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 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"); diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityEnergyBeam.java b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityEnergyBeam.java index 3bcc5072c..2dea02f5a 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityEnergyBeam.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityEnergyBeam.java @@ -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(); + } } diff --git a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityOrb.java b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityOrb.java index 6bc6da964..4832c2281 100644 --- a/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityOrb.java +++ b/src/main/java/kamkeel/npcs/controllers/data/ability/type/AbilityOrb.java @@ -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(); + } } diff --git a/src/main/resources/internal/animations/ABILITYBEAM/Ability_Beam_Active.json b/src/main/resources/internal/animations/ABILITYBEAM/Ability_Beam_Active.json new file mode 100644 index 000000000..eb9516f38 --- /dev/null +++ b/src/main/resources/internal/animations/ABILITYBEAM/Ability_Beam_Active.json @@ -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 +} diff --git a/src/main/resources/internal/animations/ABILITYBEAM/Ability_Beam_Windup.json b/src/main/resources/internal/animations/ABILITYBEAM/Ability_Beam_Windup.json new file mode 100644 index 000000000..6c53e1eab --- /dev/null +++ b/src/main/resources/internal/animations/ABILITYBEAM/Ability_Beam_Windup.json @@ -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 +} diff --git a/src/main/resources/internal/animations/ABILITYORB/Ability_Orb_Windup.json b/src/main/resources/internal/animations/ABILITYORB/Ability_Orb_Windup.json new file mode 100644 index 000000000..77f21f941 --- /dev/null +++ b/src/main/resources/internal/animations/ABILITYORB/Ability_Orb_Windup.json @@ -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 +}