Advertisement
alexbegt

Untitled

May 26th, 2013
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.92 KB | None | 0 0
  1. package net.HarmonionTeam.DKICore.World;
  2.  
  3. import java.util.Arrays;
  4. import java.util.Iterator;
  5. import java.util.List;
  6. import java.util.Random;
  7.  
  8. import net.HarmonionTeam.DKICore.Blocks.ModBlocks;
  9. import net.minecraft.block.Block;
  10. import net.minecraft.world.World;
  11. import net.minecraft.world.biome.BiomeGenBase;
  12. import net.minecraft.world.chunk.IChunkProvider;
  13. import cpw.mods.fml.common.IWorldGenerator;
  14.  
  15. public class DKICoreWorldGenHandler implements IWorldGenerator
  16. {
  17. public static boolean[] sGeneratedOres = { true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true };
  18.  
  19. public void generate(Random aRandom, int aX, int aZ, World aWorld, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider)
  20. {
  21. String tBiome = aWorld.getBiomeGenForCoords(aX + 8, aZ + 8).biomeName;
  22. if (tBiome.equals(BiomeGenBase.hell.biomeName))
  23. generateNether(aWorld, aRandom, aX * 16, aZ * 16, aChunkGenerator, aChunkProvider);
  24. else if (tBiome.equals(BiomeGenBase.sky.biomeName))
  25. generateEnd(aWorld, aRandom, aX * 16, aZ * 16, aChunkGenerator, aChunkProvider);
  26. else
  27. generateSurface(aWorld, aRandom, aX * 16, aZ * 16, aChunkGenerator, aChunkProvider);
  28. }
  29.  
  30. private void generateSurface(World aWorld, Random aRandom, int aX, int aZ, IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider)
  31. {
  32. String tBiome = aWorld.getBiomeGenForCoords(aX + 8, aZ + 8).biomeName;
  33. if (sGeneratedOres[1] != false) {
  34. for (int i = 0; i < 5; i++)
  35. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 0, 12, false, Block.stone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
  36. for (int i = 0; i < 3; i++)
  37. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 4, 6, false, Block.stone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
  38. for (int i = 0; i < 2; i++)
  39. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 8, 1, false, Block.stone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
  40. for (int i = 0; i < 5; i++)
  41. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 12, 6, false, Block.stone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
  42.  
  43. for (int i = 0; i < 2; i++)
  44. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 3, 3, false, Block.gravel.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
  45. for (int i = 0; i < 2; i++)
  46. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 7, 3, false, Block.gravel.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
  47. for (int i = 0; i < 2; i++)
  48. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 11, 3, false, Block.gravel.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
  49. for (int i = 0; i < 2; i++)
  50. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 15, 3, false, Block.gravel.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(32), aZ + aRandom.nextInt(16));
  51. }
  52. }
  53.  
  54. private void generateNether(World aWorld, Random aRandom, int aX, int aZ, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
  55. {
  56. int tQuantity = (1 + aRandom.nextInt(2)) * (1 + aRandom.nextInt(2)) * (1 + aRandom.nextInt(2)) * (1 + aRandom.nextInt(2));
  57. if (sGeneratedOres[1] != false) {
  58. for (int i = 0; i < tQuantity; i++)
  59. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 1, tQuantity * 2, false, Block.netherrack.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
  60. for (int i = 0; i < tQuantity; i++)
  61. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 5, tQuantity * 2, false, Block.netherrack.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
  62. for (int i = 0; i < tQuantity; i++)
  63. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 9, tQuantity * 2, false, Block.netherrack.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
  64. for (int i = 0; i < tQuantity; i++)
  65. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 13, tQuantity * 2, false, Block.netherrack.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
  66.  
  67. }
  68. }
  69.  
  70. private void generateEnd(World aWorld, Random aRandom, int aX, int aZ, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
  71. if (sGeneratedOres[1] != false) {
  72. for (int i = 0; i < 9; i++)
  73. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 2, 12, false, Block.whiteStone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
  74. for (int i = 0; i < 6; i++)
  75. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 6, 6, false, Block.whiteStone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
  76. for (int i = 0; i < 3; i++)
  77. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 10, 3, false, Block.whiteStone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
  78. for (int i = 0; i < 9; i++)
  79. new WorldGenMinableMeta(ModBlocks.BlockOres.blockID, 14, 6, false, Block.whiteStone.blockID).generate(aWorld, aRandom, aX + aRandom.nextInt(16), aRandom.nextInt(64), aZ + aRandom.nextInt(16));
  80. }
  81. }
  82.  
  83. private void placeSingleOreBlock(World aWorld, int aID, int aMeta, int aX, int aY, int aZ, int aBlockID) {
  84. Block block = Block.blocksList[aWorld.getBlockId(aX, aY, aZ)];
  85. if ((block != null) && (block.isGenMineableReplaceable(aWorld, aX, aY, aZ, aBlockID)))
  86. aWorld.setBlock(aX, aY, aZ, aID, aMeta, 0);
  87. }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement