Item Display Support Gecko Lib + Item Stack Wrapper

This commit is contained in:
Kam committed 2026-03-12 05:50:51 -04:00
1 parent 6fa5f1c366
commit 9642c9f909
17 files changed
+949 -236

No files matched your search

@@ -5,6 +5,7 @@ import net.minecraft.entity.player.EntityPlayerMP;
import noppes.npcs.api.block.IBlockScripted;
import noppes.npcs.api.entity.ICustomNpc;
import noppes.npcs.api.entity.IPlayer;
import noppes.npcs.api.item.IItemCustomizable;
import noppes.npcs.entity.EntityNPCInterface;
public abstract class AbstractGeckoAPI {
@@ -227,10 +228,100 @@ public abstract class AbstractGeckoAPI {
*/
public abstract void syncAnimForAll(IBlockScripted scriptedBlock, IGeckoAnimationBuilder builder);
// TODO: Fix ScriptCustomItem
// ========================================================================
// Item Methods
// ========================================================================
// public abstract void setModel(ScriptCustomItem item, String model);
// public abstract void setTexture(ScriptCustomItem item, String texture);
// public abstract void setAnimationFile(ScriptCustomItem item, String animation);
// public abstract void setIdleAnimation(ScriptCustomItem item, String animation);
/**
* Set the geo model resource location for a customizable item.
* Works with both Scripted Items and Linked Items.
*
* @param item The item (IItemCustom or IItemLinked from event.item or API)
* @param model The model path (e.g. "geckolib3:geo/mymodel.geo.json")
*/
public abstract void setItemModel(IItemCustomizable item, String model);
/**
* Set the texture resource location for a customizable item.
*
* @param item The item
* @param texture The texture path (e.g. "geckolib3:textures/item/mytexture.png")
*/
public abstract void setItemTexture(IItemCustomizable item, String texture);
/**
* Set the animation file resource location for a customizable item.
*
* @param item The item
* @param animation The animation file path (e.g. "geckolib3:animations/mymodel.animation.json")
*/
public abstract void setItemAnimationFile(IItemCustomizable item, String animation);
/**
* Set the idle animation name for a customizable item.
*
* @param item The item
* @param animation The animation name from the animation file
*/
public abstract void setItemIdleAnimation(IItemCustomizable item, String animation);
/**
* Check if a customizable item has a gecko model assigned.
*
* @param item The item to check
* @return true if the item has a custom gecko model
*/
public abstract boolean hasItemModel(IItemCustomizable item);
/**
* Remove the gecko model from a customizable item, reverting to normal 2D rendering.
*
* @param item The item to clear the model from
*/
public abstract void clearItemModel(IItemCustomizable item);
/**
* 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).
*
* <p>Example: {@code GeckoAPI.setDisplayJSON(item, "sword.json")}</p>
*
* @param item The item to set the display JSON on
* @param displayFile The display JSON filename (e.g. "sword.json")
*/
public abstract void setDisplayJSON(IItemCustomizable item, String displayFile);
/**
* Get a list of all loaded display file names from item_displays/ folders.
*
* @return Array of display file names
*/
public abstract String[] getDisplayFileList();
/**
* 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.
*
* <p>If no per-context transform is set, the item's existing rotation/scale/translate
* properties are used as fallback.</p>
*
* @param item The item to set the display transform on
* @param context The render context: "first_person", "third_person", "inventory", or "ground"
* @param tx Translation X
* @param ty Translation Y
* @param tz Translation Z
* @param rx Rotation X (degrees)
* @param ry Rotation Y (degrees)
* @param rz Rotation Z (degrees)
* @param sx Scale X
* @param sy Scale Y
* @param sz Scale Z
*/
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);
}