Package com.goodbird.npcgecko.api
Interface IGeckoAnimatable
-
public interface IGeckoAnimatableInterface for accessing and modifying GeckoLib model configuration on NPCs and scripted blocks. Provides control over model, texture, animation file, and named animation states.Changes made through this interface are automatically synced to clients.
Obtain an instance via
AbstractGeckoAPI.getAnimatable(noppes.npcs.api.entity.ICustomNpc<noppes.npcs.entity.EntityNPCInterface>).Usage example:
var animatable = gecko.getAnimatable(npc); animatable.setModel("geckolib3:geo/custom_npc.geo.json"); animatable.setTexture("geckolib3:textures/model/custom_npc.png"); animatable.setAnimationFile("geckolib3:animations/custom_npc.animation.json"); animatable.setIdleAnimation("animation.custom_npc.idle");
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StringgetAnimationFile()Get the animation file resource location.StringgetHeadBoneName()Get the bone name used for head tracking and rotation.StringgetHurtAnimation()Get the hurt animation name.StringgetIdleAnimation()Get the idle animation name.StringgetMeleeAttackAnimation()Get the melee attack animation name.StringgetModel()Get the geo model resource location.StringgetRangedAttackAnimation()Get the ranged attack animation name.StringgetTexture()Get the texture resource location.intgetTransitionLengthTicks()Get the transition duration between animations in ticks.StringgetWalkAnimation()Get the walk animation name.voidsetAnimationFile(String animationFile)Set the animation file resource location.voidsetHeadBoneName(String boneName)Set the bone name used for head tracking and rotation.voidsetHurtAnimation(String animation)Set the hurt animation name.voidsetIdleAnimation(String animation)Set the idle animation name.voidsetMeleeAttackAnimation(String animation)Set the melee attack animation name.voidsetModel(String model)Set the GeckoLib geo model resource location.voidsetRangedAttackAnimation(String animation)Set the ranged attack animation name.voidsetTexture(String texture)Set the texture resource location.voidsetTransitionLengthTicks(int ticks)Set the transition duration between animations in ticks.voidsetWalkAnimation(String animation)Set the walk animation name.
-
-
-
Method Detail
-
getModel
String getModel()
Get the geo model resource location.- Returns:
- the model resource location string
-
setModel
void setModel(String model)
Set the GeckoLib geo model resource location.- Parameters:
model- the model resource location (e.g. "geckolib3:geo/npc.geo.json")
-
getTexture
String getTexture()
Get the texture resource location.- Returns:
- the texture resource location string
-
setTexture
void setTexture(String texture)
Set the texture resource location.- Parameters:
texture- the texture resource location (e.g. "geckolib3:textures/model/npc.png")
-
getAnimationFile
String getAnimationFile()
Get the animation file resource location.- Returns:
- the animation file resource location string
-
setAnimationFile
void setAnimationFile(String animationFile)
Set the animation file resource location.- Parameters:
animationFile- the animation file resource location (e.g. "geckolib3:animations/npc.animation.json")
-
getIdleAnimation
String getIdleAnimation()
Get the idle animation name.- Returns:
- the idle animation name, or an empty string if none is set
-
setIdleAnimation
void setIdleAnimation(String animation)
Set the idle animation name. This animation plays continuously while the entity is standing still.- Parameters:
animation- the animation name (e.g. "animation.npc.idle")
-
getWalkAnimation
String getWalkAnimation()
Get the walk animation name.- Returns:
- the walk animation name, or an empty string if none is set
-
setWalkAnimation
void setWalkAnimation(String animation)
Set the walk animation name. This animation plays while the entity is moving.- Parameters:
animation- the animation name (e.g. "animation.npc.walk")
-
getHurtAnimation
String getHurtAnimation()
Get the hurt animation name.- Returns:
- the hurt animation name, or an empty string if none is set
-
setHurtAnimation
void setHurtAnimation(String animation)
Set the hurt animation name. This animation plays when the entity takes damage.- Parameters:
animation- the animation name (e.g. "animation.npc.hurt")
-
getMeleeAttackAnimation
String getMeleeAttackAnimation()
Get the melee attack animation name.- Returns:
- the melee attack animation name, or an empty string if none is set
-
setMeleeAttackAnimation
void setMeleeAttackAnimation(String animation)
Set the melee attack animation name. This animation plays when the entity performs a melee attack.- Parameters:
animation- the animation name (e.g. "animation.npc.melee")
-
getRangedAttackAnimation
String getRangedAttackAnimation()
Get the ranged attack animation name.- Returns:
- the ranged attack animation name, or an empty string if none is set
-
setRangedAttackAnimation
void setRangedAttackAnimation(String animation)
Set the ranged attack animation name. This animation plays when the entity performs a ranged attack.- Parameters:
animation- the animation name (e.g. "animation.npc.ranged")
-
getHeadBoneName
String getHeadBoneName()
Get the bone name used for head tracking and rotation.- Returns:
- the head bone name (default: "head")
-
setHeadBoneName
void setHeadBoneName(String boneName)
Set the bone name used for head tracking and rotation. The bone must exist in the assigned model file.- Parameters:
boneName- the bone name as defined in the model
-
getTransitionLengthTicks
int getTransitionLengthTicks()
Get the transition duration between animations in ticks.- Returns:
- the transition length in ticks (default: 10)
-
setTransitionLengthTicks
void setTransitionLengthTicks(int ticks)
Set the transition duration between animations in ticks. Controls how smoothly one animation blends into the next.- Parameters:
ticks- the transition length in ticks (20 ticks = 1 second)
-
-