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 block 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:

"magma": {
    "textures": "textures/blocks/magma"
}
1
2
3
BP/blocks/flipbook_block.jsonCopy
{
	"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
{
    "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
[
    {
        "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_variantintegerSeems to do same as atlas_index
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 and atlas_tile_variant

These components are for defining texture variant (if you have it).

Example:

RP/textures/terrain_texture.json#texture_dataCopy
"dirt" : {
    "textures" : [ 
        "textures/blocks/dirt", 
        "textures/blocks/coarse_dirt"
    ]
}
1
2
3
4
5
6

Then you need can add "atlas_index": 1 or "atlas_tile_variant": 1 to have animated texture for the second path.

** 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

MedicalJewel105