Posted September 7, 201312 yr The Structure Itself: http://pastie.org/8306221 The Generation Class: http://pastie.org/8306224 Yes, the generator is registered. The blocks generate and all, my problem here is with the Y value. I have been testing generation in a super flat world (as it is pure grass / dirt) and find that the blocks are generating anywhere between levels 1-4, whereas I would like them to be above ground at all times. How do I get this to happen? I assume some changes need to be done with the Y value, I've tinkered with it here and there, and am still not getting the product I'd like. Thanks in advance.
September 7, 201312 yr world.getTopSolidOrLiquidBlock(x pos, z pos); Gives you the height (y value) of the top block at the x/z position. If you guys dont get it.. then well ya.. try harder...
September 7, 201312 yr Author world.getTopSolidOrLiquidBlock(x pos, z pos); Gives you the height (y value) of the top block at the x/z position. That works, but now they are spawning a little too often for my taste ( every few blocks or so). How could I limit the amount per chunk? Code now looks like: private void generateSurface(World world, Random random, int i, int j) { int firstBlockXCoord = i + random.nextInt(16); // int firstBlockYCoord = random.nextInt(256); int firstBlockZCoord = j + random.nextInt(16); new AirTempleStructure().generate(world, random, firstBlockXCoord, world.getTopSolidOrLiquidBlock(firstBlockXCoord, firstBlockZCoord) - 1, firstBlockZCoord); }
September 8, 201312 yr private void generateSurface(World world, Random random, int i, int j) { if(random.nextInt(4) == 0){ int firstBlockXCoord = i + random.nextInt(16); // int firstBlockYCoord = random.nextInt(256); int firstBlockZCoord = j + random.nextInt(16); new AirTempleStructure().generate(world, random, firstBlockXCoord, world.getTopSolidOrLiquidBlock(firstBlockXCoord, firstBlockZCoord) - 1, firstBlockZCoord); } } In this case this means that every chunk has a 1/4 chance to spawn your structure. This ratio easily can be changed to your taste of course. Author of PneumaticCraft, MineChess, Minesweeper Mod and Sokoban Mod. Visit www.minemaarten.com to take a look at them.
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.