canvasModel

fun canvasModel(width: Int, height: Int, offsetX: Double = 0.0, offsetY: Double = 0.0, scale: Double = 1.0): ItemModel

Creates a canvas model, which is an item model with a flat texture where each pixel is individually addressable using the colors part of the minecraft:custom_model_data component, where the pixel at (x, y) is found under the index y * width + x and (0, 0) is the top-left pixel.

The maximum width and height are 161 - |offsetX| and 161 - |offsetY| respectively. (Consider using multiple smaller canvases instead of a single large one to reduce the resource pack size.)

Parameters

width

The width of the canvas, in pixels.

height

The height of the canvas, in pixels.

offsetX

The x offset of the canvas texture to the item's center, pixels.

offsetY

The y offset of the canvas texture to the item's center, pixels.

scale

The size of the pixels in the canvas texture. A scale of 2 means each pixel is 2x2 pixels in game (assuming a client-side gui-scale of 1). Defaults to 1.

See also