Skip to content

Commit

Permalink
Oops! all static object constructs
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Trainguy9512 committed Mar 8, 2024
1 parent bea5260 commit b6b5f57
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -77,9 +78,21 @@ public enum FPPlayerLocators {
public static final AnimationDataContainer.DataKey<Boolean> 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,
Expand Down Expand Up @@ -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");
/*
Expand Down Expand Up @@ -197,7 +212,7 @@ protected AnimationPose<FPPlayerLocators> calculatePose() {
*/


AnimationPose<FPPlayerLocators> pose = sampleAnimationState(IDLE_SEQUENCE_PLAYER);
AnimationPose<FPPlayerLocators> pose = sampleAnimationState(TEST_IDLE_SEQUENCE_PLAYER);

pose = dampenArmRotation(pose);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit b6b5f57

Please sign in to comment.