Guest User

OreGenHandler 2

a guest
Feb 10th, 2013
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. package deathman12e3.MiningExpansion.common;
  2.  
  3. import java.util.Random;
  4.  
  5. import cpw.mods.fml.common.IWorldGenerator;
  6. import net.minecraft.world.World;
  7. import net.minecraft.world.chunk.IChunkProvider;
  8. import net.minecraft.world.gen.feature.WorldGenMinable;
  9.  
  10. public class OreGenHandler implements IWorldGenerator
  11. {
  12.  
  13. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
  14. {
  15.  
  16. switch (world.provider.dimensionId)
  17. {
  18.  
  19. case -1: generateNether(world, random, chunkX*16, chunkZ*16);
  20.  
  21. case 0: generateSurface(world, random, chunkX*16, chunkZ*16);
  22.  
  23. }
  24.  
  25. }
  26.  
  27. private void generateSurface(World world, Random random, int blockX, int blockZ)
  28. {
  29. for (int x = 0; x < 80; x++)
  30. {
  31.  
  32. int Xcoord = blockX + random.nextInt(16);
  33. int Ycoord = random.nextInt(100);
  34. int Zcoord = blockZ + random.nextInt(16);
  35.  
  36. (new WorldGenMinable(BaseMod.copperOre.blockID, random.nextInt(8))).generate(world, random, Xcoord, Ycoord, Zcoord);
  37. }
  38.  
  39. for (int x = 0; x < 20; x++)
  40. {
  41.  
  42. int Xcoord = blockX + random.nextInt(16);
  43. int Ycoord = random.nextInt(100);
  44. int Zcoord = blockZ + random.nextInt(16);
  45.  
  46. (new WorldGenMinable(BaseMod.tinOre.blockID, random.nextInt(8))).generate(world, random, Xcoord, Ycoord, Zcoord);
  47. }
  48.  
  49. for (int x = 0; x < 10; x++)
  50. {
  51.  
  52. int Xcoord = blockX + random.nextInt(16);
  53. int Ycoord = random.nextInt(29);
  54. int Zcoord = blockZ + random.nextInt(16);
  55.  
  56. (new WorldGenMinable(BaseMod.cobaltOre.blockID, random.nextInt(8))).generate(world, random, Xcoord, Ycoord, Zcoord);
  57. }
  58.  
  59. }
  60.  
  61. private void generateNether(World world, Random random, int blockX, int blockZ)
  62. {
  63.  
  64. for (int x = 0; x < 1000; x++)
  65. {
  66.  
  67. int Xcoord = blockX + random.nextInt(16);
  68. int Ycoord = random.nextInt(100);
  69. int Zcoord = blockZ + random.nextInt(16);
  70.  
  71. (new WorldGenMinable(BaseMod.onyxOre.blockID, random.nextInt(8))).generate(world, random, Xcoord, Ycoord, Zcoord);
  72. }
  73.  
  74. }
  75.  
  76. }
Advertisement
Add Comment
Please, Sign In to add comment