Blockstates

Blockstates file are json files which specify which model to use when a block has a specific state and can apply alternative models for blocks.

Certain blocks will use a multipart blockstate file which you can read about here.

There is a lot of blocks which have a specific list of states, too long to list but you can see all special state names and values on the minecraft wiki block states page.
Note: Not every state can be changed when specified within the blockstate file – there is a current workaround for this, which is to specify the blockstate within a multipart array.

When writing a blockstate file you must specify states within “variants”: { states }

{
“variants”: {
state“: { “model”: “my_model” }
}}

Special states must be specified with the “name” and the “value” together within a string separated by “=”.
You can specify two or more states to be met at the same time by separating name-value pairs with a comma.

{
“variants”: {
name=value“: { “model”: “my_model” }
name=value,name2=value2“: { “model”: “my_model2” }
}}

If a block has no special states instead of a name and value you just use “normal”.

{
“variants”: {
“normal”: { “model”: “my_model” }
}}

Alternative models can be applied within the blockstate files by setting several models within an array (made with square brackets with values separated by commas – [value1, value2, value3]) per state.

{
“variants”: {
name=value“: [
{ “model”: “my_model” },
{ “model”: “alt_model” }
]
}}

When you specify a model there is a small number of other parameters that can be applied to these. These must be separated by commas.

A common one used will be weight. This is a number which is used when multiple models are specified for  a single state and determines which models appear more than other models. The weight of a model will default to 1.
The percentage of how often a model will appear opposed to the other models is calculated by adding up the weights of the models then dividing the weight of a model to this total.

{
“variants”: {
“normal”: [
{ “model”: “my_model“, “weight”: 2 },
{ “model”: “alt_model“, “weight”: 3 }
]
}}

2 / 5 = 0.4 | my_model will have a 0.4 chance of being displayed when this block is placed.

Another 2 parameters which tie into each other are just “x” and “y” these specify the rotation of an element along the x or y axes respectively. The rotation must be a multiple of 90.

{
“variants”: {
“normal”: { “model”: “my_model“, “x”: 180 }
}}

The final parameter is “uvlock” this will only affect the model when used in conjunction with “x” or “y” and can be either “true” or “false”. Uvlock stops the textures applied to a model being rotated along with the model and will face the same direction even when the model is rotated.

{
“variants”: {
“normal”: { “model”: “my_model“, “x”: 180, “uvlock”: true }
}}