Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (โ‹ฎ) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

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?

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

  • 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?

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

ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  }

ย  ย  ย  ย  ย  ย  ย  ย  ย  ย  }

ย  ย  ย  ย  ย  ย  ย  ย  }

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?

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

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions โ†’ Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.