Interface AnimationHandler
public interface AnimationHandler
The class that handles everything animation related such as animation updates,
calculations, and removal.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Ignore all lerp out animations and stop all animations immediately.
This is used to cancel all ongoing animations before playing the death animation.void
forceStopAnimation
(String animation) Ignore lerp out animation and stop the animation immediately.
To stop the animation gracefully, usestopAnimation(String)
.void
forEachProperty
(BiConsumer<String, IAnimationProperty> consumer) Shorthand for looping through all animation properties.getAnimation
(String animation) Get theSimpleProperty
object that contains the animation information of the provided ID.Get an immutable list of allAnimationProperties
, ordered by animation priority.org.bukkit.util.Vector
getFinalPosition
(ModelBone bone) Calculate the final position of the specified bone.org.bukkit.util.EulerAngle
getFinalRotation
(ModelBone bone) Calculate the final rotation of the specified bone.getModel()
Get the owner of this animation handler.boolean
isPlayingAnimation
(String animation) Check if the handler is already playing the animation.boolean
playAnimation
(IAnimationProperty property, boolean force) Attempt to play an animation of the specified ID.boolean
playAnimation
(String animation, double lerpIn, double lerpOut, double speed, boolean force) Attempt to play an animation of the specified ID.void
stopAnimation
(String animation) Stop the animation and start playing the lerp out animation.
To stop the animation immediately, useforceStopAnimation(String)
.void
Update method for effects that is called every tick.void
Update method that is called every tick.
-
Method Details
-
getModel
ActiveModel getModel()Get the owner of this animation handler. -
updateAll
void updateAll()Update method that is called every tick. -
tickEffects
void tickEffects()Update method for effects that is called every tick. -
forEachProperty
Shorthand for looping through all animation properties.- Parameters:
consumer
- action performed per property
-
getAnimation
Get theSimpleProperty
object that contains the animation information of the provided ID.- Parameters:
animation
- the ID of the animation- Returns:
- the
SimpleProperty
object of the animation, or null if there is no animation playing under that ID.
-
getAnimations
List<IAnimationProperty> getAnimations()Get an immutable list of allAnimationProperties
, ordered by animation priority. -
getFinalPosition
Calculate the final position of the specified bone.- Parameters:
bone
- any bone- Returns:
- a vector representing the position of the bone in world space
-
getFinalRotation
Calculate the final rotation of the specified bone.- Parameters:
bone
- any bone- Returns:
- an euler rotation representing the rotation of the bone in model space
-
playAnimation
Attempt to play an animation of the specified ID.- Parameters:
animation
- the animation IDlerpIn
- time taken to interpolate into the animation (in seconds)lerpOut
- time taken to interpolate out of the animation (in seconds)speed
- raw speed multiplier (1 for default speed)force
- if false, the animation would only play if the model is not currently playing the animation, or the animation is inLERPOUT
phase- Returns:
- true if the animation is being played successfully
-
playAnimation
Attempt to play an animation of the specified ID.- Parameters:
property
- theIAnimationProperty
of the animationforce
- if false, the animation would only play if the model is not currently playing the animation, or the animation is inLERPOUT
phase- Returns:
- true if the animation is being played successfully
-
isPlayingAnimation
Check if the handler is already playing the animation. -
stopAnimation
Stop the animation and start playing the lerp out animation.
To stop the animation immediately, useforceStopAnimation(String)
. -
forceStopAnimation
Ignore lerp out animation and stop the animation immediately.
To stop the animation gracefully, usestopAnimation(String)
. -
forceStopAllAnimations
void forceStopAllAnimations()Ignore all lerp out animations and stop all animations immediately.
This is used to cancel all ongoing animations before playing the death animation.
-