Posted April 5, 201510 yr As stated in the title the world.setBlockState() does not work for me with my custom Block. Here is a code extract: IBlockState crafting_table_state = Blocks.crafting_table.getDefaultState(); MyCustomBlock c = new MyCustomBlock(); IBlockState my_custom_block_state = c.getDefaultState(); world.setBlockState(new BlockPos(1, 128, 1), my_custom_block_state); world.setBlockState(new BlockPos(2, 128, 1), crafting_table_state); When I look at the Point (1, 128, 1), I can see the Crafting Table, but not my Custom Block. I have already checked, that the IBlockState.getBlock() returns a MyCustomBlock. When I place my Block from my Inventory it Renders normal. Has somebody an idea how I could find the error?
April 5, 201510 yr Hi MyCustomBlock c = new MyCustomBlock(); That's not how Blocks are used - you don't create a new instance of your block every time you place it. Instead, you create an instance once, during preInit(), and register it with Forge. It's probably worth reading a few of the introductory tutorials on modding. This is one, there are lots of others. Wuppy29 has some good ones. http://greyminecraftcoder.blogspot.com.au/2013/10/the-most-important-minecraft-classes_9.html and http://greyminecraftcoder.blogspot.co.at/2014/12/blocks-18.html -TGG
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.