tutorial:blockstate
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:blockstate [2019/08/28 21:53] – add new section header for JSON stuff b0undarybreaker | tutorial:blockstate [2019/08/29 07:47] – [Adding models for your blockstates] JavaScript formatting, add file names jamieswhiteshirt | ||
---|---|---|---|
Line 67: | Line 67: | ||
==== Adding models for your blockstates ==== | ==== Adding models for your blockstates ==== | ||
- | You can also make the texture and model of your block change based on the state. This is done through a JSON file called a Blockstate JSON. All blocks need a blockstate JSON, whether they have multiple states or not, but the contents of the JSON can be as simple or complex as you like. Let's say you register an instance of '' | + | You can also make the texture and model of your block change based on the state. This is done through a JSON file called a Blockstate JSON. All blocks need a blockstate JSON, whether they have multiple states or not, but the contents of the JSON can be as simple or complex as you like. If you want to change |
- | <code json> | + | Let's say you register an instance of '' |
+ | |||
+ | < | ||
{ | { | ||
" | " | ||
Line 86: | Line 88: | ||
If you //do// want to have different models for each blockstate, you'd want to add multiple variants. For the same '' | If you //do// want to have different models for each blockstate, you'd want to add multiple variants. For the same '' | ||
- | <code json> | + | < |
{ | { | ||
" | " | ||
Line 95: | Line 97: | ||
</ | </ | ||
- | In this JSON, there are two variants, one for each possibility of the '' | + | In this JSON, there are two variants, one for each possibility of the '' |
+ | |||
+ | Variants are based on possible permutations of the properties added to your block. A property can be totally ignored in the blockstate JSON if you want, like in the first blockstate JSON where we ignored the '' | ||
This is only a simple introduction to blockstate JSONs. All of the tricks you can do with blockstate and model JSONs are documented on the [[https:// | This is only a simple introduction to blockstate JSONs. All of the tricks you can do with blockstate and model JSONs are documented on the [[https:// | ||
==== A note about performance ==== | ==== A note about performance ==== | ||
Every possible state of a block is registered at the start of the game. This means that if you have 14 boolean properties, the block has 2^14 = 16384 different states and 2^14 states are registered. For this reason blocks should not contain too many blockstate properties. Rather, blockstates should be mostly reserved for visuals, and [[tutorial: | Every possible state of a block is registered at the start of the game. This means that if you have 14 boolean properties, the block has 2^14 = 16384 different states and 2^14 states are registered. For this reason blocks should not contain too many blockstate properties. Rather, blockstates should be mostly reserved for visuals, and [[tutorial: |
tutorial/blockstate.txt · Last modified: 2023/11/18 08:13 by solidblock