Class GeckoAPI

    • Method Detail

      • createAnimationBuilder

        public IGeckoAnimationBuilder createAnimationBuilder()
        Description copied from class: AbstractGeckoAPI
        Create a new animation builder for constructing animation sequences.

        Usage example:

         var builder = gecko.createAnimationBuilder();
         builder.playOnce("animation.model.attack").loop("animation.model.idle");
         gecko.syncAnimForAll(npc, builder);
         
        Specified by:
        createAnimationBuilder in class AbstractGeckoAPI
        Returns:
        a new animation builder instance
      • getAnimatable

        public IGeckoAnimatable getAnimatable​(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc)
        Description copied from class: AbstractGeckoAPI
        Get the gecko model configuration interface for an NPC. The returned object allows reading and writing model, texture, animation file, and animation state settings.
        Specified by:
        getAnimatable in class AbstractGeckoAPI
        Parameters:
        npc - the NPC to configure
        Returns:
        the animatable interface for this NPC
        See Also:
        IGeckoAnimatable
      • getAnimatable

        public IGeckoAnimatable getAnimatable​(IBlockScripted scriptedBlock)
        Description copied from class: AbstractGeckoAPI
        Get the gecko model configuration interface for a scripted block. The returned object allows reading and writing model, texture, animation file, and animation state settings.
        Specified by:
        getAnimatable in class AbstractGeckoAPI
        Parameters:
        scriptedBlock - the scripted block to configure
        Returns:
        the animatable interface for this block
        See Also:
        IGeckoAnimatable
      • getAnimationList

        public String[] getAnimationList​(String animationFile)
        Description copied from class: AbstractGeckoAPI
        Get a list of all animation names defined in an animation file.
        Specified by:
        getAnimationList in class AbstractGeckoAPI
        Parameters:
        animationFile - the animation file resource location (e.g. "geckolib3:animations/model.animation.json")
        Returns:
        array of animation names, or an empty array if the file was not found
      • getAnimationFileList

        public String[] getAnimationFileList()
        Description copied from class: AbstractGeckoAPI
        Get a list of all loaded animation file resource locations.
        Specified by:
        getAnimationFileList in class AbstractGeckoAPI
        Returns:
        array of animation file resource location strings
      • getAnimation

        public IGeckoAnimation getAnimation​(String animationFile,
                                            String animationName)
        Description copied from class: AbstractGeckoAPI
        Get animation metadata from a loaded animation file.
        Specified by:
        getAnimation in class AbstractGeckoAPI
        Parameters:
        animationFile - the animation file resource location
        animationName - the animation name within the file
        Returns:
        the animation metadata, or null if not found
        See Also:
        IGeckoAnimation
      • colorOfRGB

        public IGeckoColor colorOfRGB​(int r,
                                      int g,
                                      int b)
        Description copied from class: AbstractGeckoAPI
        Create a color from RGB components.
        Specified by:
        colorOfRGB in class AbstractGeckoAPI
        Parameters:
        r - red component (0-255)
        g - green component (0-255)
        b - blue component (0-255)
        Returns:
        a new color instance
        See Also:
        IGeckoColor
      • colorOfRGBA

        public IGeckoColor colorOfRGBA​(int r,
                                       int g,
                                       int b,
                                       int a)
        Description copied from class: AbstractGeckoAPI
        Create a color from RGBA components.
        Specified by:
        colorOfRGBA in class AbstractGeckoAPI
        Parameters:
        r - red component (0-255)
        g - green component (0-255)
        b - blue component (0-255)
        a - alpha component (0-255, where 255 is fully opaque)
        Returns:
        a new color instance
        See Also:
        IGeckoColor
      • setModel

        public void setModel​(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc,
                             String model)
        Description copied from class: AbstractGeckoAPI
        Set the GeckoLib geo model resource location for an NPC.
        Specified by:
        setModel in class AbstractGeckoAPI
        Parameters:
        npc - the target NPC
        model - the model resource location (e.g. "geckolib3:geo/npc.geo.json")
      • setTexture

        public void setTexture​(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc,
                               String texture)
        Description copied from class: AbstractGeckoAPI
        Set the texture resource location for an NPC.
        Specified by:
        setTexture in class AbstractGeckoAPI
        Parameters:
        npc - the target NPC
        texture - the texture resource location (e.g. "geckolib3:textures/model/npc.png")
      • setAnimationFile

        public void setAnimationFile​(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc,
                                     String animation)
        Description copied from class: AbstractGeckoAPI
        Set the animation file resource location for an NPC.
        Specified by:
        setAnimationFile in class AbstractGeckoAPI
        Parameters:
        npc - the target NPC
        animation - the animation file resource location (e.g. "geckolib3:animations/npc.animation.json")
      • setIdleAnimation

        public void setIdleAnimation​(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc,
                                     String animation)
        Description copied from class: AbstractGeckoAPI
        Set the idle animation name for an NPC. The animation must exist in the currently assigned animation file.
        Specified by:
        setIdleAnimation in class AbstractGeckoAPI
        Parameters:
        npc - the target NPC
        animation - the animation name (e.g. "animation.npc.idle")
      • syncAnimForPlayer

        public void syncAnimForPlayer​(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc,
                                      IGeckoAnimationBuilder builder,
                                      IPlayer<net.minecraft.entity.player.EntityPlayerMP> player)
        Description copied from class: AbstractGeckoAPI
        Sync a queued animation sequence to a specific player for an NPC. Only the specified player will see the animation.
        Specified by:
        syncAnimForPlayer in class AbstractGeckoAPI
        Parameters:
        npc - the NPC to play the animation on
        builder - the animation builder containing the queued animation sequence
        player - the player to send the animation to
      • syncAnimForAll

        public void syncAnimForAll​(ICustomNpc<noppes.npcs.entity.EntityNPCInterface> npc,
                                   IGeckoAnimationBuilder builder)
        Description copied from class: AbstractGeckoAPI
        Sync a queued animation sequence to all connected players for an NPC.
        Specified by:
        syncAnimForAll in class AbstractGeckoAPI
        Parameters:
        npc - the NPC to play the animation on
        builder - the animation builder containing the queued animation sequence
      • setModel

        public void setModel​(IBlockScripted scriptedBlock,
                             String model)
        Description copied from class: AbstractGeckoAPI
        Set the GeckoLib geo model resource location for a scripted block.
        Specified by:
        setModel in class AbstractGeckoAPI
        Parameters:
        scriptedBlock - the target scripted block
        model - the model resource location (e.g. "geckolib3:geo/block.geo.json")
      • setTexture

        public void setTexture​(IBlockScripted scriptedBlock,
                               String texture)
        Description copied from class: AbstractGeckoAPI
        Set the texture resource location for a scripted block.
        Specified by:
        setTexture in class AbstractGeckoAPI
        Parameters:
        scriptedBlock - the target scripted block
        texture - the texture resource location (e.g. "geckolib3:textures/model/block.png")
      • setAnimationFile

        public void setAnimationFile​(IBlockScripted scriptedBlock,
                                     String animation)
        Description copied from class: AbstractGeckoAPI
        Set the animation file resource location for a scripted block.
        Specified by:
        setAnimationFile in class AbstractGeckoAPI
        Parameters:
        scriptedBlock - the target scripted block
        animation - the animation file resource location (e.g. "geckolib3:animations/block.animation.json")
      • setIdleAnimation

        public void setIdleAnimation​(IBlockScripted scriptedBlock,
                                     String animation)
        Description copied from class: AbstractGeckoAPI
        Set the idle animation name for a scripted block. The animation must exist in the currently assigned animation file.
        Specified by:
        setIdleAnimation in class AbstractGeckoAPI
        Parameters:
        scriptedBlock - the target scripted block
        animation - the animation name (e.g. "animation.block.idle")
      • syncAnimForPlayer

        public void syncAnimForPlayer​(IBlockScripted scriptedBlock,
                                      IGeckoAnimationBuilder builder,
                                      IPlayer<net.minecraft.entity.player.EntityPlayerMP> player)
        Description copied from class: AbstractGeckoAPI
        Sync a queued animation sequence to a specific player for a scripted block. Only the specified player will see the animation.
        Specified by:
        syncAnimForPlayer in class AbstractGeckoAPI
        Parameters:
        scriptedBlock - the scripted block to play the animation on
        builder - the animation builder containing the queued animation sequence
        player - the player to send the animation to
      • syncAnimForAll

        public void syncAnimForAll​(IBlockScripted scriptedBlock,
                                   IGeckoAnimationBuilder builder)
        Description copied from class: AbstractGeckoAPI
        Sync a queued animation sequence to all connected players for a scripted block.
        Specified by:
        syncAnimForAll in class AbstractGeckoAPI
        Parameters:
        scriptedBlock - the scripted block to play the animation on
        builder - the animation builder containing the queued animation sequence
      • getItemGecko

        public IGeckoItemModel getItemGecko​(IItemCustomizable item)
        Description copied from class: AbstractGeckoAPI
        Get the gecko model interface for a customizable item. Works with both Scripted Items and Linked Items. The returned object allows reading and writing model, texture, animation, and display transform settings.

        Usage example:

         var itemGecko = gecko.getItemGecko(event.item);
         itemGecko.setModel("geckolib3:geo/sword.geo.json");
         itemGecko.setTexture("geckolib3:textures/model/sword.png");
         itemGecko.setAnimationFile("geckolib3:animations/sword.animation.json");
        
         var anim = itemGecko.getItemAnimation();
         anim.setIdleAnimation("animation.sword.idle");
         anim.setAttackAnimation("animation.sword.attack");
         
        Specified by:
        getItemGecko in class AbstractGeckoAPI
        Parameters:
        item - the customizable item (IItemCustom or IItemLinked)
        Returns:
        the gecko model interface for this item
        See Also:
        IGeckoItemModel
      • getDisplayFileList

        public String[] getDisplayFileList()
        Description copied from class: AbstractGeckoAPI
        Get a list of all loaded display file names from item_displays/ resource folders. Display files control how 3D item models are positioned, rotated, and scaled in each render context (first person, third person, inventory, ground).
        Specified by:
        getDisplayFileList in class AbstractGeckoAPI
        Returns:
        array of display file names (e.g. "sword.json", "tool.json")