Guest User

WorldGenMod

a guest
Jun 6th, 2016
147
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package com.mod.serveur.world;
  2.  
  3. import java.util.Random;
  4.  
  5. import com.mod.serveur.init.BlockMod;
  6.  
  7. import cpw.mods.fml.common.IWorldGenerator;
  8. import net.minecraft.block.Block;
  9. import net.minecraft.init.Blocks;
  10. import net.minecraft.world.World;
  11. import net.minecraft.world.chunk.IChunkProvider;
  12. import net.minecraft.world.gen.feature.WorldGenMinable;
  13.  
  14. public class WorldGenMod implements IWorldGenerator
  15. {
  16.  
  17. @Override
  18. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider)
  19. {
  20. switch(world.provider.dimensionId)
  21. {
  22. case -1:
  23. GenerateNether(world, chunkX * 16, chunkZ * 16, random);
  24. break;
  25.  
  26. case 0:
  27. GenerateOverWorld(world, chunkX * 16, chunkZ * 16, random);
  28. break;
  29.  
  30. case 1:
  31. GenerateEnd(world, chunkX * 16, chunkZ * 16, random);
  32. break;
  33.  
  34. }
  35. }
  36.  
  37. private void addOre(Block block, Block blockspawn, Random random, World world, int posX, int posZ, int minY, int maxY, int minV, int maxV, int spawnChance)
  38. {
  39. for(int i = 0; i < spawnChance; i++)
  40. {
  41. int chunkSize= 16;
  42. int Xpos = posX + random.nextInt(chunkSize);
  43. int Ypos = minY + random.nextInt(maxY - minY);
  44. int Zpos = posX + random.nextInt(chunkSize);
  45.  
  46. new WorldGenMinable (block, maxV, blockspawn).generate(world, random, Xpos, Ypos, Zpos);
  47. }
  48. }
  49.  
  50.  
  51. private void GenerateNether(World world, int i, int j, Random random)
  52. {
  53.  
  54. }
  55.  
  56. private void GenerateOverWorld(World world, int i, int j, Random random)
  57. {
  58. addOre(BlockMod.jaspe_ore, Blocks.stone, random, world, i, j, 0, 9, 1, 4, 2);
  59. addOre(BlockMod.heliotrope_ore, Blocks.stone, random, world, i, j, 0, 18, 1, 8, 15);
  60. addOre(BlockMod.rubellite_ore, Blocks.stone, random, world, i, j, 0, 26, 1, 10, 20);
  61. addOre(BlockMod.sphene_ore, Blocks.stone, random, world, i, j, 0, 13, 1, 6, 5);
  62. System.out.println("generation");
  63. }
  64.  
  65. private void GenerateEnd(World world, int i, int j, Random random)
  66. {
  67.  
  68. }
  69.  
  70. }
RAW Paste Data