Class AbstractGeckoAPI

  • Direct Known Subclasses:
    GeckoAPI

    public abstract class AbstractGeckoAPI
    extends Object
    • Constructor Detail

      • AbstractGeckoAPI

        public AbstractGeckoAPI()
    • Method Detail

      • IsAvailable

        public static boolean IsAvailable()
      • 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 location
        animationName - 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 NPC
        model - 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 NPC
        texture - 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 NPC
        animation - 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 NPC
        animation - 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 on
        builder - The animation builder with queued animations
        player - 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 on
        builder - 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 block
        model - 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 block
        texture - 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 block
        animation - 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 block
        animation - 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 on
        builder - The animation builder with queued animations
        player - 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 on
        builder - 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 item
        texture - 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 item
        animation - 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 item
        animation - 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 on
        displayFile - 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 on
        context - The render context: "first_person", "third_person", "inventory", or "ground"
        tx - Translation X
        ty - Translation Y
        tz - Translation Z
        rx - Rotation X (degrees)
        ry - Rotation Y (degrees)
        rz - Rotation Z (degrees)
        sx - Scale X
        sy - Scale Y
        sz - Scale Z