Guest User

Untitled

a guest
Jun 18th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. public class ModFlowerGenerator implements IWorldGenerator {
  2.  
  3. public WorldGenerator yellow_tulip;
  4. public WorldGenerator green_tulip;
  5. public WorldGenerator blue_tulip;
  6. public WorldGenerator black_tulip;
  7.  
  8. public ModFlowerGenerator() {
  9. yellow_tulip = new ModWorldGeneratorFlowers(ModElements.yellow_tulip);
  10. green_tulip = new ModWorldGeneratorFlowers(ModElements.green_tulip);
  11. blue_tulip = new ModWorldGeneratorFlowers(ModElements.blue_tulip);
  12. black_tulip = new ModWorldGeneratorFlowers(ModElements.black_tulip);
  13. }
  14.  
  15. public void runGenerator(WorldGenerator generator, World world, Random random, int chunk_x, int chunk_z,
  16. int chancesToSpawn) {
  17. for (int i = 0; i < chancesToSpawn; i++) {
  18. int x = chunk_x * 16 + random.nextInt(16);
  19. int y = 50 + random.nextInt(16);
  20. int z = chunk_z * 16 + random.nextInt(16);
  21. if (ModElements.yellow_tulip.canBlockStay(world, new BlockPos(x, y, z),
  22. ModElements.yellow_tulip.getDefaultState())) {
  23. if (y < 255 && y < 50) {
  24. generator.generate(world, random, new BlockPos(x, y, z));
  25. }
  26. }
  27. }
  28. }
  29.  
  30. @Override
  31. public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
  32. IChunkProvider chunkProvider) {
  33. this.runGenerator(yellow_tulip, world, random, chunkX, chunkZ, 5);
  34. this.runGenerator(green_tulip, world, random, chunkX, chunkZ, 5);
  35. this.runGenerator(blue_tulip, world, random, chunkX, chunkZ, 5);
  36. this.runGenerator(black_tulip, world, random, chunkX, chunkZ, 5);
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment