Jump to content

Recommended Posts

Posted

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?

Posted

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).

Posted

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?

Posted

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());

                        }

                    }

                }

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.