Advertisement
Guest User

Untitled

a guest
Mar 19th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. public class SlurpiesDonglesWorldGenerator implements IWorldGenerator {
  2. //@formatter:off
  3.  
  4. private WorldGenerator gen_purple_glowstone;
  5.  
  6. //@formatter:on
  7.  
  8. public SlurpiesDonglesWorldGenerator() {
  9. this.gen_purple_glowstone = new WorldGenMinable(SlurpiesDonglesBlocks.purple_glowstone.getDefaultState(), 20, BlockHelper.forBlock.Blocks.netherrack);
  10.  
  11. }
  12.  
  13. @Override
  14. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider) {
  15. switch(world.provider.getDimension()) {
  16. case 0: //OverWorld
  17.  
  18. break;
  19. case -1: //Nether
  20. this.runGenerator(this.gen_purple_glowstone, world, random, chunkX, chunkZ, 20, 1, 255);
  21. break;
  22. case 1: //End
  23.  
  24. break;
  25. }
  26. }
  27.  
  28.  
  29. private void runGenerator(WorldGenerator generator, World world, Random rand, int chunk_X, int chunk_Z, int chancesToSpawn, int minHeight, int maxHeight) {
  30. if (minHeight < 0 || maxHeight > 256 ||minHeight > maxHeight)
  31. throw new IllegalArgumentException("Illegal Height Arguments for WorldGenerator");
  32.  
  33. int heightDiff = maxHeight - minHeight + 1;
  34. for (int i = 0; i < chancesToSpawn; i++) {
  35. int x = chunk_X * 16 + rand.nextInt(16);
  36. int y = minHeight + rand.nextInt(heightDiff);
  37. int z = chunk_Z * 16 + rand.nextInt(16);
  38. generator.generate(world, rand, new BlockPos(x, y, z));
  39. }
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement