Skip to content

ItemStackTexture

Since 2.2.1

ItemStackTexture renders one or more ItemStacks as a GUI texture. When multiple stacks are provided, they cycle automatically every 20 ticks (1 second).

Registry name: item_stack_texture

INFO

Extends TransformTexture — supports rotate(), scale(), transform().


Usage

java
// Single item
IGuiTexture diamondIcon = new ItemStackTexture(Items.DIAMOND);

// Multiple items — cycle every 20 ticks
IGuiTexture cycleIcon = new ItemStackTexture(
    Items.DIAMOND, Items.EMERALD, Items.GOLD_INGOT
);

// From ItemStacks
IGuiTexture enchanted = new ItemStackTexture(
    new ItemStack(Items.DIAMOND_SWORD)
);

// Tinted
IGuiTexture tinted = new ItemStackTexture(Items.DIAMOND)
    .setColor(0x80FFFFFF); // 50 % opacity

Fields

NameTypeDescription
itemsItemStack[]The item stacks to display.

Methods

MethodReturnsDescription
setItems(ItemStack...)ItemStackTextureReplaces the displayed stacks and resets the cycle index.
setColor(int)ItemStackTextureSets an ARGB tint overlay applied over the rendered item.
copy()ItemStackTextureReturns a deep copy.

Released under the MIT License.