Advertisement
PSquishyP

Untitled

Jul 13th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1. package thegoldcrayon.thegoldcrayonsgemstonesmod;
  2.  
  3. import java.util.Random;
  4.  
  5. import net.minecraft.block.Block;
  6. import net.minecraft.init.Blocks;
  7. import net.minecraft.world.World;
  8. import net.minecraft.world.chunk.IChunkProvider;
  9. import net.minecraft.world.gen.feature.WorldGenMinable;
  10. import cpw.mods.fml.common.IWorldGenerator;
  11.  
  12. public class OnyxOreGeneration implements IWorldGenerator {
  13.  
  14. @Override
  15. public void generate(Random random, int chunkX, int chunkZ, World world,
  16. IChunkProvider chunkGenerator, IChunkProvider chunkProvider) {
  17. switch(world.provider.dimensionId)
  18. {
  19. case 0:
  20. generateOverWorld(world, random, chunkX, chunkZ);
  21. break;
  22. }
  23. }
  24. public void generateOverWorld(World world, Random rand, int x, int z){
  25. generateOre(TheGoldCrayonsGemstonesMod.blockOnyxOre, world, rand, x, z, 2, 8, 15, 20, 50, Blocks.stone);
  26. generateOre2(TheGoldCrayonsGemstonesMod.OTHERORE, world, rand, x, z, 2, 8, 15, 20, 50, Blocks.stone);
  27. }
  28.  
  29. public void generateOre(Block block, World world, Random random, int chunkX, int chunkZ, int minVeinSize, int maxVeinSize, int chance, int minY, int maxY, Block generateIn){
  30. int veinSize = minVeinSize + random.nextInt(maxVeinSize - minVeinSize);
  31. int heightRange = maxY - minY;
  32. WorldGenMinable gen = new WorldGenMinable(block, veinSize, generateIn);
  33. for(int i = 0; i < chance; i++){
  34. int xRand = chunkX * 16 + random.nextInt(16);
  35. int yRand = random.nextInt(heightRange) + minY;
  36. int zRand = chunkZ * 16 + random.nextInt(16);
  37. gen.generate(world, random, xRand, yRand, zRand);
  38.  
  39. }
  40. }
  41.  
  42. public void generateOre2(Block block, World world, Random random, int chunkX, int chunkZ, int minVeinSize, int maxVeinSize, int chance, int minY, int maxY, Block generateIn){
  43. int veinSize = minVeinSize + random.nextInt(maxVeinSize - minVeinSize);
  44. int heightRange = maxY - minY;
  45. WorldGenMinable gen = new WorldGenMinable(block, veinSize, generateIn);
  46. for(int i = 0; i < chance; i++){
  47. int xRand = chunkX * 16 + random.nextInt(16);
  48. int yRand = random.nextInt(heightRange) + minY;
  49. int zRand = chunkZ * 16 + random.nextInt(16);
  50. gen.generate(world, random, xRand, yRand, zRand);
  51.  
  52. }
  53. }
  54.  
  55.  
  56.  
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement