Advertisement
djoveryde

Ore Gen

Jun 10th, 2015
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.06 KB | None | 0 0
  1. package com.dj.world;
  2.  
  3. import com.dj.blocks.MBlocks;
  4. import cpw.mods.fml.common.IWorldGenerator;
  5. import java.util.Random;
  6. import net.minecraft.world.World;
  7. import net.minecraft.world.WorldProvider;
  8. import net.minecraft.world.chunk.IChunkProvider;
  9. import net.minecraft.world.gen.feature.WorldGenMinable;
  10. import net.minecraft.world.gen.feature.WorldGenerator;
  11.  
  12. public class OreGeneration
  13. implements IWorldGenerator
  14. {
  15. private WorldGenerator gen_GhostIron_ore;
  16. private WorldGenerator gen_Wither_ore;
  17. private WorldGenerator gen_Overyde_ore;
  18. private WorldGenerator gen_Abroatine;
  19. private WorldGenerator gen_Eternium;
  20. private WorldGenerator gen_Vuproynyx;
  21. private WorldGenerator gen_Xecrine;
  22. private WorldGenerator gen_Asnian;
  23. private WorldGenerator gen_Nucrium;
  24.  
  25. public OreGeneration()
  26. {
  27. this.gen_GhostIron_ore = new WorldGenMinable(MBlocks.GhostIron, 5);
  28. this.gen_Wither_ore = new WorldGenMinable(MBlocks.WitherOre, 5);
  29. this.gen_Overyde_ore = new WorldGenMinable(MBlocks.OverydeOre, 5);
  30. this.gen_Abroatine = new WorldGenMinable(MBlocks.Abroatine, 5);
  31. this.gen_Eternium = new WorldGenMinable(MBlocks.Eternium, 5);
  32. this.gen_Vuproynyx = new WorldGenMinable(MBlocks.Vuproynyx, 5);
  33. this.gen_Xecrine = new WorldGenMinable(MBlocks.Xecrine, 5);
  34. this.gen_Asnian = new WorldGenMinable(MBlocks.Asnian, 5);
  35. this.gen_Nucrium = new WorldGenMinable(MBlocks.Nucrium, 5);
  36. }
  37.  
  38. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
  39. {
  40. switch (world.field_73011_w.field_76574_g)
  41. {
  42. case 0:
  43. runGenerator(this.gen_GhostIron_ore, world, random, chunkX, chunkZ, 40, 0, 40);
  44. runGenerator(this.gen_Wither_ore, world, random, chunkX, chunkZ, 40, 0, 40);
  45. runGenerator(this.gen_Overyde_ore, world, random, chunkX, chunkZ, 20, 0, 40);
  46. runGenerator(this.gen_Abroatine, world, random, chunkX, chunkZ, 5, 0, 20);
  47. runGenerator(this.gen_Eternium, world, random, chunkX, chunkZ, 5, 0, 20);
  48. runGenerator(this.gen_Vuproynyx, world, random, chunkX, chunkZ, 5, 0, 20);
  49. runGenerator(this.gen_Xecrine, world, random, chunkX, chunkZ, 5, 0, 20);
  50. runGenerator(this.gen_Asnian, world, random, chunkX, chunkZ, 5, 0, 10);
  51. runGenerator(this.gen_Nucrium, world, random, chunkX, chunkZ, 5, 0, 10);
  52.  
  53.  
  54. break;
  55. case -1:
  56. break;
  57. }
  58. }
  59.  
  60. private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight)
  61. {
  62. if ((minHeight < 0) || (maxHeight > 256) || (minHeight > maxHeight)) {
  63. throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
  64. }
  65. int heightDiff = maxHeight - minHeight + 1;
  66. for (int i = 0; i < chancesToSpawn; i++)
  67. {
  68. int x = chunk_X * 16 + rand.nextInt(16);
  69. int y = minHeight + rand.nextInt(heightDiff);
  70. int z = chunk_Z * 16 + rand.nextInt(16);
  71. generator.func_76484_a(world, rand, x, y, z);
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement