Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ModFlowerGenerator implements IWorldGenerator {
- public WorldGenerator yellow_tulip;
- public WorldGenerator green_tulip;
- public WorldGenerator blue_tulip;
- public WorldGenerator black_tulip;
- public ModFlowerGenerator() {
- yellow_tulip = new ModWorldGeneratorFlowers(ModElements.yellow_tulip);
- green_tulip = new ModWorldGeneratorFlowers(ModElements.green_tulip);
- blue_tulip = new ModWorldGeneratorFlowers(ModElements.blue_tulip);
- black_tulip = new ModWorldGeneratorFlowers(ModElements.black_tulip);
- }
- public void runGenerator(WorldGenerator generator, World world, Random random, int chunk_x, int chunk_z,
- int chancesToSpawn) {
- for (int i = 0; i < chancesToSpawn; i++) {
- int x = chunk_x * 16 + random.nextInt(16);
- int y = 50 + random.nextInt(16);
- int z = chunk_z * 16 + random.nextInt(16);
- if (ModElements.yellow_tulip.canBlockStay(world, new BlockPos(x, y, z),
- ModElements.yellow_tulip.getDefaultState())) {
- if (y < 255 && y < 50) {
- generator.generate(world, random, new BlockPos(x, y, z));
- }
- }
- }
- }
- @Override
- public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator,
- IChunkProvider chunkProvider) {
- this.runGenerator(yellow_tulip, world, random, chunkX, chunkZ, 5);
- this.runGenerator(green_tulip, world, random, chunkX, chunkZ, 5);
- this.runGenerator(blue_tulip, world, random, chunkX, chunkZ, 5);
- this.runGenerator(black_tulip, world, random, chunkX, chunkZ, 5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment