Skip to content

ItemModel

Omar Mohamed edited this page Mar 24, 2026 · 2 revisions

ItemModel

Represents a renderable item model in the world. Supports full transform control (translation, rotation, scale, shear), color/opacity, lighting, glint, tinting, data components, and parent-child hierarchies.


Constructor

ItemModel(itemId)

Creates a new ItemModel from an item ID and registers it for rendering.

  • Parameters:
    • itemId β€” String β€” The item's namespaced ID (e.g. "minecraft:diamond_sword")
make sword new ItemModel("minecraft:diamond_sword")

Functions

Item Info

getName()

Returns the registry name of the item.

  • Returns: String
make item player.getMainHandItem()
say item.getName()

isDamaged()

Returns whether the item is currently damaged.

  • Returns: Boolean

isDamageable()

Returns whether the item can take damage.

  • Returns: Boolean

isEnchantable()

Returns whether the item can be enchanted.

  • Returns: Boolean

isStackable()

Returns whether the item can stack.

  • Returns: Boolean

getCount()

Returns the current stack count.

  • Returns: Integer

getMaxCount()

Returns the maximum stack size.

  • Returns: Integer

getBobbingAnimationTime()

Returns the bobbing animation time of the item.

  • Returns: Integer
make item player.getMainHandItem()
check item.isDamaged() do
    say "Item is damaged!"
end
say item.getCount()

Rendering State

isExclusive()

Returns whether this model is in exclusive (quad-selection) mode.

  • Returns: Boolean

getLight()

Returns the current custom light value, or -1 if not set. Inherits from parent if unset.

  • Returns: Integer

getGlint()

Returns the current glint override value, or -1 if not set. Inherits from parent if unset.

  • Returns: Integer

isMainHand()

Returns whether the item is being rendered in the main hand (first or third person).

  • Returns: Boolean

isOffHand()

Returns whether the item is being rendered in the off hand (first or third person).

  • Returns: Boolean

isFirstPerson()

Returns whether the item is being rendered in first person.

  • Returns: Boolean

getDisplayContextName()

Returns the name of the current display context.

  • Returns: String β€” e.g. "FIRST_PERSON_RIGHT_HAND"
make item player.getMainHandItem()
check item.isFirstPerson() do
    item.translate(0, 0.1, 0)
end

Data Components

setItemModel(model)

Sets the minecraft:item_model data component.

  • Parameters:
    • model β€” String β€” The model ID to apply
make item player.getMainHandItem()
item.setItemModel("mypack:custom_sword")

setBobbingTime(bobbingTime)

Sets the bobbing animation time.

  • Parameters:
    • bobbingTime β€” Integer

setDataComponent(key, value)

Sets an arbitrary data component by key.

  • Parameters:
    • key β€” String β€” Component key (e.g. "minecraft:custom_name")
    • value β€” Object β€” Value to set (converted to string internally)

getDataComponent(key)

Returns the value of a data component as a string.

  • Parameters:
    • key β€” String
  • Returns: String

hasDataComponent(key)

Returns whether the item has the specified data component.

  • Parameters:
    • key β€” String
  • Returns: Boolean

getDataComponentIds()

Returns a list of all data component keys on this item.

  • Returns: List<String>

getDataComponents()

Returns all data components as a list of key-value maps.

  • Returns: List<Map<String, String>>

removeDataComponent(key)

Removes a data component by key.

  • Parameters:
    • key β€” String
make item player.getMainHandItem()
check item.hasDataComponent("minecraft:custom_name") do
    say item.getDataComponent("minecraft:custom_name")
end
item.setDataComponent("minecraft:custom_name", "My Sword")
item.removeDataComponent("minecraft:enchantments")

Color & Appearance

setColor(r, g, b)

Sets the render color using RGB values (0–255 each).

  • Parameters:
    • r, g, b β€” Integer

setOpacity(opacity)

Sets the opacity/alpha (0.0 = fully transparent, 1.0 = fully opaque).

  • Parameters:
    • opacity β€” Double

setLight(light)

Sets a custom light level override (-1 to 15). Use -1 to disable.

  • Parameters:
    • light β€” Integer

