If you wish to change what <code><nowiki>BlockState</nowiki></code> is used when placing your block, you can overwrite <code><nowiki>Block#getStateForPlacement(BlockItemUseContext)</nowiki></code>. This can be used to, for example, set the direction of your block depending on where the player is standing when they place it.
If you wish to change what <code><nowiki>BlockState</nowiki></code> is used when placing your block, you can overwrite <code><nowiki>Block#getStateForPlacement(BlockItemUseContext)</nowiki></code>. This can be used to, for example, set the direction of your block depending on where the player is standing when they place it.
−
Because <code><nowiki>BlockState</nowiki></code>'s are immutable, and all combinations of their properties are generated on startup of the game, calling <code><nowiki>BlockState#with(IProperty<T>, T)</nowiki></code> will simply go to the <code><nowiki>Block</nowiki></code>'s <code><nowiki>StateContainer</nowiki></code> and request the <code><nowiki>BlockState</nowiki></code> with the set of values you want.
+
Because <code><nowiki>BlockState</nowiki></code>s are immutable, and all combinations of their properties are generated on startup of the game, calling <code><nowiki>BlockState#with(IProperty<T>, T)</nowiki></code> will simply go to the <code><nowiki>Block</nowiki></code>'s <code><nowiki>StateContainer</nowiki></code> and request the <code><nowiki>BlockState</nowiki></code> with the set of values you want.
−
Because all possible <code><nowiki>BlockState</nowiki></code>'s are generated at startup, you are free and encouraged to use the reference equality operator (<code><nowiki>==</nowiki></code>) to check if two <code><nowiki>BlockState</nowiki></code>'s are equal.
+
Because all possible <code><nowiki>BlockState</nowiki></code>s are generated at startup, you are free and encouraged to use the reference equality operator (<code><nowiki>==</nowiki></code>) to check if two <code><nowiki>BlockState</nowiki></code>s are equal.