Package com.goodbird.npcgecko.api
Class AbstractGeckoAPI
- java.lang.Object
-
- com.goodbird.npcgecko.api.AbstractGeckoAPI
-
-
Constructor Summary
Constructors Constructor Description AbstractGeckoAPI()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclearItemModel(IItemCustomizable item)Remove the gecko model from a customizable item, reverting to normal 2D rendering.abstract IGeckoColorcolorOfRGB(int r, int g, int b)Create a color from RGB components.abstract IGeckoColorcolorOfRGBA(int r, int g, int b, int a)Create a color from RGBA components.abstract IGeckoAnimationBuildercreateAnimationBuilder()Create a new animation builder for constructing animation sequences.abstract IGeckoAnimationBuildercreateAnimBuilder()Create a new animation builder for constructing animation sequences.abstract IGeckoAnimatablegetAnimatable(IBlockScripted scriptedBlock)Get the animation configuration interface for a scripted block.abstract IGeckoAnimatablegetAnimatable(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc)Get the animation configuration interface for an NPC.abstract IGeckoAnimationgetAnimation(String animationFile, String animationName)Get animation metadata from a loaded animation file.abstract String[]getAnimationFileList()Get a list of all loaded animation file resource locations.abstract String[]getAnimationList(String animationFile)Get a list of all animation names in an animation file.abstract String[]getDisplayFileList()Get a list of all loaded display file names from item_displays/ folders.abstract booleanhasItemModel(IItemCustomizable item)Check if a customizable item has a gecko model assigned.static AbstractGeckoAPIInstance()static booleanIsAvailable()abstract voidsetAnimationFile(IBlockScripted scriptedBlock, String animation)Set the animation file resource location for a scripted block.abstract voidsetAnimationFile(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String animation)Set the animation file resource location for an NPC.abstract voidsetDisplayJSON(IItemCustomizable item, String displayFile)Set the display JSON file for a gecko item.abstract voidsetIdleAnimation(IBlockScripted scriptedBlock, String animation)Set the idle animation name for a scripted block.abstract voidsetIdleAnimation(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String animation)Set the idle animation name for an NPC.abstract voidsetItemAnimationFile(IItemCustomizable item, String animation)Set the animation file resource location for a customizable item.abstract voidsetItemDisplay(IItemCustomizable item, String context, float tx, float ty, float tz, float rx, float ry, float rz, float sx, float sy, float sz)Set the display transform for a specific render context on a gecko item.abstract voidsetItemIdleAnimation(IItemCustomizable item, String animation)Set the idle animation name for a customizable item.abstract voidsetItemModel(IItemCustomizable item, String model)Set the geo model resource location for a customizable item.abstract voidsetItemTexture(IItemCustomizable item, String texture)Set the texture resource location for a customizable item.abstract voidsetModel(IBlockScripted scriptedBlock, String model)Set the geo model resource location for a scripted block.abstract voidsetModel(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String model)Set the geo model resource location for an NPC.abstract voidsetTexture(IBlockScripted scriptedBlock, String texture)Set the texture resource location for a scripted block.abstract voidsetTexture(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String texture)Set the texture resource location for an NPC.abstract voidsyncAnimForAll(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder)Sync an animation to all players for a scripted block.abstract voidsyncAnimForAll(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, IGeckoAnimationBuilder builder)Sync an animation to all players for an NPC.abstract voidsyncAnimForPlayer(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder, IPlayer<net.minecraft.entity.player.EntityPlayerMP> player)Sync an animation to a specific player for a scripted block.abstract voidsyncAnimForPlayer(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, IGeckoAnimationBuilder builder, IPlayer<net.minecraft.entity.player.EntityPlayerMP> player)Sync an animation to a specific player for an NPC.
-
-
-
Method Detail
-
IsAvailable
public static boolean IsAvailable()
-
Instance
public static AbstractGeckoAPI Instance()
-
createAnimBuilder
public abstract IGeckoAnimationBuilder createAnimBuilder()
Create a new animation builder for constructing animation sequences.- Returns:
- A new animation builder
-
createAnimationBuilder
public abstract IGeckoAnimationBuilder createAnimationBuilder()
Create a new animation builder for constructing animation sequences.- Returns:
- A new animation builder
-
getAnimatable
public abstract IGeckoAnimatable getAnimatable(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc)
Get the animation configuration interface for an NPC.- Parameters:
npc- The NPC to get animation config for- Returns:
- The animatable interface for this NPC
-
getAnimatable
public abstract IGeckoAnimatable getAnimatable(IBlockScripted scriptedBlock)
Get the animation configuration interface for a scripted block.- Parameters:
scriptedBlock- The block to get animation config for- Returns:
- The animatable interface for this block
-
getAnimationList
public abstract String[] getAnimationList(String animationFile)
Get a list of all animation names in an animation file.- Parameters:
animationFile- The animation file resource location (e.g. "npcgecko:animations/geo_npc.animation.json")- Returns:
- Array of animation names, or empty array if file not found
-
getAnimationFileList
public abstract String[] getAnimationFileList()
Get a list of all loaded animation file resource locations.- Returns:
- Array of animation file paths
-
getAnimation
public abstract IGeckoAnimation getAnimation(String animationFile, String animationName)
Get animation metadata from a loaded animation file.- Parameters:
animationFile- The animation file resource locationanimationName- The animation name within the file- Returns:
- The animation metadata, or null if not found
-
colorOfRGB
public abstract IGeckoColor colorOfRGB(int r, int g, int b)
Create a color from RGB components.- Parameters:
r- Red component (0-255)g- Green component (0-255)b- Blue component (0-255)- Returns:
- A new color
-
colorOfRGBA
public abstract IGeckoColor colorOfRGBA(int r, int g, int b, int a)
Create a color from RGBA components.- Parameters:
r- Red component (0-255)g- Green component (0-255)b- Blue component (0-255)a- Alpha component (0-255)- Returns:
- A new color
-
setModel
public abstract void setModel(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String model)
Set the geo model resource location for an NPC.- Parameters:
npc- The target NPCmodel- The model path (e.g. "geckolib3:geo/npc.geo.json")
-
setTexture
public abstract void setTexture(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String texture)
Set the texture resource location for an NPC.- Parameters:
npc- The target NPCtexture- The texture path
-
setAnimationFile
public abstract void setAnimationFile(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String animation)
Set the animation file resource location for an NPC.- Parameters:
npc- The target NPCanimation- The animation file path
-
setIdleAnimation
public abstract void setIdleAnimation(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String animation)
Set the idle animation name for an NPC.- Parameters:
npc- The target NPCanimation- The animation name from the animation file
-
syncAnimForPlayer
public abstract void syncAnimForPlayer(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, IGeckoAnimationBuilder builder, IPlayer<net.minecraft.entity.player.EntityPlayerMP> player)
Sync an animation to a specific player for an NPC.- Parameters:
npc- The NPC to play the animation onbuilder- The animation builder with queued animationsplayer- The player to send the animation to
-
syncAnimForAll
public abstract void syncAnimForAll(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, IGeckoAnimationBuilder builder)
Sync an animation to all players for an NPC.- Parameters:
npc- The NPC to play the animation onbuilder- The animation builder with queued animations
-
setModel
public abstract void setModel(IBlockScripted scriptedBlock, String model)
Set the geo model resource location for a scripted block.- Parameters:
scriptedBlock- The target blockmodel- The model path
-
setTexture
public abstract void setTexture(IBlockScripted scriptedBlock, String texture)
Set the texture resource location for a scripted block.- Parameters:
scriptedBlock- The target blocktexture- The texture path
-
setAnimationFile
public abstract void setAnimationFile(IBlockScripted scriptedBlock, String animation)
Set the animation file resource location for a scripted block.- Parameters:
scriptedBlock- The target blockanimation- The animation file path
-
setIdleAnimation
public abstract void setIdleAnimation(IBlockScripted scriptedBlock, String animation)
Set the idle animation name for a scripted block.- Parameters:
scriptedBlock- The target blockanimation- The animation name from the animation file
-
syncAnimForPlayer
public abstract void syncAnimForPlayer(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder, IPlayer<net.minecraft.entity.player.EntityPlayerMP> player)
Sync an animation to a specific player for a scripted block.- Parameters:
scriptedBlock- The block to play the animation onbuilder- The animation builder with queued animationsplayer- The player to send the animation to
-
syncAnimForAll
public abstract void syncAnimForAll(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder)
Sync an animation to all players for a scripted block.- Parameters:
scriptedBlock- The block to play the animation onbuilder- The animation builder with queued animations
-
setItemModel
public abstract void setItemModel(IItemCustomizable item, String model)
Set the geo model resource location for a customizable item. Works with both Scripted Items and Linked Items.- Parameters:
item- The item (IItemCustom or IItemLinked from event.item or API)model- The model path (e.g. "geckolib3:geo/mymodel.geo.json")
-
setItemTexture
public abstract void setItemTexture(IItemCustomizable item, String texture)
Set the texture resource location for a customizable item.- Parameters:
item- The itemtexture- The texture path (e.g. "geckolib3:textures/item/mytexture.png")
-
setItemAnimationFile
public abstract void setItemAnimationFile(IItemCustomizable item, String animation)
Set the animation file resource location for a customizable item.- Parameters:
item- The itemanimation- The animation file path (e.g. "geckolib3:animations/mymodel.animation.json")
-
setItemIdleAnimation
public abstract void setItemIdleAnimation(IItemCustomizable item, String animation)
Set the idle animation name for a customizable item.- Parameters:
item- The itemanimation- The animation name from the animation file
-
hasItemModel
public abstract boolean hasItemModel(IItemCustomizable item)
Check if a customizable item has a gecko model assigned.- Parameters:
item- The item to check- Returns:
- true if the item has a custom gecko model
-
clearItemModel
public abstract void clearItemModel(IItemCustomizable item)
Remove the gecko model from a customizable item, reverting to normal 2D rendering.- Parameters:
item- The item to clear the model from
-
setDisplayJSON
public abstract void setDisplayJSON(IItemCustomizable item, String displayFile)
Set the display JSON file for a gecko item. The file is loaded from assets/{domain}/item_displays/ folders. This controls how the 3D model is positioned, rotated, and scaled in each render context (first person, third person, inventory, ground).Example:
GeckoAPI.setDisplayJSON(item, "sword.json")- Parameters:
item- The item to set the display JSON ondisplayFile- The display JSON filename (e.g. "sword.json")
-
getDisplayFileList
public abstract String[] getDisplayFileList()
Get a list of all loaded display file names from item_displays/ folders.- Returns:
- Array of display file names
-
setItemDisplay
public abstract void setItemDisplay(IItemCustomizable item, String context, float tx, float ty, float tz, float rx, float ry, float rz, float sx, float sy, float sz)
Set the display transform for a specific render context on a gecko item. This controls how the 3D model is positioned, rotated, and scaled when rendered in that context.If no per-context transform is set, the item's existing rotation/scale/translate properties are used as fallback.
- Parameters:
item- The item to set the display transform oncontext- The render context: "first_person", "third_person", "inventory", or "ground"tx- Translation Xty- Translation Ytz- Translation Zrx- Rotation X (degrees)ry- Rotation Y (degrees)rz- Rotation Z (degrees)sx- Scale Xsy- Scale Ysz- Scale Z
-
-