Next we need to tell Minecraft what we want our block to look like.
{
"parent": "block/cube_all",
"textures": {
"all": "example:blocks/decorative"
}
}
That's pretty much all that's needed for it to work once the block is registered. The only important thing is that the filename match the registry name used to register the block and should be in all lowercase (1.11+ file names are required to be lowercase, prior to that it is just case sensitive).
Name the model JSON file my_block.json
(matching the registry name we're going to give it later) and save it at src\main\resources\assets\example\models\block\
(where example
is the mod ID specified in the @Mod annotation of your main mod class).
The block model here uses a parent of block/cube_all, which means that the single supplied texture will be used on all faces. There are other default models as well, such as:
Do note that each model specifies the textures it uses by a name ID (e.g. "all"
or "top"
). Look at the parent model to determine what those names are if you are uncertain. Incorrectly specified textures may lead to non-error-reporting missing texture issues.
It is also possible to create a wholly custom model or to create a custom parent model. But for now, this will be enough.
Don't forget to create a texture, name it decorative.png
(as that's what the JSON file specified) and save it to src\main\resources\assets\example\textures\blocks\