+
+ +

Interface IGeckoItemModel

+
+
+
+
    +
  • +
    +
    public interface IGeckoItemModel
    +
    Interface for accessing and modifying GeckoLib 3D model configuration on items. + Provides control over model, texture, animation files, display transforms, + and display JSON settings for Scripted and Linked items. + +

    Changes made through this interface are automatically persisted to the + ItemStack's NBT and synced to clients via container mechanics.

    + +

    Obtain an instance via AbstractGeckoAPI.getItemGecko(noppes.npcs.api.item.IItemCustomizable).

    + +

    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");
    + itemGecko.setIdleAnimation("animation.sword.idle");
    + 
    +
    +
    See Also:
    +
    AbstractGeckoAPI.getItemGecko(noppes.npcs.api.item.IItemCustomizable)
    +
    +
  • +
+
+
+
    +
  • + +
    +
      +
    • + + +

      Method Summary

      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      All Methods Instance Methods Abstract Methods 
      Modifier and TypeMethodDescription
      voidclear() +
      Remove the gecko model from this item, reverting it to normal 2D rendering.
      +
      StringgetAnimationFile() +
      Get the animation file resource location.
      +
      StringgetDisplayJSON() +
      Get the display JSON filename currently assigned to this item.
      +
      StringgetIdleAnimation() +
      Get the idle animation name.
      +
      StringgetModel() +
      Get the geo model resource location.
      +
      StringgetTexture() +
      Get the texture resource location.
      +
      intgetTransitionLengthTicks() +
      Get the transition duration between animations in ticks.
      +
      booleanhasModel() +
      Check if this item currently has a gecko model assigned.
      +
      voidsetAnimationFile​(String animationFile) +
      Set the animation file resource location.
      +
      voidsetDisplay​(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.
      +
      voidsetDisplayJSON​(String displayFile) +
      Set the display JSON file for controlling how the 3D model is positioned, + rotated, and scaled in each render context (first person, third person, + inventory, and ground).
      +
      voidsetIdleAnimation​(String animation) +
      Set the idle animation name.
      +
      voidsetModel​(String model) +
      Set the GeckoLib geo model resource location.
      +
      voidsetTexture​(String texture) +
      Set the texture resource location used when rendering this item's 3D model.
      +
      voidsetTransitionLengthTicks​(int ticks) +
      Set the transition duration between animations in ticks.
      +
      +
    • +
    +
    +
  • +
+
+
+
    +
  • + +
    +
      +
    • + + +

      Method Detail

      + + + +
        +
      • +

        hasModel

        +
        boolean hasModel()
        +
        Check if this item currently has a gecko model assigned.
        +
        +
        Returns:
        +
        true if the item has a GeckoLib 3D model
        +
        +
      • +
      + + + +
        +
      • +

        getModel

        +
        String getModel()
        +
        Get the geo model resource location.
        +
        +
        Returns:
        +
        the model resource location string, or an empty string if no model is set
        +
        +
      • +
      + + + +
        +
      • +

        setModel

        +
        void setModel​(String model)
        +
        Set the GeckoLib geo model resource location. + The model file should be a Blockbench geo JSON exported for GeckoLib.
        +
        +
        Parameters:
        +
        model - the model resource location (e.g. "geckolib3:geo/sword.geo.json")
        +
        +
      • +
      + + + +
        +
      • +

        getTexture

        +
        String getTexture()
        +
        Get the texture resource location.
        +
        +
        Returns:
        +
        the texture resource location string, or an empty string if no texture is set
        +
        +
      • +
      + + + +
        +
      • +

        setTexture

        +
        void setTexture​(String texture)
        +
        Set the texture resource location used when rendering this item's 3D model.
        +
        +
        Parameters:
        +
        texture - the texture resource location (e.g. "geckolib3:textures/model/sword.png")
        +
        +
      • +
      + + + +
        +
      • +

        getAnimationFile

        +
        String getAnimationFile()
        +
        Get the animation file resource location.
        +
        +
        Returns:
        +
        the animation file resource location string, or an empty string if none is set
        +
        +
      • +
      + + + +
        +
      • +

        setAnimationFile

        +
        void setAnimationFile​(String animationFile)
        +
        Set the animation file resource location. + The file should be a Blockbench animation JSON exported for GeckoLib.
        +
        +
        Parameters:
        +
        animationFile - the animation file resource location + (e.g. "geckolib3:animations/sword.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 item is not performing other actions. + The animation must be defined in the currently assigned animation file.
        +
        +
        Parameters:
        +
        animation - the animation name (e.g. "animation.sword.idle")
        +
        +
      • +
      + + + +
        +
      • +

        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)
        +
        +
      • +
      + + + +
        +
      • +

        getDisplayJSON

        +
        String getDisplayJSON()
        +
        Get the display JSON filename currently assigned to this item.
        +
        +
        Returns:
        +
        the display JSON filename (e.g. "sword.json"), or an empty string if none is set
        +
        +
      • +
      + + + +
        +
      • +

        setDisplayJSON

        +
        void setDisplayJSON​(String displayFile)
        +
        Set the display JSON file for controlling how the 3D model is positioned, + rotated, and scaled in each render context (first person, third person, + inventory, and ground). + +

        Display files are loaded from assets/{domain}/item_displays/ resource folders. + Use AbstractGeckoAPI.getDisplayFileList() to list available files.

        +
        +
        Parameters:
        +
        displayFile - the display JSON filename (e.g. "sword.json")
        +
        See Also:
        +
        AbstractGeckoAPI.getDisplayFileList()
        +
        +
      • +
      + + + +
        +
      • +

        setDisplay

        +
        void setDisplay​(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. + This overrides any display JSON settings for the specified context and + controls how the 3D model is positioned, rotated, and scaled. + +

        Valid context values:

        +
          +
        • "first_person" - held item in first-person view
        • +
        • "third_person" - held item in third-person view
        • +
        • "inventory" - item icon in inventory GUI
        • +
        • "ground" - dropped item entity on the ground
        • +
        +
        +
        Parameters:
        +
        context - the render context name
        +
        tx - translation X offset
        +
        ty - translation Y offset
        +
        tz - translation Z offset
        +
        rx - rotation X in degrees
        +
        ry - rotation Y in degrees
        +
        rz - rotation Z in degrees
        +
        sx - scale X multiplier
        +
        sy - scale Y multiplier
        +
        sz - scale Z multiplier
        +
        Throws:
        +
        IllegalArgumentException - if the context name is not recognized
        +
        +
      • +
      + + + +
        +
      • +

        clear

        +
        void clear()
        +
        Remove the gecko model from this item, reverting it to normal 2D rendering. + Clears all model, texture, animation, and display settings.
        +
      • +
      +
    • +
    +
    +
  • +
+
+
+