Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. public class RubyWorldGen implements IWorldGenerator
  2. {
  3. public WorldGenerator gen_Rubyore;
  4.  
  5. public RubyWorldGen ()
  6. {
  7. gen_Rubyore = new WorldGenMinable(RubyBlocks.Rubyore.getDefaultState(), 8);
  8. }
  9.  
  10. public void runGenerator(WorldGenerator generator, World world, Random random, int chunkX, int chunkZ, int veinsPerChunk,int minHeight, int maxHeight)
  11. {
  12. if (minHeight<0 || maxHeight > 265 || minHeight > maxHeight)
  13. throw new IllegalArgumentException("Illegal Height");
  14.  
  15. int heightDiff = maxHeight - minHeight + 1;
  16. for (int i = 0; i < veinsPerChunk; i++)
  17. {
  18. int x = chunkX * 16 + random.nextInt(16);
  19. int y = minHeight + random.nextInt(heightDiff);
  20. int z = chunkZ * 16 + random.nextInt(16);
  21. generator.generate(world, random, new BlockPos(x, y, z));
  22. }
  23. }
  24.  
  25. @Override
  26. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider)
  27. {
  28. switch (world.provider.getDimension())
  29. {
  30. case 1:
  31. break;
  32. case 0:
  33. runGenerator(gen_Rubyore, world, random, chunkX, chunkZ, 15, 0, 40);
  34. break;
  35. case -1:
  36. break;
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement