Topic category: Help with Minecraft modding (Java Edition)
I am starting to get confused how I properly use these Blockstates.
The easiest would be the lantern. I have one standing and one hanging. I am trying to give it directional properties, but it just does not work as intended.
First it mainly had no rotation. Then I gave it a up/down property with their true/false statement. Either of them seem not to work, because it stays the same standing blockstate instead if the hanging variant. Later I gave it the N/S/W/E/D/U rotation and it also does not change to the hanging variant, instead the block rotates himself.
Same applies to my custom torch but it's worse or more complicated.
What do I do wrong? What property do they use???
I even checked some sources around the internet.
Only saw an old video of Northwest from MCreator 2020.2 or something, I am not sure, but I do not want to implement it like that unless there is no way.
So, I recently tested my lantern again. It seems to need the HANGING property, but for some reason, when it's not hanging, the lantern itself rotates 90 degrees
Solved the block rotation issue, but the hanging true or false stays
You need to change the blockstate with procedures.
To use your lantern as an example, make a custom logic property called "hanging" (which you have already done) and add different textures/models for whether hanging is true/false.
Now, add a procedure that triggers on
when block is added/placedoron block tick.In this procedure, you can check for the blocks orientation, and set the "hanging" property to true or false based on that.
Doing it based off of orientation is smart, but if you would not like to have orientation in your block, just have the procedure check if the block above is solid.
Do you have an example so I could use it as an orientation?
Nevermind, found the solution without the blockstate thing for the lantern
I ignored the blockstate and just checked, if under the lantern is "air".