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:54] – [Adding models for your blockstates] b0undarybreaker | tutorial:blockstate [2021/05/24 19:18] – [Adding models for your blockstates] Fix typo technici4n | ||
---|---|---|---|
Line 8: | Line 8: | ||
it would become harder and gain a hardness of '' | it would become harder and gain a hardness of '' | ||
| | ||
- | First we define the boolean property of the block - whether or not it is hard: | + | First we define the boolean property of the block - whether or not it is hard (careful not to import the wrong BooleanProperty!): |
<code java> | <code java> | ||
public class MyBlock extends Block { | public class MyBlock extends Block { | ||
Line 19: | Line 19: | ||
[...] | [...] | ||
@Override | @Override | ||
- | protected void appendProperties(StateFactory.Builder< | + | protected void appendProperties(StateManager.Builder< |
- | | + | |
} | } | ||
| | ||
Line 31: | Line 31: | ||
public MyBlock(Settings settings) { | public MyBlock(Settings settings) { | ||
super(settings); | super(settings); | ||
- | setDefaultState(getStateFactory().getDefaultState().with(HARDENED, | + | setDefaultState(getStateManager().getDefaultState().with(HARDENED, |
} | } | ||
| | ||
} | } | ||
</ | </ | ||
+ | (To set multiple properties, chain '' | ||
- | Now, to set the property we need to call | + | Now, to set the property we need to call '' |
- | + | ||
- | '' | + | |
(Replace '' | (Replace '' | ||
Line 46: | Line 45: | ||
[...] | [...] | ||
@Override | @Override | ||
- | public | + | public |
- | world.setBlockState(pos, | + | world.setBlockState(pos, |
- | return | + | return |
} | } | ||
} | } | ||
Line 71: | Line 70: | ||
Let's say you register an instance of '' | Let's say you register an instance of '' | ||
- | <code json> | + | < |
{ | { | ||
" | " | ||
Line 86: | Line 85: | ||
- The ''" | - The ''" | ||
- | If you // | + | If you want to have different models for each blockstate, you should |
- | <code json> | + | < |
{ | { | ||
" | " |
tutorial/blockstate.txt · Last modified: 2023/11/18 08:13 by solidblock