Package com.goodbird.npcgecko.api
Class GeckoAPI
- java.lang.Object
-
- com.goodbird.npcgecko.api.AbstractGeckoAPI
-
- com.goodbird.npcgecko.api.GeckoAPI
-
public class GeckoAPI extends AbstractGeckoAPI
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearItemModel(IItemCustomizable item)Remove the gecko model from a customizable item, reverting to normal 2D rendering.IGeckoColorcolorOfRGB(int r, int g, int b)Create a color from RGB components.IGeckoColorcolorOfRGBA(int r, int g, int b, int a)Create a color from RGBA components.IGeckoAnimationBuildercreateAnimationBuilder()Create a new animation builder for constructing animation sequences.IGeckoAnimationBuildercreateAnimBuilder()Create a new animation builder for constructing animation sequences.IGeckoAnimatablegetAnimatable(IBlockScripted scriptedBlock)Get the animation configuration interface for a scripted block.IGeckoAnimatablegetAnimatable(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc)Get the animation configuration interface for an NPC.IGeckoAnimationgetAnimation(String animationFile, String animationName)Get animation metadata from a loaded animation file.String[]getAnimationFileList()Get a list of all loaded animation file resource locations.String[]getAnimationList(String animationFile)Get a list of all animation names in an animation file.String[]getDisplayFileList()Get a list of all loaded display file names from item_displays/ folders.booleanhasItemModel(IItemCustomizable item)Check if a customizable item has a gecko model assigned.static AbstractGeckoAPIInstance()voidsetAnimationFile(IBlockScripted scriptedBlock, String animation)Set the animation file resource location for a scripted block.voidsetAnimationFile(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String animation)Set the animation file resource location for an NPC.voidsetDisplayJSON(IItemCustomizable item, String displayFile)Set the display JSON file for a gecko item.voidsetIdleAnimation(IBlockScripted scriptedBlock, String animation)Set the idle animation name for a scripted block.voidsetIdleAnimation(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String animation)Set the idle animation name for an NPC.voidsetItemAnimationFile(IItemCustomizable item, String animation)Set the animation file resource location for a customizable item.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.voidsetItemIdleAnimation(IItemCustomizable item, String animation)Set the idle animation name for a customizable item.voidsetItemModel(IItemCustomizable item, String model)Set the geo model resource location for a customizable item.voidsetItemTexture(IItemCustomizable item, String texture)Set the texture resource location for a customizable item.voidsetModel(IBlockScripted scriptedBlock, String model)Set the geo model resource location for a scripted block.voidsetModel(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String model)Set the geo model resource location for an NPC.voidsetTexture(IBlockScripted scriptedBlock, String texture)Set the texture resource location for a scripted block.voidsetTexture(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String texture)Set the texture resource location for an NPC.voidsyncAnimForAll(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder)Sync an animation to all players for a scripted block.voidsyncAnimForAll(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, IGeckoAnimationBuilder builder)Sync an animation to all players for an NPC.voidsyncAnimForPlayer(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder, IPlayer<net.minecraft.entity.player.EntityPlayerMP> player)Sync an animation to a specific player for a scripted block.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.-
Methods inherited from class com.goodbird.npcgecko.api.AbstractGeckoAPI
IsAvailable
-
-
-
-
Method Detail
-
Instance
public static AbstractGeckoAPI Instance()
-
createAnimBuilder
public IGeckoAnimationBuilder createAnimBuilder()
Description copied from class:AbstractGeckoAPICreate a new animation builder for constructing animation sequences.- Specified by:
createAnimBuilderin classAbstractGeckoAPI- Returns:
- A new animation builder
-
createAnimationBuilder
public IGeckoAnimationBuilder createAnimationBuilder()
Description copied from class:AbstractGeckoAPICreate a new animation builder for constructing animation sequences.- Specified by:
createAnimationBuilderin classAbstractGeckoAPI- Returns:
- A new animation builder
-
getAnimatable
public IGeckoAnimatable getAnimatable(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc)
Description copied from class:AbstractGeckoAPIGet the animation configuration interface for an NPC.- Specified by:
getAnimatablein classAbstractGeckoAPI- Parameters:
npc- The NPC to get animation config for- Returns:
- The animatable interface for this NPC
-
getAnimatable
public IGeckoAnimatable getAnimatable(IBlockScripted scriptedBlock)
Description copied from class:AbstractGeckoAPIGet the animation configuration interface for a scripted block.- Specified by:
getAnimatablein classAbstractGeckoAPI- Parameters:
scriptedBlock- The block to get animation config for- Returns:
- The animatable interface for this block
-
getAnimationList
public String[] getAnimationList(String animationFile)
Description copied from class:AbstractGeckoAPIGet a list of all animation names in an animation file.- Specified by:
getAnimationListin classAbstractGeckoAPI- 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 String[] getAnimationFileList()
Description copied from class:AbstractGeckoAPIGet a list of all loaded animation file resource locations.- Specified by:
getAnimationFileListin classAbstractGeckoAPI- Returns:
- Array of animation file paths
-
getAnimation
public IGeckoAnimation getAnimation(String animationFile, String animationName)
Description copied from class:AbstractGeckoAPIGet animation metadata from a loaded animation file.- Specified by:
getAnimationin classAbstractGeckoAPI- Parameters:
animationFile- The animation file resource locationanimationName- The animation name within the file- Returns:
- The animation metadata, or null if not found
-
colorOfRGB
public IGeckoColor colorOfRGB(int r, int g, int b)
Description copied from class:AbstractGeckoAPICreate a color from RGB components.- Specified by:
colorOfRGBin classAbstractGeckoAPI- Parameters:
r- Red component (0-255)g- Green component (0-255)b- Blue component (0-255)- Returns:
- A new color
-
colorOfRGBA
public IGeckoColor colorOfRGBA(int r, int g, int b, int a)
Description copied from class:AbstractGeckoAPICreate a color from RGBA components.- Specified by:
colorOfRGBAin classAbstractGeckoAPI- 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 void setModel(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String model)
Description copied from class:AbstractGeckoAPISet the geo model resource location for an NPC.- Specified by:
setModelin classAbstractGeckoAPI- Parameters:
npc- The target NPCmodel- The model path (e.g. "geckolib3:geo/npc.geo.json")
-
setTexture
public void setTexture(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String texture)
Description copied from class:AbstractGeckoAPISet the texture resource location for an NPC.- Specified by:
setTexturein classAbstractGeckoAPI- Parameters:
npc- The target NPCtexture- The texture path
-
setAnimationFile
public void setAnimationFile(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String animation)
Description copied from class:AbstractGeckoAPISet the animation file resource location for an NPC.- Specified by:
setAnimationFilein classAbstractGeckoAPI- Parameters:
npc- The target NPCanimation- The animation file path
-
setIdleAnimation
public void setIdleAnimation(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, String animation)
Description copied from class:AbstractGeckoAPISet the idle animation name for an NPC.- Specified by:
setIdleAnimationin classAbstractGeckoAPI- Parameters:
npc- The target NPCanimation- The animation name from the animation file
-
syncAnimForPlayer
public void syncAnimForPlayer(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, IGeckoAnimationBuilder builder, IPlayer<net.minecraft.entity.player.EntityPlayerMP> player)
Description copied from class:AbstractGeckoAPISync an animation to a specific player for an NPC.- Specified by:
syncAnimForPlayerin classAbstractGeckoAPI- Parameters:
npc- The NPC to play the animation onbuilder- The animation builder with queued animationsplayer- The player to send the animation to
-
syncAnimForAll
public void syncAnimForAll(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc, IGeckoAnimationBuilder builder)
Description copied from class:AbstractGeckoAPISync an animation to all players for an NPC.- Specified by:
syncAnimForAllin classAbstractGeckoAPI- Parameters:
npc- The NPC to play the animation onbuilder- The animation builder with queued animations
-
setModel
public void setModel(IBlockScripted scriptedBlock, String model)
Description copied from class:AbstractGeckoAPISet the geo model resource location for a scripted block.- Specified by:
setModelin classAbstractGeckoAPI- Parameters:
scriptedBlock- The target blockmodel- The model path
-
setTexture
public void setTexture(IBlockScripted scriptedBlock, String texture)
Description copied from class:AbstractGeckoAPISet the texture resource location for a scripted block.- Specified by:
setTexturein classAbstractGeckoAPI- Parameters:
scriptedBlock- The target blocktexture- The texture path
-
setAnimationFile
public void setAnimationFile(IBlockScripted scriptedBlock, String animation)
Description copied from class:AbstractGeckoAPISet the animation file resource location for a scripted block.- Specified by:
setAnimationFilein classAbstractGeckoAPI- Parameters:
scriptedBlock- The target blockanimation- The animation file path
-
setIdleAnimation
public void setIdleAnimation(IBlockScripted scriptedBlock, String animation)
Description copied from class:AbstractGeckoAPISet the idle animation name for a scripted block.- Specified by:
setIdleAnimationin classAbstractGeckoAPI- Parameters:
scriptedBlock- The target blockanimation- The animation name from the animation file
-
syncAnimForPlayer
public void syncAnimForPlayer(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder, IPlayer<net.minecraft.entity.player.EntityPlayerMP> player)
Description copied from class:AbstractGeckoAPISync an animation to a specific player for a scripted block.- Specified by:
syncAnimForPlayerin classAbstractGeckoAPI- Parameters:
scriptedBlock- The block to play the animation onbuilder- The animation builder with queued animationsplayer- The player to send the animation to
-
syncAnimForAll
public void syncAnimForAll(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder)
Description copied from class:AbstractGeckoAPISync an animation to all players for a scripted block.- Specified by:
syncAnimForAllin classAbstractGeckoAPI- Parameters:
scriptedBlock- The block to play the animation onbuilder- The animation builder with queued animations
-
setItemModel
public void setItemModel(IItemCustomizable item, String model)
Description copied from class:AbstractGeckoAPISet the geo model resource location for a customizable item. Works with both Scripted Items and Linked Items.- Specified by:
setItemModelin classAbstractGeckoAPI- 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 void setItemTexture(IItemCustomizable item, String texture)
Description copied from class:AbstractGeckoAPISet the texture resource location for a customizable item.- Specified by:
setItemTexturein classAbstractGeckoAPI- Parameters:
item- The itemtexture- The texture path (e.g. "geckolib3:textures/item/mytexture.png")
-
setItemAnimationFile
public void setItemAnimationFile(IItemCustomizable item, String animation)
Description copied from class:AbstractGeckoAPISet the animation file resource location for a customizable item.- Specified by:
setItemAnimationFilein classAbstractGeckoAPI- Parameters:
item- The itemanimation- The animation file path (e.g. "geckolib3:animations/mymodel.animation.json")
-
setItemIdleAnimation
public void setItemIdleAnimation(IItemCustomizable item, String animation)
Description copied from class:AbstractGeckoAPISet the idle animation name for a customizable item.- Specified by:
setItemIdleAnimationin classAbstractGeckoAPI- Parameters:
item- The itemanimation- The animation name from the animation file
-
hasItemModel
public boolean hasItemModel(IItemCustomizable item)
Description copied from class:AbstractGeckoAPICheck if a customizable item has a gecko model assigned.- Specified by:
hasItemModelin classAbstractGeckoAPI- Parameters:
item- The item to check- Returns:
- true if the item has a custom gecko model
-
clearItemModel
public void clearItemModel(IItemCustomizable item)
Description copied from class:AbstractGeckoAPIRemove the gecko model from a customizable item, reverting to normal 2D rendering.- Specified by:
clearItemModelin classAbstractGeckoAPI- Parameters:
item- The item to clear the model from
-
setDisplayJSON
public void setDisplayJSON(IItemCustomizable item, String displayFile)
Description copied from class:AbstractGeckoAPISet 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")- Specified by:
setDisplayJSONin classAbstractGeckoAPI- Parameters:
item- The item to set the display JSON ondisplayFile- The display JSON filename (e.g. "sword.json")
-
getDisplayFileList
public String[] getDisplayFileList()
Description copied from class:AbstractGeckoAPIGet a list of all loaded display file names from item_displays/ folders.- Specified by:
getDisplayFileListin classAbstractGeckoAPI- Returns:
- Array of display file names
-
setItemDisplay
public void setItemDisplay(IItemCustomizable item, String context, float tx, float ty, float tz, float rx, float ry, float rz, float sx, float sy, float sz)
Description copied from class:AbstractGeckoAPISet 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.
- Specified by:
setItemDisplayin classAbstractGeckoAPI- 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
-
-