Posted July 29, 201510 yr So in my dimension, I have been coding a structure, just a simple little house with a stair-peak roof. Unfortuantely, when I add the stairs, they all face the same direction. I know this has to do with blockstates but I have no idea how to use those in 1.8. Any help? -Corey P.S. also I'd like to make my own custom stairs but have no idea how to do the blockstates or whatever. would extends some staircase class do it?
July 29, 201510 yr When you set the block state, you need to also set the FACING property: IBlockState state = Blocks.oak_stairs.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH); It's up to you, of course, to figure out which facing each block will need. You can also set the HALF (top or bottom) and SHAPE (e.g. straight or one of the corners). http://i.imgur.com/NdrFdld.png[/img]
July 29, 201510 yr Author Thanks, I just had to modify it to this: world.setBlockState(pos, Blocks.nether_brick_stairs.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.SOUTH)); and my structure now generates a staircase roof. However, the x == 0 side isn't generating? any ideas?
July 30, 201510 yr However, the x == 0 side isn't generating? any ideas? Not without seeing some code, no. http://i.imgur.com/NdrFdld.png[/img]
July 30, 201510 yr Author Sorry, My bad: for(y = 7; y< 8; y++){ for(int x = 0; x<7; x++){ // BlockPos corner = pos; for(int z=0; z<8; z++){ pos = new BlockPos(startX + x, startY + y, startZ + z); if(x == 0){ // Set edge blocks to brick world.setBlockState(pos, Blocks.nether_brick_stairs.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.EAST)); } else if(z == 0){ // Set edge blocks to brick world.setBlockState(pos, Blocks.nether_brick_stairs.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.SOUTH)); } else if(z == 7){ // Set edge blocks to brick world.setBlockState(pos, Blocks.nether_brick_stairs.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH)); } else if(x == 7){ // Set edge blocks to brick world.setBlockState(pos, Blocks.nether_brick_stairs.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.WEST)); } else{ // Leave other blocks as air world.setBlockState(pos, Blocks.air.getDefaultState()); } } }
July 30, 201510 yr That looks like it should work, although the for loop for the 'y' axis is superfluous as it only iterates once. Do you have any calls to setBlockState after your for loops finish that could be overriding the x == 0 position with a different block, e.g. air? http://i.imgur.com/NdrFdld.png[/img]
July 30, 201510 yr Author I checked, and while I found some duplicate code for the stairs, deleting it didn't change anything.
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.