-
Notifications
You must be signed in to change notification settings - Fork 0
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.
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")
Returns the registry name of the item.
-
Returns:
String
make item player.getMainHandItem()
say item.getName()
Returns whether the item is currently damaged.
-
Returns:
Boolean
Returns whether the item can take damage.
-
Returns:
Boolean
Returns whether the item can be enchanted.
-
Returns:
Boolean
Returns whether the item can stack.
-
Returns:
Boolean
Returns the current stack count.
-
Returns:
Integer
Returns the maximum stack size.
-
Returns:
Integer
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()
Returns whether this model is in exclusive (quad-selection) mode.
-
Returns:
Boolean
Returns the current custom light value, or -1 if not set. Inherits from parent if unset.
-
Returns:
Integer
Returns the current glint override value, or -1 if not set. Inherits from parent if unset.
-
Returns:
Integer
Returns whether the item is being rendered in the main hand (first or third person).
-
Returns:
Boolean
Returns whether the item is being rendered in the off hand (first or third person).
-
Returns:
Boolean
Returns whether the item is being rendered in first person.
-
Returns:
Boolean
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
Sets the minecraft:item_model data component.
-
Parameters:
-
model—String— The model ID to apply
-
make item player.getMainHandItem()
item.setItemModel("mypack:custom_sword")
Sets the bobbing animation time.
-
Parameters:
-
bobbingTime—Integer
-
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)
-
Returns the value of a data component as a string.
-
Parameters:
-
key—String
-
-
Returns:
String
Returns whether the item has the specified data component.
-
Parameters:
-
key—String
-
-
Returns:
Boolean
Returns a list of all data component keys on this item.
-
Returns:
List<String>
Returns all data components as a list of key-value maps.
-
Returns:
List<Map<String, String>>
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")
Sets the render color using RGB values (0–255 each).
-
Parameters:
-
r,g,b—Integer
-
Sets the opacity/alpha (0.0 = fully transparent, 1.0 = fully opaque).
-
Parameters:
-
opacity—Double
-
Sets a custom light level override (-1 to 15). Use -1 to disable.
-
Parameters:
-
light—Integer
-
Sets the glint override (-1 = default, 0 = no glint, 1–2 = glint modes).
-
Parameters:
-
glint—Integer
-
Sets a tint color for a specific quad tint index.
-
Parameters:
-
index—Integer— Tint index -
color—Integer— ARGB color value
-
Sets a global tint color (applies to index -1).
-
Parameters:
-
color—Integer— ARGB color value
-
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)
Defines the range of quads to render.
-
Parameters:
-
start,end—Integer
-
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)
Moves the model by the given offset.
-
Parameters:
dx,dy,dz—Double
Moves the model along a single axis.
-
Parameters:
Double
Rotates the model around all three axes (in degrees).
-
Parameters:
dx,dy,dz—Double
Rotates the model by angle degrees around an arbitrary axis vector.
-
Parameters:
-
angle—Double— Degrees -
axisX,axisY,axisZ—Double— Axis vector (will be normalized)
-
Rotates the model around a single axis (in degrees).
-
Parameters:
Double
Multiplies the model's scale on all axes.
-
Parameters:
sx,sy,sz—Double
Scales the model along a single axis.
-
Parameters:
Double
Applies a shear transformation using the six shear components.
-
Parameters: All
Double
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)
Sets another ItemModel as the parent. Transforms, light, glint, and tints are inherited. Circular dependencies are automatically rejected.
-
Parameters:
-
parent—ItemModel
-
Removes the parent reference from this model.
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()
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
Creates a copy of this model with the same item stack and display context, and registers it for rendering.
-
Returns:
ItemModel
~ Smooth bob animation using delta time
make item player.getMainHandItem()
make bobY item.smooth(0, 0.05, 0.08 * getDelta())
item.translateY(bobY)
GET IN TOUCH - omar@merakistudios.dev
© 2026 Omar Mohamed. All Rights Reserved.