Search in sources :

Example 31 with Biome

use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.

the class ChunkProviderDiona method populate.

@Override
public void populate(int chunkX, int chunkZ) {
    BlockFalling.fallInstantly = true;
    int x = chunkX * 16;
    int z = chunkZ * 16;
    BlockPos pos = new BlockPos(x, 0, z);
    Biome biomegenbase = this.worldObj.getBiome(pos.add(16, 0, 16));
    ChunkPos chunkcoordintpair = new ChunkPos(chunkX, chunkZ);
    this.rand.setSeed(this.worldObj.getSeed());
    long k = this.rand.nextLong() / 2L * 2L + 1L;
    long l = this.rand.nextLong() / 2L * 2L + 1L;
    this.rand.setSeed(chunkX * k + chunkZ * l ^ this.worldObj.getSeed());
    WorldEntitySpawner.performWorldGenSpawning(this.worldObj, biomegenbase, x + 8, z + 8, 16, 16, this.rand);
    this.dungeonGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair);
    this.biomeDecorator.decorate(this.worldObj, this.rand, biomegenbase, pos);
    this.mineshaftGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair);
    int y = this.rand.nextInt(this.rand.nextInt(248) + 8);
    if (this.rand.nextInt(4) == 0) {
        if (y < 48) {
            new WorldGenLiquidLakes(DionaBlocks.CRYSTALLIZE_WATER_FLUID_BLOCK, DionaBlocks.DIONA_BLOCK, 2, false).generate(this.worldObj, this.rand, pos.add(this.rand.nextInt(16) + 8, y, this.rand.nextInt(16) + 8));
        }
    }
    if (this.rand.nextInt(8) == 0) {
        if (y < 48) {
            new WorldGenLiquidLakes(DionaBlocks.CRYSTALLIZE_LAVA_FLUID_BLOCK, DionaBlocks.DIONA_BLOCK, 2, true).generate(this.worldObj, this.rand, pos.add(this.rand.nextInt(16) + 8, y, this.rand.nextInt(16) + 8));
        }
    }
    for (int i = 0; i < 8; ++i) {
        new WorldGenSpaceDungeons(DionaBlocks.DIONA_ANCIENT_CHEST, DionaBlocks.DIONA_BLOCK, DionaBlocks.ALBETIUS_WORM_EGG_ROCK, 0).generate(this.worldObj, this.rand, pos.add(this.rand.nextInt(16) + 8, this.rand.nextInt(256), this.rand.nextInt(16) + 8));
    }
    if (this.rand.nextInt(250) == 0) {
        int i2 = this.rand.nextInt(16) + 8;
        int k3 = this.rand.nextInt(16) + 8;
        int l2 = this.worldObj.getTopSolidOrLiquidBlock(pos.add(i2, 0, k3)).getY();
        new WorldGenCrashedAlienProbe().generate(this.worldObj, this.rand, pos.add(i2, l2, k3));
    }
    BlockFalling.fallInstantly = false;
}
Also used : WorldGenLiquidLakes(stevekung.mods.moreplanets.util.world.gen.feature.WorldGenLiquidLakes) Biome(net.minecraft.world.biome.Biome) WorldGenSpaceDungeons(stevekung.mods.moreplanets.util.world.gen.feature.WorldGenSpaceDungeons) BlockPos(net.minecraft.util.math.BlockPos) ChunkPos(net.minecraft.util.math.ChunkPos) WorldGenCrashedAlienProbe(stevekung.mods.moreplanets.module.planets.diona.world.gen.feature.WorldGenCrashedAlienProbe)

Example 32 with Biome

use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.

the class BiomeProviderChalos method areBiomesViable.

@Override
public boolean areBiomesViable(int x, int z, int radius, List<Biome> allowed) {
    IntCache.resetIntCache();
    int i = x - radius >> 2;
    int j = z - radius >> 2;
    int k = x + radius >> 2;
    int l = z + radius >> 2;
    int i1 = k - i + 1;
    int j1 = l - j + 1;
    int[] aint = this.unzoomedBiomes.getInts(i, j, i1, j1);
    for (int k1 = 0; k1 < i1 * j1; ++k1) {
        Biome biome = Biome.getBiome(aint[k1]);
        if (!allowed.contains(biome)) {
            return false;
        }
    }
    return true;
}
Also used : Biome(net.minecraft.world.biome.Biome)

Example 33 with Biome

use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.

the class ChunkGeneratorChalos method populate.

@Override
public void populate(int chunkX, int chunkZ) {
    BlockFalling.fallInstantly = true;
    int x = chunkX * 16;
    int z = chunkZ * 16;
    BlockPos pos = new BlockPos(x, 0, z);
    Biome biomeGen = this.worldObj.getBiome(pos.add(16, 0, 16));
    this.rand.setSeed(this.worldObj.getSeed());
    long var7 = this.rand.nextLong() / 2L * 2L + 1L;
    long var9 = this.rand.nextLong() / 2L * 2L + 1L;
    this.rand.setSeed(chunkX * var7 + chunkZ * var9 ^ this.worldObj.getSeed());
    biomeGen.decorate(this.worldObj, this.rand, pos);
    this.biomedecoratorplanet.decorate(this.worldObj, this.rand, biomeGen, pos);
    WorldEntitySpawner.performWorldGenSpawning(this.worldObj, biomeGen, x + 8, z + 8, 16, 16, this.rand);
    int worldX = chunkX << 4;
    int worldZ = chunkZ << 4;
    this.generateGas(this.worldObj, this.rand, worldX + 15, worldZ + 15);
    this.dungeonGenerator.generateStructure(this.worldObj, this.rand, new ChunkPos(chunkX, chunkZ));
    for (int i = 0; i < 8; ++i) {
        new WorldGenSpaceDungeons(ChalosBlocks.CHALOS_ANCIENT_CHEST, ChalosBlocks.CHALOS_BLOCK, ChalosBlocks.CHEESE_SLIME_BLOCK, 1, 0).generate(this.worldObj, this.rand, pos.add(this.rand.nextInt(16) + 8, this.rand.nextInt(256), this.rand.nextInt(16) + 8));
    }
    if (biomeGen != MPBiomes.SLIMELY_WASTELAND && this.rand.nextInt(8) == 0) {
        new WorldGenLiquidLakes(ChalosBlocks.CHEESE_OF_MILK_FLUID_BLOCK, ChalosBlocks.CHALOS_BLOCK, 0, false).generate(this.worldObj, this.rand, pos.add(this.rand.nextInt(16) + 8, this.rand.nextInt(256), this.rand.nextInt(16) + 8));
    }
    BlockFalling.fallInstantly = false;
}
Also used : WorldGenLiquidLakes(stevekung.mods.moreplanets.util.world.gen.feature.WorldGenLiquidLakes) Biome(net.minecraft.world.biome.Biome) WorldGenSpaceDungeons(stevekung.mods.moreplanets.util.world.gen.feature.WorldGenSpaceDungeons) BlockPos(net.minecraft.util.math.BlockPos) ChunkPos(net.minecraft.util.math.ChunkPos)

Example 34 with Biome

use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.

the class ChunkGeneratorChalos method generateHeightmap.

