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

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


Usage

// 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
val diamond = ItemStackTexture(Items.DIAMOND)

val cycle = ItemStackTexture(Items.DIAMOND, Items.EMERALD, Items.GOLD_INGOT)
let icon = new ItemStackTexture(Items.DIAMOND);

let cycle = new ItemStackTexture(Items.DIAMOND, Items.EMERALD);

Fields

Name Type Description
items ItemStack[] The item stacks to display.

Methods

Method Returns Description
setItems(ItemStack...) ItemStackTexture Replaces the displayed stacks and resets the cycle index.
setColor(int) ItemStackTexture Sets an ARGB tint overlay applied over the rendered item.
copy() ItemStackTexture Returns a deep copy.