Animated textures !
This commit is contained in:
@@ -15,8 +15,51 @@ Any mod can use any texture by its id, including the base game's, like `bworld:s
|
||||
|
||||
## Sizes
|
||||
|
||||
Textures can be any size up to 256×256. Blocks and items are made for 16×16 and stretch a texture of another size over
|
||||
the same face, so a 32×32 block texture is just a sharper one. Larger ones are for things like entity skins.
|
||||
Textures can be any size up to 256×256 (for [animated ones](#animated-textures), each frame). Blocks and items are made
|
||||
for 16×16 and stretch a texture of another size over the same face, so a 32×32 block texture is just a sharper one.
|
||||
Larger ones are for things like entity skins.
|
||||
|
||||
## Animated Textures
|
||||
|
||||
A texture animates when a `.json` with the same name sits next to its `.png`, like Minecraft's `.png.mcmeta` and in the
|
||||
same format. The png holds every frame, square ones stacked top to bottom by default:
|
||||
|
||||
```
|
||||
textures/lava_lamp.png 16×64, four 16×16 frames
|
||||
textures/lava_lamp.json
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"animation": {
|
||||
"frametime": 2,
|
||||
"interpolate": false,
|
||||
"frames": [0, 1, 2, { "index": 3, "time": 10 }, 2, 1],
|
||||
"width": 16,
|
||||
"height": 16
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Every field is optional, so `{ "animation": {} }` plays every frame in order, one tick each.
|
||||
|
||||
| Field | What it does |
|
||||
| ------------- | ----------------------------------------------------------------------------------------------- |
|
||||
| `frametime` | Ticks each frame shows, 1 if not given. There are 20 ticks a second. |
|
||||
| `interpolate` | Blends each frame into the next a tick at a time instead of switching. |
|
||||
| `frames` | The order to show frames in, by index or `{ "index", "time" }`. Every frame in order otherwise. |
|
||||
| `width` | A frame's width in pixels. |
|
||||
| `height` | A frame's height in pixels. |
|
||||
|
||||
Without `width` and `height`, frames are square and as big as the png's shorter side. Frames are counted like reading
|
||||
text, left to right then top to bottom, so a png can hold them in a grid as well as a strip.
|
||||
|
||||
Blocks, items and entities use an animated texture's id like any other and get the current frame. The size limit applies
|
||||
to a frame, and the whole png can be at most 4096×4096.
|
||||
|
||||
Every block using a texture shows the same frame at the same time. Each tick, the client copies the new frame of every
|
||||
animated texture whose frame changed into the atlas, and interpolated ones every tick. Long `frametime`s are cheaper
|
||||
than short ones.
|
||||
|
||||
## Missing Textures
|
||||
|
||||
|
||||
Reference in New Issue
Block a user