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.

[1.8][Almost Solved]Get block-set block methods/ IWorldGenerator with structures

Featured Replies

Posted

What are the getting and setting block methods for 1.8?

If there are none (which I highly doubt) how can I make my structure generate in-world (I already have the IWorldGenerator set up).

The proud(ish) developer of Ancients

  • Author

So far I have found a set block method but no get block method. I need the get block method for detecting what the top block's y coord is at the specified x/z coordinates. I need the y-coord so that my structure doesn't spawn in the ground, or in the air.

The proud(ish) developer of Ancients

  • Author

Yes, thanks. Also how do I use IBlockState to set a block? It's an interface so I can't instantiate it. Is there a method somewhere kind of like getAxisAlignedBB that returns it?

The proud(ish) developer of Ancients

  • Author

I'm not sure this is how IBlockState is supposed to work but I'm using this code to spawn my block (x/z are random coords from IWorldGenerator):

BlockPos block = new BlockPos(x,0,z);

block = world.getTopSolidOrLiquidBlock(block);

System.out.println("Top Block is:"+block.getY());

IBlockState state = Ancients.invincible.getDefaultState();

world.setBlockState(block, state);

The proud(ish) developer of Ancients

  • Author

It gets the proper block, but it doesn't set the block to my 'invincible' block. Did I miss a method that I need to use?

The proud(ish) developer of Ancients

Guest
This topic is now closed to further replies.

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.