Texture Animation

intermediate

PLEASE READ

This page will be part of a rewrite to accomodate for the removal of the Holiday Creator Feature experimental toggle. Expect this page to be rewritten or removed when this happens.

From this page you will learn:

  • How to apply flipbook textures to a block.
  • Which values you can apply in RP/textures/flipbook_textures.json and what they do.

Applying Flipbook Textures

Flipbook textures are animated textures. Blocks like fire, water, lava and magma use them. You can use animated texture for your blocks too! For the first time let's use magma's animated texture. You can simply apply animated magma's texture to your block by changing texture value to one, defined in Vanilla RP/textures/terrain_texture.json:

json
"magma": {
  "textures": "textures/blocks/magma"
}
1
2
3
BP/blocks/flipbook_block.jsonCopy
json
{
  "format_version": "1.20.60",
  "minecraft:block": {
    "description": {
      "identifier": "wiki:flipbook_block",
      "menu_category": {
        "category": "construction"
      }
    },
    "components": {
      "minecraft:unit_cube": {},
      "minecraft:material_instances": {
        "*": {
          "texture": "magma" // Add it here.
        }
      }
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

Now it has animated texture!

Defining Flipbook Textures

After making block have animated texture, it is time to figure out how it all works.

  1. Minecraft takes name and path to texture defined in terrain_texture.json
RP/textures/terrain_texture.jsonCopy
json
{
  "texture_name": "atlas.terrain",
  "resource_pack_name": "wiki", // ID for your resource pack
  "padding": 8, // Prevent textures from visually overflowing into each other
  "num_mip_levels": 4, // Quality of texture when viewed from a distance or at an angle
  "texture_data": {
    "magma": {
      "textures": "textures/blocks/magma"
    }
  }
}
1
2
3
4
5
6
7
8
9
10
11
  1. Minecraft searches looks into flipbook_textures.json aiming to find animation parameters for this name (magma)
RP/textures/flipbook_textures.jsonCopy
json
[
  {
    "atlas_tile": "magma",
    "flipbook_texture": "textures/blocks/magma",
    "ticks_per_frame": 10
  }
]
1
2
3
4
5
6
7

"atlas_tile" here adds animation parameters to magma name, defined in terrain_texture file.

  1. Minecraft uses this animated texture for blocks who have magma as texture.

Flipbook Texture Parameters

While looking up for something in vanilla flipbook texture file, you may notice some additional paramters:

ComponentTypeDescription
flipbook_texturestringPath to texture.
atlas_tilestringThe shortname defined in the terrain_textures.json.
atlas_indexintegerThe index of the texture array inside the definition of that shortname.
atlas_tile_variantintegerThe variant of the block's texture array inside the shortname's block variation.
ticks_per_frameintegerHow fast frames should be changed. 20 ticks = 1 second.
framesarray or integerList with frame index to use on each frame, or the total number of frames to be repeated one after another.
replicateintegerSets the size of pixels. Default: 1.
blend_framesbooleanDefines should frames transition be smooth or not. Default: true.

atlas_index

A component where you'll define the block texture index to animate.

RP/textures/terrain_texture.json#texture_dataCopy
json
"dirt": {
  "textures": [
    "textures/blocks/dirt",
    "textures/blocks/coarse_dirt" // Imagine that this is the path you want to animate
  ]
}
1
2
3
4
5
6

Since path 2 has an animated texture, therefore you'll put "atlas_index": 1 on the Dirt block's flipbook texture.

atlas_tile_variant

A component where you'll define the block variant (which is registered to the variations array) to animate.

RP/textures/terrain_texture.json#texture_dataCopy
json
"dirt": {
  "textures": [
    {
      "variations": [
        { "path": "textures/blocks/dirt_va" }, // Imagine that this is the block variation you want to animate
        { "path": "textures/blocks/dirt0" },
        { "path": "textures/blocks/dirt1" }
      ]
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11

Now let's say we wanted path 1 to be animated, now what you'll do here is to put "atlas_tile_variant": 1 on the Dirt block's flipbook texture.

replicate

Changes size of the peace of used texture. Can only take values that are multiples of two. If frame has smaller amount of pixels, extends them.

replicate valuewhat it does
< 0Breaks animation
0Breaks animation & texture
2Renders 1 / 4 pixels of frame
xRenders 1 / x2 pixels of frame

Result

Now you can modify vanilla flipbook textures or create your own ones!

Contributors

MedicalJewel105