Advertisement
Guest User

Untitled

a guest
Sep 18th, 2013
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. package terramagna.worldgen;
  2.  
  3. import java.util.Random;
  4.  
  5. import terramagna.helper.BlockHelper;
  6.  
  7. import net.minecraft.block.Block;
  8. import net.minecraft.world.World;
  9. import net.minecraft.world.chunk.IChunkProvider;
  10. import cpw.mods.fml.common.IWorldGenerator;
  11.  
  12. public class WorldGenEverything implements IWorldGenerator
  13. {
  14.  
  15. @Override
  16. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
  17. {
  18.  
  19. int x = chunkX;
  20. int y = 128;
  21. int z = chunkZ;
  22.  
  23. while(!world.doesBlockHaveSolidTopSurface(x, y, z) && y > 62)
  24. {
  25.  
  26. --y;
  27.  
  28. }
  29.  
  30. if(!world.doesBlockHaveSolidTopSurface(x, y, z))
  31. {
  32.  
  33. return;
  34.  
  35. }
  36.  
  37. for (int l = 0; l < 64; ++l)
  38. {
  39. int i1 = chunkX + random.nextInt(8) - random.nextInt(8);
  40. int j1 = y + random.nextInt(4) - random.nextInt(4);
  41. int k1 = chunkZ + random.nextInt(8) - random.nextInt(8);
  42.  
  43. if (world.isAirBlock(i1, j1, k1) && (!world.provider.hasNoSky || j1 < 127) && Block.blocksList[BlockHelper.heartFlower.blockID].canBlockStay(world, i1, j1, k1))
  44. {
  45. world.setBlock(i1, j1, k1, BlockHelper.heartFlower.blockID, 0, 2);
  46. }
  47. }
  48.  
  49. }
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement