Block model change if block on top #1924
-
Hello there. I want to create something but I'm not sure how to do it. Can someone help me please? I want to create block that change it's model and outline shape when you place another (any) block on top of it and change back to default model when you destroy block on top. I have prepared everything but I'm not sure how to setup the class for this block, more specifically I don't know how to make it change... I'm kinda new and I'm learning by reading MC code. I found something similar in WallBlock (WallPost) but I'm kinda confused from it. And anything else like Farmland or DirtPath is done by replacing block... |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
That is the usual way it is done. The basic block models use the block id or block states to select which one to use. So you listen to neighbouring block updates and either
The other more complicated way is to use a block entity which can have any NBT values. |
Beta Was this translation helpful? Give feedback.
-
This is using the built in infrastructure with some extra stuff on top to handle calculating where it is connected to other blocks. The logic starts at If you look at say
|
Beta Was this translation helpful? Give feedback.
-
You shouldn't be setting the block state directly. You return it to the caller. The caller will:
If you want a simple example, look at how the repeater block sets its (un)locked state. |
Beta Was this translation helpful? Give feedback.
You shouldn't be setting the block state directly. You return it to the caller.
The caller will:
If you want a simple example, look at how the repeater block sets its (un)locked state.