Posted November 27, 201410 yr 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.
November 27, 201410 yr 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
November 27, 201410 yr 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.
November 27, 201410 yr 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
January 26, 201510 yr Could you please put the corrected code? I'm still having troubles with it. Thanks a whole lot:D
February 11, 201510 yr 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. a.k.a. Sirius http://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.