Posted March 17, 20196 yr Simple question, how do you create a blockstate based on a registry name. What I essentially want to do is to be able to pass regName as a parameter, and have said block be created above the current block. BlockPos pos = getPos(); String regName = "minecraft:stone"; world.setBlockState(new BlockPos(pos.getX(), (pos.getY() + 1), pos.getZ()), regName); However, I understand that the second parameter is an instance of IBlockState, but I'm a little lost as to how I can create this using the registry name of a block, which I can then pass in as the variable. Thanks, Jordan Why bother?
March 17, 20196 yr To get blockstate use Block#getDefaultState() Block is the block you want to place, you can get it from block list like Blocks class To get block by registry name, try going through ForgeRegistry Edited March 17, 20196 yr by Toma™
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.