Flipbook Textures

intermediate

What this page covers

From this page you will learn:

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

Beginning

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.17.20",
	"minecraft:block": {
		"description": {
			"identifier": "wiki:flipbook_block"
		},
		"components": {
			"minecraft:destroy_time": 7,
			"minecraft:unit_cube": {},
			"minecraft:block_light_absorption": 15,
			"minecraft:block_light_emission": 0,
			"minecraft:creative_category": {
				"category": "construction",
				"group": "itemGroup.name.construction"
			},
			"minecraft:material_instances": {
				"*": {
					"texture": "magma", // Add it here.
					"render_method": "opaque"
				}
			}
		}
	}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

Now it has animated texture!

How it works

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
{
    "num_mip_levels" : 4,
    "padding" : 8,
    "resource_pack_name" : "vanilla",
    "texture_data" : {
        "magma": {
            "textures": "textures/blocks/magma"
        }
    }
}
1
2
3
4
5
6
7
8
9
10
  1. Minecraft searches looks into flipbook_textures.json aiming to find animation parameters for this name (magma)
RP/textures/flipbook_textures.jsonCopy
json
[
    {
        "flipbook_texture": "textures/blocks/magma",
        "atlas_tile": "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.

This is the way how it works.

What are the components?

While looking up for something in vanilla flipbook texture file, you can notice some components.

Here is explanation for them:

ComponentValueMeaning
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.
frameslistList with numbers of frames which defines their order.
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 value of the block index to animate.

Example:

RP/textures/terrain_texture.json#texture_dataCopy
json
"dirt" : {
    "textures" : [
        "textures/blocks/dirt",
        "textures/blocks/coarse_dirt" //imagine if this is the path you wanted 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 value of the block variant (which is registered to the Variations array) to animate.

Example:

RP/textures/terrain_texture.json#texture_dataCopy
json
"dirt" : {
    "textures" : [
           {
       "variations": [
           { "path": "textures/blocks/dirt_va" }, //imagine if this is the block variation you wanted 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/(x**2) pixels of frame

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

Contributors

SmokeyStackMedicalJewel105SquisSloim