-
Notifications
You must be signed in to change notification settings - Fork 25
Sprite MCMETA
( look for <> elements elsewhere in this document, |xxx| elements are placeholders for real values )
The root file:
{
// ... other mcmeta stuff
"spritesheet": <spritesheet>
}
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.
<spritesheet> = {
"textureWidth": |texture width in pixels|,
"textureHeight": |texture height in pixels|,
"|sprite name|": <sprite>
}
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> = [|u|, |v|, |width|, |height|] // (all ints)
Defines a single sprite's properties. All but "pos" are optional
<sprite> = {
"pos": [|u|, |v|, |width|, |height|],
"frames": <frames>,
"frameTime": <frametime>,
"offset": <offset>,
"ninePatch": <ninepatch>
}
Defines a simple number of one-tick frames. Shortcut for [0, 1, 2, 3, ... frame count-1]
<frames> = |frame count, int|
Defines a sequence of frames, with each array element corresponding to a single tick.
<frames> = [|frame1|, |frame2|, |frame3|, ...] // (all ints)
Defines the number of ticks each specified frame will be repeated.
<frametime> = |frame time multiplier, int|
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.
<offset> = [|u|, |v|]
Defines the width of the borders on the U and V axes of the texture. If both of these are
null or "ninePatch" is unspecified the texture will not act as a ninepatch. 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.
<ninepatch> = [|u border|, |v border|]
