Advertisement
thesuperbowser2

Untitled

Apr 19th, 2015
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.39 KB | None | 0 0
  1. package org.thesuperbowser2.jcraft;
  2.  
  3. import java.util.Random;
  4.  
  5. import org.thesuperbowser2.jcraft.blocks.BlockBluetaniumBlock;
  6. import org.thesuperbowser2.jcraft.blocks.BlockBluetaniumOre;
  7.  
  8. import net.minecraft.block.Block;
  9. import net.minecraft.world.World;
  10. import net.minecraft.world.chunk.IChunkProvider;
  11. import net.minecraft.world.gen.feature.WorldGenMinable;
  12. import cpw.mods.fml.common.IWorldGenerator;
  13.  
  14. public class JcraftWorldGenerator implements IWorldGenerator {
  15.  
  16. @Override
  17. public void generate(Random random, int chunkX, int chunkZ, World world,
  18. IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
  19. switch(world.provider.dimensionId){
  20. case -1:
  21. generateNether(world, random, chunkX * 32, chunkZ * 32);
  22. break;
  23. case 0:
  24. generateSurface(world, random, chunkX * 32, chunkZ * 32);
  25. break;
  26. case 1:
  27. generateEnd(world, random, chunkX * 32, chunkZ * 32);
  28. break;
  29. }
  30.  
  31. }
  32.  
  33. private void generateEnd(World world, Random random, int i, int j) {
  34. }
  35.  
  36. private void generateSurface(World world, Random random, int i, int j) {
  37. generateVeins(world, random, i, j,
  38. 8, 13, // 8 veins, 13 blocks per vein
  39. 40, 52, // depth 40 thru 52
  40. Jcraft.BluetaniumOre); //the type of block
  41. generateVeins(world, random, i, j,
  42. 6, 3, // 6 veins, 3 blocks per vein because it's SOOPER RAER
  43. 12, 32, // and it's very deep
  44. Jcraft.RainbowOre);
  45. generateVeins(world, random, i, j,
  46. 7, 4, // 7 veins, 4 blocks per vein because it's not as good as rainbow, but better than diamond
  47. 0, 32, // medium depth???
  48. Jcraft.ShadowOre);
  49.  
  50. }
  51.  
  52. private void generateVeins(World world, Random random, int i, int j,
  53. int veinsPerChunk, int blocksPerVein, int minDepth, int maxDepth,
  54. Block blockType) {
  55. for(int k = 0; k < veinsPerChunk; k++) {
  56. int firstBlockXCoord = i + random.nextInt(32);
  57. int firstBlockYCoord = minDepth + random.nextInt(1 + (maxDepth - minDepth));
  58. int firstBlockZCoord = j + random.nextInt(32);
  59. (new WorldGenMinable(blockType, blocksPerVein)).generate(world, random, firstBlockXCoord, firstBlockYCoord, firstBlockZCoord);
  60. }
  61. }
  62.  
  63. private void generateNether(World world, Random random, int i, int j) {
  64.  
  65. generateVeins(world, random, i, j,
  66. 8, 10, // 8 veins, 10 blocks per vein because it's COOKIAES
  67. 16, 32, //you'll find it most of the nether
  68. Jcraft.CookiteOre);
  69.  
  70.  
  71. }
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement