Search in sources :

Example 1 with WorldGenerator

use of net.minecraft.world.gen.feature.WorldGenerator in project Realistic-Terrain-Generation by Team-RTG.

the class DecoCactus 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) {
        if (TerrainGen.decorate(rtgWorld.world, rand, new BlockPos(worldX, 0, worldZ), CACTUS)) {
            WorldGenerator worldGenerator = new WorldGenCacti(this.sandOnly, 0, this.soilBlock);
            int loopCount = this.loops;
            loopCount = (this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : loopCount;
            for (int i = 0; i < loopCount * 10; i++) {
                // + 8;
                int intX = worldX + rand.nextInt(16);
                int intY = rand.nextInt(this.maxY);
                // + 8;
                int intZ = worldZ + rand.nextInt(16);
                if (intY <= this.maxY && rand.nextInt(this.chance) == 0) {
                    worldGenerator.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                }
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenCacti(rtg.api.world.gen.feature.WorldGenCacti) BlockPos(net.minecraft.util.math.BlockPos)

Example 2 with WorldGenerator

use of net.minecraft.world.gen.feature.WorldGenerator in project Realistic-Terrain-Generation by Team-RTG.

the class DecoCobwebs 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) {
        WorldGenerator worldGenerator = new WorldGenBlock(Blocks.WEB.getDefaultState(), Blocks.AIR.getDefaultState(), this.adjacentBlock, this.minAdjacents);
        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 = RandomUtil.getRandomInt(rand, this.minY, this.maxY);
            if (rand.nextInt(this.chance) == 0) {
                worldGenerator.generate(rtgWorld.world, rand, new BlockPos(i1, k1, j1));
            }
        }
    }
}
Also used : WorldGenBlock(rtg.api.world.gen.feature.WorldGenBlock) WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) BlockPos(net.minecraft.util.math.BlockPos)

Example 3 with WorldGenerator

use of net.minecraft.world.gen.feature.WorldGenerator in project Realistic-Terrain-Generation by Team-RTG.

the class DecoCrop 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 WorldGenCrops(type, size, density, height, water);
        if (this.chance < 1) {
            return;
        }
        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 = rtgWorld.world.getHeight(new BlockPos(i1, 0, j1)).getY();
            if (k1 >= this.minY && k1 <= this.maxY && rand.nextInt(this.chance) == 0) {
                // If we're in a village, check to make sure the boulder has extra room to grow to avoid corrupting the village.
                if (hasPlacedVillageBlocks) {
                    if (!worldUtil.isSurroundedByBlock(Blocks.AIR.getDefaultState(), 2, WorldUtil.SurroundCheckType.CARDINAL, rand, i1, k1, j1)) {
                        return;
                    }
                }
                worldGenerator.generate(rtgWorld.world, rand, new BlockPos(i1, k1, j1));
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenCrops(rtg.api.world.gen.feature.WorldGenCrops) BlockPos(net.minecraft.util.math.BlockPos) WorldUtil(rtg.api.util.WorldUtil)

Example 4 with WorldGenerator

use of net.minecraft.world.gen.feature.WorldGenerator in project Realistic-Terrain-Generation by Team-RTG.

the class DecoDesertWell 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) {
        WorldGenerator worldGenerator = new WorldGenDesertWells();
        this.setLoops((this.strengthFactor > 0f) ? (int) (this.strengthFactor * strength) : this.loops);
        for (int i = 0; i < this.loops; i++) {
            if (rand.nextInt(this.chance) == 0) {
                int intX = worldX + rand.nextInt(16) + 8;
                int intY = rand.nextInt(this.maxY);
                int intZ = worldZ + rand.nextInt(16) + 8;
                if (intY <= this.maxY) {
                    worldGenerator.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
                }
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenDesertWells(net.minecraft.world.gen.feature.WorldGenDesertWells) BlockPos(net.minecraft.util.math.BlockPos)

Example 5 with WorldGenerator

use of net.minecraft.world.gen.feature.WorldGenerator in project Realistic-Terrain-Generation by Team-RTG.

the class DecoSeaweed 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) {
        /*
             * Determine how much seaweed we're going to try to generate (loopCount).
             * The actual amount of seaweed that ends up being generated could be *less* than this value,
             * depending on environmental conditions.
             */
        float noise = rtgWorld.simplex.noise2(worldX / this.distribution.noiseDivisor, worldZ / this.distribution.noiseDivisor) * this.distribution.noiseFactor + this.distribution.noiseAddend;
        int loopCount = this.loops;
        loopCount = (this.strengthFactorForLoops > 0f) ? (int) (this.strengthFactorForLoops * strength) : loopCount;
        loopCount = (this.strengthNoiseFactorForLoops) ? (int) (noise * strength) : loopCount;
        loopCount = (this.strengthNoiseFactorXForLoops) ? (int) (noise * this.strengthFactorForLoops * strength) : loopCount;
        if (loopCount < 1) {
            return;
        }
        WorldGenerator worldGen = new WorldGenSeaweed(this.seaweedBlock, RandomUtil.getRandomInt(rand, this.minHeight, this.maxHeight));
        for (int i = 0; i < loopCount; i++) {
            // + 8;
            int intX = scatter.get(rand, worldX);
            // + 8;
            int intZ = scatter.get(rand, worldZ);
            int intY = RandomUtil.getRandomInt(rand, this.minY, this.maxY);
            if (intY <= this.maxY && intY >= this.minY && isValidCondition(noise, rand, strength)) {
                worldGen.generate(rtgWorld.world, rand, new BlockPos(intX, intY, intZ));
            }
        }
    }
}
Also used : WorldGenerator(net.minecraft.world.gen.feature.WorldGenerator) WorldGenSeaweed(rtg.api.world.gen.feature.WorldGenSeaweed) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

WorldGenerator (net.minecraft.world.gen.feature.WorldGenerator)43 BlockPos (net.minecraft.util.math.BlockPos)27 IBlockState (net.minecraft.block.state.IBlockState)8 WorldUtil (rtg.api.util.WorldUtil)7 World (net.minecraft.world.World)3 WorldGenMinable (net.minecraft.world.gen.feature.WorldGenMinable)3 WorldGenGrass (rtg.api.world.gen.feature.WorldGenGrass)3 MapMaker (com.google.common.collect.MapMaker)2 ITree (forestry.api.arboriculture.ITree)2 WorldGenBase (forestry.core.worldgen.WorldGenBase)2 Predicate (java.util.function.Predicate)2 RailcraftConfig (mods.railcraft.common.core.RailcraftConfig)2 NoiseGenSimplex (mods.railcraft.common.worldgen.NoiseGen.NoiseGenSimplex)2 Vec3d (net.minecraft.util.math.Vec3d)2 Biome (net.minecraft.world.biome.Biome)2 WorldGenTrees (net.minecraft.world.gen.feature.WorldGenTrees)2 EventType (net.minecraftforge.event.terraingen.OreGenEvent.GenerateMinable.EventType)2 TerrainGen (net.minecraftforge.event.terraingen.TerrainGen)2 DecorateBiomeEventRTG (rtg.api.event.DecorateBiomeEventRTG)2 WorldGenBigTrees (betterwithaddons.world.WorldGenBigTrees)1