private void generateHeightmap(int chunkX, int chunkY, int chunkZ) {
    this.depthRegion = this.depthNoise.generateNoiseOctaves(this.depthRegion, chunkX, chunkZ, 5, 5, 200.0F, 200.0F, 0.5F);
    float f = 684.412F;
    float f1 = 684.412F;
    this.mainNoiseRegion = this.mainPerlinNoise.generateNoiseOctaves(this.mainNoiseRegion, chunkX, chunkY, chunkZ, 5, 33, 5, f / 80.0F, f1 / 160.0F, f / 80.0F);
    this.minLimitRegion = this.minLimitPerlinNoise.generateNoiseOctaves(this.minLimitRegion, chunkX, chunkY, chunkZ, 5, 33, 5, f, f1, f);
    this.maxLimitRegion = this.maxLimitPerlinNoise.generateNoiseOctaves(this.maxLimitRegion, chunkX, chunkY, chunkZ, 5, 33, 5, f, f1, f);
    chunkZ = 0;
    chunkX = 0;
    int i = 0;
    int j = 0;
    for (int k = 0; k < 5; ++k) {
        for (int l = 0; l < 5; ++l) {
            float f2 = 0.0F;
            float f3 = 0.0F;
            float f4 = 0.0F;
            int i1 = 2;
            Biome biome = this.biomesForGeneration[k + 2 + (l + 2) * 10];
            for (int j1 = -i1; j1 <= i1; ++j1) {
                for (int k1 = -i1; k1 <= i1; ++k1) {
                    Biome biome1 = this.biomesForGeneration[k + j1 + 2 + (l + k1 + 2) * 10];
                    float f5 = 0.0F + biome1.getBaseHeight() * 1.0F;
                    float f6 = 0.0F + biome1.getHeightVariation() * 1.0F;
                    float f7 = this.parabolicField[j1 + 2 + (k1 + 2) * 5] / (f5 + 2.0F);
                    if (biome1.getBaseHeight() > biome.getBaseHeight()) {
                        f7 /= 2.0F;
                    }
                    f2 += f6 * f7;
                    f3 += f5 * f7;
                    f4 += f7;
                }
            }
            f2 = f2 / f4;
            f3 = f3 / f4;
            f2 = f2 * 0.9F + 0.1F;
            f3 = (f3 * 4.0F - 1.0F) / 8.0F;
            double d7 = this.depthRegion[j] / 8000.0D;
            if (d7 < 0.0D) {
                d7 = -d7 * 0.3D;
            }
            d7 = d7 * 3.0D - 2.0D;
            if (d7 < 0.0D) {
                d7 = d7 / 2.0D;
                if (d7 < -1.0D) {
                    d7 = -1.0D;
                }
                d7 = d7 / 1.4D;
                d7 = d7 / 2.0D;
            } else {
                if (d7 > 1.0D) {
                    d7 = 1.0D;
                }
                d7 = d7 / 8.0D;
            }
            ++j;
            double d8 = f3;
            double d9 = f2;
            d8 = d8 + d7 * 0.2D;
            d8 = d8 * 8.5F / 8.0D;
            double d0 = 8.5F + d8 * 4.0D;
            for (int l1 = 0; l1 < 33; ++l1) {
                double d1 = (l1 - d0) * 12.0F * 128.0D / 256.0D / d9;
                if (d1 < 0.0D) {
                    d1 *= 4.0D;
                }
                double d2 = this.minLimitRegion[i] / 512.0F;
                double d3 = this.maxLimitRegion[i] / 512.0F;
                double d4 = (this.mainNoiseRegion[i] / 10.0D + 1.0D) / 2.0D;
                double d5 = MathHelper.clamp(d2, d3, d4) - d1;
                if (l1 > 29) {
                    double d6 = (l1 - 29) / 3.0F;
                    d5 = d5 * (1.0D - d6) + -10.0D * d6;
                }
                this.heightMap[i] = d5;
                ++i;
            }
        }
    }
}
Also used : Biome(net.minecraft.world.biome.Biome)

Example 35 with Biome

use of net.minecraft.world.biome.Biome in project MorePlanets by SteveKunG.

the class ChunkGeneratorChalos method replaceBlocksForBiome.

public void replaceBlocksForBiome(int chunkX, int chunkZ, ChunkPrimer chunkPrimer, Biome[] biome) {
    double d0 = 0.03125D;
    this.depthBuffer = this.surfaceNoise.getRegion(this.depthBuffer, chunkX * 16, chunkZ * 16, 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
    for (int i = 0; i < 16; ++i) {
        for (int j = 0; j < 16; ++j) {
            Biome Biome = biome[j + i * 16];
            Biome.genTerrainBlocks(this.worldObj, this.rand, chunkPrimer, chunkX * 16 + i, chunkZ * 16 + j, this.depthBuffer[j + i * 16]);
        }
    }
}
Also used : Biome(net.minecraft.world.biome.Biome)

Aggregations

Biome (net.minecraft.world.biome.Biome)110 BlockPos (net.minecraft.util.math.BlockPos)39 IBlockState (net.minecraft.block.state.IBlockState)16 ResourceLocation (net.minecraft.util.ResourceLocation)9 World (net.minecraft.world.World)9 Nullable (javax.annotation.Nullable)8 Random (java.util.Random)7 ChunkPos (net.minecraft.util.math.ChunkPos)7 DoubleRange (com.almuradev.toolbox.util.math.DoubleRange)6 HashMap (java.util.HashMap)6 FunctionPredicate (com.almuradev.content.component.predicate.FunctionPredicate)5 Map (java.util.Map)5 Block (net.minecraft.block.Block)5 WorldServer (net.minecraft.world.WorldServer)5 BiomeChunk (com.almuradev.almura.feature.biome.BiomeChunk)4 Overwrite (org.spongepowered.asm.mixin.Overwrite)4 Entity (net.minecraft.entity.Entity)3 IntRange (com.almuradev.toolbox.util.math.IntRange)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2