Package dev.oxydien.mathimations.prefabs
Class LegAnimation<T extends net.minecraft.world.entity.LivingEntity>
java.lang.Object
dev.oxydien.mathimations.prefabs.LegAnimation<T>
- Type Parameters:
T- the type of the entity that this animation is for
- All Implemented Interfaces:
IMathAnimation<T>
public class LegAnimation<T extends net.minecraft.world.entity.LivingEntity>
extends Object
implements IMathAnimation<T>
Animation for the legs of any LivingEntity.
This animation is responsible for animating the legs (somewhat similar to vanilla). It uses the entity's walk animation speed to determine the distance and angle of the legs.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionLegAnimation(float legLength, float maxLegAngle, LegAnimation.LegAxis walkAxis, List<List<String>> legGroups) Creates a new LegsAnimation. -
Method Summary
Modifier and TypeMethodDescriptionfloatvoidupdate(T entity, AnimationContext actx) Update the animation
-
Constructor Details
-
LegAnimation
public LegAnimation(float legLength, float maxLegAngle, LegAnimation.LegAxis walkAxis, List<List<String>> legGroups) Creates a new LegsAnimation.The leg groups should have paths to the given model parts.
Example:
List<List<String>> legGroups = new ArrayList<>(); legGroups.add(List.of("fl_leg", "bl_leg")); legGroups.add(List.of("fr_leg", "br_leg"));- Parameters:
legLength- the length of the legs (Pivot offset from the ground in pixels: 16 pixels -> 1 block)maxLegAngle- the maximum angle of the legs in radianswalkAxis- the axis on which the legs should rotatelegGroups- the groups of legs (each group is offset by 180 degrees, so they move opposite to each other)
-
-
Method Details
-
getTransitionTime
public float getTransitionTime()- Specified by:
getTransitionTimein interfaceIMathAnimation<T extends net.minecraft.world.entity.LivingEntity>
-
update
Description copied from interface:IMathAnimationUpdate the animation- Specified by:
updatein interfaceIMathAnimation<T extends net.minecraft.world.entity.LivingEntity>- Parameters:
entity- The entity being animatedactx- The animation context (seeAnimationContext)
-