-
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)
endSets 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.