perromercenary00 Posted April 14, 2015 Posted April 14, 2015 good nigths im a little newby whit terrain generators and im using the guide from http://www.orangetutorial.com/world-generation/ well i alredy has done this code and im generating a block underground using WorldGenMinable minable = new WorldGenMinable(MercenaryModBlocks.girable.getDefaultState() , (minVeinSize + random.nextInt(maxVeinSize - minVeinSize)) ); actualy a i wanna spwn a block on the surface to spawn and structure from this block what object of WorldGen i must use to spawn a block on the surface ?? Quote
Brickfix Posted April 14, 2015 Posted April 14, 2015 Hi, this is fairly simple. first of all, you can use this to get the position right on the surface BlockPos pos = new BlockPos(chunkX*16, 0, chunkZ*16); pos = world.getHorizon(pos); Now lets say, you want to have little pillar out of cobblestone, lets create a small class: public class CobblePillar extends WorldGenerator { @Override public boolean generate(World world, Random random, BlockPos pos) { for (int i=0; i<=5; i++) { world.setBlockState(pos.add(0, i, 0), Blocks.cobblestone.getDefaultState(), 2); } return true; } } Now, lets call the code in your generator class: CobblePillar pillar = new CobblePillar(); pillar.generate(world, random, pos); This would be it, have fun Quote
perromercenary00 Posted April 15, 2015 Author Posted April 15, 2015 hay i solved it on other way BlockPos posM = world.getTopSolidOrLiquidBlock(pos); world.setBlockState(posM, MercenaryModBlocks.hierbaVerde.getDefaultState() ); minable.generate(world, random, posM ); the trou ble is that im using minable WorldGenMinable and its spawn to many in the surface the others dont semm to fit how im triying to do i think i have to spend mi time doing mi own WorldGenMercenary or something like Quote
HappyKiller1O1 Posted April 15, 2015 Posted April 15, 2015 Those sentences though. Quote I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.
Recommended Posts
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.