Block files generation#
This page describes in detail how the BP/blocks/*.block.json files are generated and how their contents can be controlled by overriding with data defined in certain files defined in the filter configuration.
Main components of the file#
The main structure of the block file is based on two sources:
template file - the file defined in the
block_templateproperty of the block definition.the content of the
block_template_overrideproperty.
First, the template file is evaluated using the data from the scope.json file and than the content of the block_template_override is placed on top of the the template file using the json overriding. The process of the evaluation uses the regolith-json-template Python module.
You can learn more about using the module on the json_template regolith filter Github page. In short, the module allows you to use variables in the JSON file by replacing them with values defined in the scope.json file. The variables are defined as strings that start and end with backticks “`”.
Variants#
The filter allows you to define block variants which in the output are defined using custom properties and permutations. You can read more about properties and permutations in the official Minecraft Bedrock Creator documentation
In the _blocks_data.json file in the block definition, the variants are defined in the variants property. The variants property is an object where the keys are the names of the groups of variants and the values are lists of the variants in every group. Inside every variant, there is a components property which is directly copied into the block file as a content of the permutation. The molang query for the condition property in the generated block is created automatically.
The filter creates custom entities whose spawn eggs can be used in order to spawn every possible combination of variants using a product of the variants in every variant group.