Blockstates - LenaTevar/HomeoCraft GitHub Wiki

Explain me Blockstates as I was 5

Blockstate: Extra information about the block

Model Block: Mesh and link to the texture. Front-end shit aka. Erik'stuff.

Model Item: Texture for the block in the player's hand. More Erik's.

Blockstate

Different variables that a block can handle, an extra of information. Ex: Doors can be open or closed, redstone changes depending on if there is more redstone in one side.

Example Torch (Blockstate)

{  "variants": {     "facing=up": { "model": "normal_torch" },     "facing=east": { "model": "normal_torch_wall" },     "facing=south": { "model": "normal_torch_wall", "y": 90 },     "facing=west": { "model": "normal_torch_wall", "y": 180 },     "facing=north": { "model": "normal_torch_wall", "y": 270 }   } }

"variants": {"facing=up": ... -> Blocks with just one variants uses "normal" as a name for its variant. Relevant blockstates separated by commas.

{"model": ... -> Specifies the path to the model file of the block, starting in assets/mod/models/block

"x" or "y": int -> Rotation of the model on the x or y axis in increments of 90 degrees.

"uvlock": true/false -> Locks the rotation of the texture of a block.

"weight": -> Sets the probability of the model for being used in the game if more of 1 model is used.

Grass.json (Blockstate)

{   "variants": {     "snowy=false": [     { "model": "grass_normal" },     { "model": "grass_normal", "y": 90 },     { "model": "grass_normal", "y": 180 },     { "model": "grass_normal", "y": 270 }    ],    "snowy=true": { "model": "grass_snowed" }  } }

"variant": { "condition" -> A list of cases that have to be met for the model to be applied. If unset, the model always applies.
Ex "apply": model "when": north=true.