A custom block, like an item, lives in two packs. The behavior pack says how it behaves. The resource pack holds its textures, sound and name.
The files
RP/
blocks.json
textures/
terrain_texture.json
blocks/
ruby_block.png
texts/
en_US.langStep 1: the texture
Save a 16x16 PNG in RP/textures/blocks/. Then give it a short name in terrain_texture.json:
{
"resource_pack_name": "My Ruby Add-on",
"texture_name": "atlas.terrain",
"padding": 8,
"num_mip_levels": 4,
"texture_data": {
"ruby_block": {
"textures": "textures/blocks/ruby_block"
}
}
}Step 2: put it on the block
The behavior pack block picks textures with minecraft:material_instances. * means every face.
"minecraft:material_instances": {
"*": {
"texture": "ruby_block",
"render_method": "opaque"
}
}For different faces, name them. Faces you leave out use *:
"minecraft:material_instances": {
"*": { "texture": "ruby_block_side" },
"up": { "texture": "ruby_block_top" },
"down": { "texture": "ruby_block_bottom" }
}| render_method | Use it for |
|---|---|
opaque | Solid blocks. The default. |
alpha_test | Cut-out pixels, like leaves or glass panes. Both sides drawn. |
alpha_test_single_sided | Cut-out pixels, front side only. |
blend | See-through colour, like stained glass. |
double_sided | Solid, but drawn from both sides. |
Step 3: the sound
blocks.json sits in the root of the resource pack. It sets the sound for breaking, placing and walking:
{
"format_version": "1.21.40",
"wiki:ruby_block": {
"sound": "stone"
}
}Common sounds: stone, wood, gravel, grass, glass, metal, sand, cloth, amethyst_block.
Step 4: the name
tile.wiki:ruby_block.name=Ruby BlockBlocks use tile. and end with .name. You can also set minecraft:display_name in the block file.
Custom shapes
For a shape that is not a full cube, make a model, save it as RP/models/blocks/<name>.geo.json and point minecraft:geometry at its geometry.<name>. The face names in material_instances then match the bone face names of your model.
Purple and black checkerboard
The texture's short name is not in terrain_texture.json, or its path is wrong. Leave .png out of the path, and remember the file is cached: restart the world after changing it.