From b6b5f57426eebe5f6d9c9c76cd7f1acd1a3590f6 Mon Sep 17 00:00:00 2001 From: James Pelter Date: Fri, 8 Mar 2024 02:06:24 -0600 Subject: [PATCH] Oops! all static object constructs - just realized that with animation states being defined as static objects, it won't work with multiple entities- time to rewrite how it works with a key-config system rip --- .../entity/FirstPersonPlayerAnimator.java | 19 +++++++++++++++++-- .../pose/sample/AnimationSequencePlayer.java | 8 ++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/trainguy9512/animationoverhaul/animation/entity/FirstPersonPlayerAnimator.java b/src/main/java/com/trainguy9512/animationoverhaul/animation/entity/FirstPersonPlayerAnimator.java index 2c05867..e065497 100644 --- a/src/main/java/com/trainguy9512/animationoverhaul/animation/entity/FirstPersonPlayerAnimator.java +++ b/src/main/java/com/trainguy9512/animationoverhaul/animation/entity/FirstPersonPlayerAnimator.java @@ -13,6 +13,7 @@ import net.minecraft.client.player.LocalPlayer; import net.minecraft.resources.ResourceLocation; import net.minecraft.util.Mth; +import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; import org.joml.Vector3f; @@ -77,9 +78,21 @@ public enum FPPlayerLocators { public static final AnimationDataContainer.DataKey IS_JUMPING = new AnimationDataContainer.DataKey<>("is_jumping", false); private static final AnimationSequencePlayer IDLE_SEQUENCE_PLAYER = AnimationSequencePlayer.of("idle_sequence_player", ANIMATION_FP_PLAYER_IDLE).setDefaultPlayRate(0F); - private static final AnimationSequencePlayer TEST_IDLE_SEQUENCE_PLAYER = AnimationSequencePlayer.of("test_idle_sequence_player", ANIMATION_FP_PLAYER_IDLE).setDefaultPlayRate(0F).setStartTime(50); + private static final AnimationSequencePlayer TEST_IDLE_SEQUENCE_PLAYER = AnimationSequencePlayer.of("test_idle_sequence_player", ANIMATION_FP_PLAYER_IDLE).setDefaultPlayRate(1F).setStartTime(70); + + enum TestStates { + IDLE, + MOVING + } + + + + + + + /* enum ItemSwitchStates { EMPTY, EMPTY_RAISING, @@ -126,6 +139,8 @@ enum MiningStates { .addStateTransition(MiningStates.LOOPING, MiningStates.IDLE, 2); + */ + private static final AnimationMontageTrack MAIN_HAND_EMPTY_PUNCH_MONTAGE_TRACK = AnimationMontageTrack.of("main_hand_empty_punch_montage_track"); /* @@ -197,7 +212,7 @@ protected AnimationPose calculatePose() { */ - AnimationPose pose = sampleAnimationState(IDLE_SEQUENCE_PLAYER); + AnimationPose pose = sampleAnimationState(TEST_IDLE_SEQUENCE_PLAYER); pose = dampenArmRotation(pose); diff --git a/src/main/java/com/trainguy9512/animationoverhaul/animation/pose/sample/AnimationSequencePlayer.java b/src/main/java/com/trainguy9512/animationoverhaul/animation/pose/sample/AnimationSequencePlayer.java index 0ef3451..d5fd207 100644 --- a/src/main/java/com/trainguy9512/animationoverhaul/animation/pose/sample/AnimationSequencePlayer.java +++ b/src/main/java/com/trainguy9512/animationoverhaul/animation/pose/sample/AnimationSequencePlayer.java @@ -69,13 +69,13 @@ public AnimationSequencePlayer setDefaultPlayRate(float newPlayRate){ return this; } - public AnimationSequencePlayer setStartTime(float startTime){ - this.startTime = startTime; + public AnimationSequencePlayer setStartTime(float startTimeTicks){ + this.startTime = startTimeTicks; return this; } - public AnimationSequencePlayer setEndTime(float endTime){ - this.endTime = endTime; + public AnimationSequencePlayer setEndTime(float endTimeTicks){ + this.endTime = endTimeTicks; return this; }