Search in sources :

Example 1 with WorldGenSponge

use of rtg.api.world.gen.feature.WorldGenSponge in project Realistic-Terrain-Generation by Team-RTG.

the class DecoSponge method generate.

@Override
public void generate(IRealisticBiome biome, RTGWorld rtgWorld, Random rand, int worldX, int worldZ, float strength, float river, boolean hasPlacedVillageBlocks) {
    if (this.allowed) {
        WorldUtil worldUtil = new WorldUtil(rtgWorld.world);
        WorldGenerator worldGenerator = new WorldGenSponge(spongeBlock, 0, rand, validGroundBlocks);
        for (int l1 = 0; l1 < this.strengthFactor * strength; ++l1) {
            // + 8;
            int i1 = worldX + rand.nextInt(16);
            // + 8;
            int j1 = worldZ + rand.nextInt(16);
            int k1;
            switch(this.heightType) {
                case NEXT_INT:
                    k1 = RandomUtil.getRandomInt(rand, this.minY, this.maxY);
                    break;
                case GET_HEIGHT_VALUE:
                    k1 = rtgWorld.world.getHeight(new BlockPos(i1, 0, j1)).getY();
                    break;
                default:
                    k1 = rtgWorld.world.getHeight(new BlockPos(i1, 0, j1)).getY();
                    break;
            }
            if (k1 >= this.minY && k1 <= this.maxY && rand.nextInt(this.chance) == 0) {
                worldGenerator.generate(rtgWorld.world, rand, new BlockPos(i1, k1, j1));
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) BlockPos(net.minecraft.util.math.BlockPos) WorldUtil(rtg.api.util.WorldUtil) WorldGenSponge(rtg.api.world.gen.feature.WorldGenSponge)

Aggregations

BlockPos (net.minecraft.util.math.BlockPos)1 WorldGenerator (net.minecraft.world.gen.feature.WorldGenerator)1 WorldUtil (rtg.api.util.WorldUtil)1 WorldGenSponge (rtg.api.world.gen.feature.WorldGenSponge)1