mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-23 20:39:39 +00:00
WIP Animations Register
This commit is contained in:
1 parent
c39ce6b6d1
commit
c168702970
4 files changed
+43
-14
No files matched your search
@@ -1098,7 +1098,7 @@ public abstract class Ability implements IAbility {
|
||||
|
||||
// Built-in animation by name takes priority
|
||||
if (windUpAnimationName != null && !windUpAnimationName.isEmpty()) {
|
||||
return (Animation) AnimationController.Instance.get(windUpAnimationName);
|
||||
return (Animation) AnimationController.Instance.get(windUpAnimationName, true);
|
||||
}
|
||||
// Fall back to user animation by ID
|
||||
if (windUpAnimationId >= 0) {
|
||||
@@ -1128,7 +1128,7 @@ public abstract class Ability implements IAbility {
|
||||
|
||||
// Built-in animation by name takes priority
|
||||
if (activeAnimationName != null && !activeAnimationName.isEmpty()) {
|
||||
return (Animation) AnimationController.Instance.get(activeAnimationName);
|
||||
return (Animation) AnimationController.Instance.get(activeAnimationName, true);
|
||||
}
|
||||
// Fall back to user animation by ID
|
||||
if (activeAnimationId >= 0) {
|
||||
@@ -1260,7 +1260,7 @@ public abstract class Ability implements IAbility {
|
||||
Animation animation = null;
|
||||
// Check for built-in animation (by name) first
|
||||
if (windUpAnimationName != null && !windUpAnimationName.isEmpty()) {
|
||||
animation = (Animation) AnimationController.Instance.get(windUpAnimationName);
|
||||
animation = (Animation) AnimationController.Instance.get(windUpAnimationName, true);
|
||||
}
|
||||
// Fall back to user animation (by ID)
|
||||
else if (windUpAnimationId >= 0) {
|
||||
|
||||
@@ -2,6 +2,9 @@ package kamkeel.npcs.util;
|
||||
|
||||
import kamkeel.npcs.controllers.data.ability.Ability;
|
||||
import kamkeel.npcs.controllers.data.ability.AbilityController;
|
||||
import noppes.npcs.LogWriter;
|
||||
import noppes.npcs.controllers.AnimationController;
|
||||
import noppes.npcs.controllers.data.Animation;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -34,5 +37,20 @@ public class Register<T> {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO ADD ANIMATION REGISTER
|
||||
public static class Animations extends Register<Animation> {
|
||||
private final Class<?> modClass;
|
||||
private final String animationsPath;
|
||||
|
||||
public Animations(Class<?> modClass, String animationsPath, String namespace) {
|
||||
super("ability", namespace);
|
||||
this.animationsPath = animationsPath;
|
||||
this.modClass = modClass;
|
||||
}
|
||||
|
||||
public void register() throws Exception {
|
||||
for (Map.Entry<String, Supplier<Animation>> entry : entries.entrySet()) {
|
||||
AnimationController.Instance.loadBuiltInAnimation(modClass, animationsPath, entry.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user