I am not familiar with 1.12 code, by in 1.8.8 I use Block#getStateFromMeta(), I guess that in 1.12 it could be same or similiar.
As far as I know, block states haven't changed and that will still work fine. You can also use IBlockState#withProperty to set the block state with the colour you want.
Avoid metadata values where possible. As Bright_Spark said, the correct way to do this is by calling IBlockState#withProperty to get an IBlockState with each property set to the specified value.
Forge's documentation has an introduction to block states here.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Hello everyone.
I'm trying to figure out how to place red wool from my mod. Normally, to place a block I do:
But I can't change the color of the wool.
I know that the data value of red wool is 14, but I don't know how to get a BlockState from this number.
Thank you for your help.
As far as I know, block states haven't changed and that will still work fine. You can also use IBlockState#withProperty to set the block state with the colour you want.
OK, Nuparu00's answer worked, but it's deprecated
Avoid metadata values where possible. As Bright_Spark said, the correct way to do this is by calling IBlockState#withProperty to get an IBlockState with each property set to the specified value.
Forge's documentation has an introduction to block states here.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.