setGlint(glint)

Sets the glint override (-1 = default, 0 = no glint, 1–2 = glint modes).

  • Parameters:
    • glint β€” Integer

setTint(index, color)

Sets a tint color for a specific quad tint index.

  • Parameters:
    • index β€” Integer β€” Tint index
    • color β€” Integer β€” ARGB color value

setTint(color)

Sets a global tint color (applies to index -1).

  • Parameters:
    • color β€” Integer β€” ARGB color value

setQuadColor(color)

Sets a selection/quad override color.

  • Parameters:
    • color β€” Integer β€” ARGB color value
make item player.getMainHandItem()
item.setColor(255, 80, 0)
item.setOpacity(0.8)
item.setLight(15)
item.setGlint(0)

Quad Selection

setQuads(start, end)

Defines the range of quads to render.

  • Parameters:
    • start, end β€” Integer

select(quadStart, quadEnd)

Same as setQuads, but also enables exclusive mode (only selected quads are rendered).

  • Parameters:
    • quadStart, quadEnd β€” Integer
make item player.getMainHandItem()
~ Only render quads 0 through 3
item.select(0, 3)

Transforms

translate(dx, dy, dz)

Moves the model by the given offset.

  • Parameters: dx, dy, dz β€” Double

translateX(dx) / translateY(dy) / translateZ(dz)

Moves the model along a single axis.

  • Parameters: Double

rotate(dx, dy, dz)

Rotates the model around all three axes (in degrees).

  • Parameters: dx, dy, dz β€” Double

rotateAxis(angle, axisX, axisY, axisZ)

Rotates the model by angle degrees around an arbitrary axis vector.

  • Parameters:
    • angle β€” Double β€” Degrees
    • axisX, axisY, axisZ β€” Double β€” Axis vector (will be normalized)

rotateX(angle) / rotateY(angle) / rotateZ(angle)

Rotates the model around a single axis (in degrees).

  • Parameters: Double

scale(sx, sy, sz)

Multiplies the model's scale on all axes.

  • Parameters: sx, sy, sz β€” Double

scaleX(sx) / scaleY(sy) / scaleZ(sz)

Scales the model along a single axis.

  • Parameters: Double

shear(xy, xz, yx, yz, zx, zy)

Applies a shear transformation using the six shear components.

  • Parameters: All Double

setPivot(x, y, z)

Sets the pivot point for rotation and scale (default is 0.5, 0.5, 0.5).

  • Parameters: x, y, z β€” Double
make item player.getMainHandItem()

~ Smooth floating animation
make targetY 0.1
make currentY item.smooth(0, targetY, 0.1)
item.translateY(currentY)

~ Spin on Y axis
item.rotateY(45 * getDelta())

~ Scale up slightly
item.scale(1.2, 1.2, 1.2)

~ Rotate around a custom axis
item.rotateAxis(90, 0, 1, 0)

Hierarchy

setParent(parent)

Sets another ItemModel as the parent. Transforms, light, glint, and tints are inherited. Circular dependencies are automatically rejected.

detach()

Removes the parent reference from this model.

hasParent()

Returns whether this model currently has a parent.

  • Returns: Boolean
make base player.getMainHandItem()
make overlay base.copy()

~ overlay inherits transforms from base
overlay.setParent(base)
overlay.setItemModel("mypack:overlay_model")

~ Later, detach if needed
overlay.detach()

Utility

smooth(current, target, speed)

Returns a framerate-independent interpolated value between current and target.

  • Parameters:
    • current β€” Double
    • target β€” Double
    • speed β€” Double β€” Interpolation speed (0.0–1.0)
  • Returns: Double

copy()

Creates a copy of this model with the same item stack and display context, and registers it for rendering.

~ Smooth bob animation using delta time
make item player.getMainHandItem()
make bobY item.smooth(0, 0.05, 0.08 * getDelta())
item.translateY(bobY)

πŸ“– InteractiveStuff Docs


🧱 Types


βš™οΈ Scripting

πŸ“ƒ Built-in Library

Clone this wiki locally