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

Hey, I'm almost done updating to 1.8 (11.14.0.1239) but one of the last things is ore generation and I'm having trouble with the new BlockPos system, any help with this would be much appreciated.

  • Author

What is your problem? BlockPos is just a wrapper class that wraps x, y and z in one Object.

 

I'm having trouble with updating my generateSurface method, here's the code: private void generateSurface(World world, Random random, int blockX, int blockZ) {

for(int i = 0; i < 10; i++){

int Xcoord = blockX + random.nextInt(16);

int Ycoord = random.nextInt(28);

int Zcoord = blockZ + random.nextInt(16);

 

new WorldGenMinable(DanArmourMain.invisore, 4).generate(world, random, Xcoord, Ycoord, Zcoord);

}

 

}

 

hope this helps

  • Author

generate

now takes a BlockPos argument instead of 3 ints.

 

Sorry, I have lots of errors with this, I have no idea what's changed or what to change, here is my full class:

 

public class InvisOreWorldGeneration implements IWorldGenerator{

 

@Override

public void generate(Random random, int chunkX, int chunkZ, World world,

IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {

switch(world.provider.getDimensionId()){

case -1 : generateNether(world, random, chunkX * 16, chunkZ * 16);

case 0 : generateSurface(world, random, chunkX * 16, chunkZ * 16);

}

 

}

 

private void generateSurface(World world, Random random, int blockX, int blockZ) {

for(int i = 0; i < 10; i++){

int Xcoord = blockX + random.nextInt(16);

int Ycoord = random.nextInt(28);

int Zcoord = blockZ + random.nextInt(16);

 

new WorldGenMinable(DanArmourMain.invisore, 4).generate(world, random, pos);

}

 

}

 

private void generateNether(World world, Random random, int i, int j) {

}

}

 

I've got an error on new WroldGenMineable because it needs invisore (my block) to be a block state. Also, inserting a BlockPos into the generate method means I have to put it into the generateSurface parameters, which in turn needs one in main generate method, which then causes an error with the @Override meaning that it no longer implements the needed method for IWorldGenerator.

  • Author

To get the default block state (IBlockState) for your Block use the

getDefaultState

method.

For your BlockPos: all you need to do is wrap the 3 variables (Xcoord, Ycoord, Zcoord) into a BlockPos. Seriously.

 

Sorry, first time updating w/o tutorials but I've got it now, thanks a bunch

  • 1 month later...

Could you please put the corrected code?  I'm still having troubles with it.  Thanks a whole lot:D

  • 3 weeks later...

To get the default block state (IBlockState) for your Block use the

getDefaultState

method.

For your BlockPos: all you need to do is wrap the 3 variables (Xcoord, Ycoord, Zcoord) into a BlockPos. Seriously.

 

Wow...such a simple change, an annoying one, but simple once it's been explained. Thank You. 8)

a.k.a. Sirius

width=400 height=82http://i.imgur.com/QRtYi6e.png[/img]

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.