Package com.goodbird.npcgecko.api
Interface IItemAnimation
-
public interface IItemAnimationInterface for configuring per-perspective animation names on a GeckoLib item. Each animation type has a first-person and third-person variant.First-person animations play for the local player's held item view. Third-person animations play when other players see the item being held.
Animations are played based on a priority system:
- Swing - plays when the player swings or attacks with the item
- Use - plays while the player is using the item (holding right-click)
- Idle - loops continuously when no other animation is active
Obtain an instance via
IGeckoItemModel.getItemAnimation().Usage example:
var anim = itemGecko.getItemAnimation(); // Set for both perspectives anim.setIdleAnimation("animation.sword.idle"); anim.setSwingAnimation("animation.sword.swing"); // Set per-perspective (0 = first person, 1 = third person) anim.setSwingAnimation("animation.sword.swing_fp", 0); anim.setSwingAnimation("animation.sword.swing_tp", 1);- See Also:
IGeckoItemModel.getItemAnimation()
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetIdleAnimation()Get the idle animation name for first person.StringgetIdleAnimation(int perspective)Get the idle animation name for a specific perspective.StringgetSwingAnimation()Get the swing animation name for first person.StringgetSwingAnimation(int perspective)Get the swing animation name for a specific perspective.StringgetUseAnimation()Get the use animation name for first person.StringgetUseAnimation(int perspective)Get the use animation name for a specific perspective.voidsetIdleAnimation(String animation)Set the idle animation name for both perspectives.voidsetIdleAnimation(String animation, int perspective)Set the idle animation name for a specific perspective.voidsetSwingAnimation(String animation)Set the swing animation name for both perspectives.voidsetSwingAnimation(String animation, int perspective)Set the swing animation name for a specific perspective.voidsetUseAnimation(String animation)Set the use animation name for both perspectives.voidsetUseAnimation(String animation, int perspective)Set the use animation name for a specific perspective.
-
-
-
Method Detail
-
getIdleAnimation
String getIdleAnimation()
Get the idle animation name for first person.- Returns:
- the idle animation name, or an empty string if none is set
-
getIdleAnimation
String getIdleAnimation(int perspective)
Get the idle animation name for a specific perspective.- Parameters:
perspective- 0 for first person, 1 for third person- Returns:
- the idle animation name, or an empty string if none is set
-
setIdleAnimation
void setIdleAnimation(String animation)
Set the idle animation name for both perspectives.- Parameters:
animation- the animation name, or an empty string to clear
-
setIdleAnimation
void setIdleAnimation(String animation, int perspective)
Set the idle animation name for a specific perspective.- Parameters:
animation- the animation name, or an empty string to clearperspective- 0 for first person, 1 for third person
-
getSwingAnimation
String getSwingAnimation()
Get the swing animation name for first person.- Returns:
- the swing animation name, or an empty string if none is set
-
getSwingAnimation
String getSwingAnimation(int perspective)
Get the swing animation name for a specific perspective.- Parameters:
perspective- 0 for first person, 1 for third person- Returns:
- the swing animation name, or an empty string if none is set
-
setSwingAnimation
void setSwingAnimation(String animation)
Set the swing animation name for both perspectives. This animation plays once when the player swings or attacks with the item.- Parameters:
animation- the animation name, or an empty string to clear
-
setSwingAnimation
void setSwingAnimation(String animation, int perspective)
Set the swing animation name for a specific perspective.- Parameters:
animation- the animation name, or an empty string to clearperspective- 0 for first person, 1 for third person
-
getUseAnimation
String getUseAnimation()
Get the use animation name for first person.- Returns:
- the use animation name, or an empty string if none is set
-
getUseAnimation
String getUseAnimation(int perspective)
Get the use animation name for a specific perspective.- Parameters:
perspective- 0 for first person, 1 for third person- Returns:
- the use animation name, or an empty string if none is set
-
setUseAnimation
void setUseAnimation(String animation)
Set the use animation name for both perspectives. This animation plays while the player is actively using the item.- Parameters:
animation- the animation name, or an empty string to clear
-
setUseAnimation
void setUseAnimation(String animation, int perspective)
Set the use animation name for a specific perspective.- Parameters:
animation- the animation name, or an empty string to clearperspective- 0 for first person, 1 for third person
-
-