Started by
THE LIMINAL
on
Topic category: Help with Minecraft modding (Java Edition)
Hello! I've just created a custom model on blockbench. I want it to behave like a wall, but I don't know how to create blockstates for it. Any assistance / guidance / tutorials would be welcome!
Also, does anyone know if there are plans to add this feature to mcreator?
As far as I know there are no current plans to implement blockstates but that could change in the future. It is rather simple to do blockstates actually by editing the json file to set the block variants. The following contains a tutorial on how to create custom block property's to use in blockstate json files. It is actually not too difficult. It is not necessary to add a block property to do block variants, but it is the better way to do it.
In this example, I will recreate a "level" feature of a cauldron.
Step 1: Create your block. I recommend creating one with block directions to make it easier to find and edit block property's.
Step 2: Open the BlockNameBlock.Java file
Step 3: Find this this line:
Then Declare the following just under it:
Step 4: Find the class "public BlockNameBlock "
It should look similar to this:
Step 5: Add your new block property to the line containing "this.registerDefaultState":
Step 6: Find the class "public BlockState getStateForPlacement(BlockPlaceContext context)":
Step 7: Change the return value to include your new block property:
Your Block should now have a functioning new block property! You can set this new block property using procedures, and then set block variants in your BlockNameBlockstates.json file. This is an example of mine below following this tutorial. The block property level is determined by right clicking with water bucket/bucket 3 levels or a water bottle/bottle for 1 level.
The last part is the json blockstate file for the block. It can be used without all the custom code for the new blockstate property and use something else instead, but it best to use blockstate properties.
Is it possible to take minecraft's json files from its blockstate folder, paste them into my workspace's assets > [my-mod's-name-here] > blockstate folder, and edit as needed?
Absolutely, that is probably the best way as well!
There are also online tools like this blockstate generator to help you with those kind of things: https://misode.github.io/assets/blockstate/
Although that blockstate generator only handles the basics really.
If it's not too much to ask, could you instruct me on how to use the blockstate generator?
I've honestly never used it so no I write mine by hand, I use that same kind of generator for other kidn of json files though, to help me get the notation of stuff correct usually. I know someone made a wall tutorial on making fences a while back. But I suggest looking at any of the fence json files.
Fences use different boolean blockstates for each direction to determine whether there is a block next to it that it should connect to.
When I'm using the blockstate generator, should I set it to 'variants' or 'multipart'?
Never mind. Pointless question. The json file literally already says it. Sorry.