Skip to content

Sprite MCMETA

thecodewarrior edited this page Nov 21, 2017 · 8 revisions

( look for <> elements elsewhere in this document, |xxx| elements are placeholders for real values )

{
    // ... other mcmeta stuff
    "spritesheet": <spritesheet>
}

The root file


<spritesheet> = {
    "textureWidth": |texture width in pixels|,
    "textureHeight": |texture height in pixels|,
    "sprites: <spritelist>
}

Defines spritesheet data. The "textureWidth" and "textureHeight" values are used to calculate the UVs for the sprites while still allowing texturepacks to rescale the texture file for more detail.


<spritelist>: {
    "|sprite name|": <sprite>,
    ...
}

Defines the list of sprites in the texture and their names.

<sprite> = [|u|, |v|, |width|, |height|] // (all ints)

Shorthand for defining a simple sprite's properties. +u is right, +v is down, and 0,0 is in the top left of the image.


<sprite> = {
    "pos": [|u|, |v|, |width|, |height|],
    "frames": <frames>,
    "frameTime": <frametime>,
    "offset": <offset>,
    "nineSlice": <nineslice>
}

Defines a single sprite's properties. All but "pos" are optional


<frames> = |frame count, int|

Defines a simple number of one-tick frames. Shortcut for [0, 1, 2, 3, ... frame count-1]


<frames> = [|frame1|, |frame2|, |frame3|, ...] // (all ints)

Defines a sequence of frames, with each array element corresponding to a single tick.


<frametime> = |frame time multiplier, int|

Defines the number of ticks each specified frame will be repeated.


<offset> = [|u|, |v|]

Defines the position of frames. The formula for the adjusted u/v position of a frame is [spriteU + offsetU*frameID, spriteV + offsetV*frameID] where frameID is the number used in <frames>. Default value is [0, |sprite height|], meaning each frame is by default immediately below the last.


<nineslice> = [|u border|, |v border|]

Defines the width of the borders on the U and V axes of the texture. If both of these are null or "nineSlice" is unspecified the texture will not act as a nine slice image. Reducing one or the other of these to zero will effectively reduce the sprite to a middle and two caps. When a ninepatch is drawn with ISprite.drawClipped the long parts will be clipped and tiled as opposed to stretched.


Clone this wiki locally