Search in sources :

Example 26 with ChunkPrimer

use of net.minecraft.world.chunk.ChunkPrimer in project NetherEx by LogicTechCorp.

the class ChunkProviderNether method provideChunk.

@Override
public Chunk provideChunk(int chunkX, int chunkZ) {
    ChunkPrimer primer = new ChunkPrimer();
    rand.setSeed((long) chunkX * 341873128712L + (long) chunkZ * 132897987541L);
    biomesForGen = world.getBiomeProvider().getBiomes(null, chunkX * 16, chunkZ * 16, 16, 16);
    prepareHeights(chunkX, chunkZ, primer);
    buildSurfaces(chunkX, chunkZ, primer);
    netherCaves.generate(world, chunkX, chunkZ, primer);
    netherBridge.generate(world, chunkX, chunkZ, primer);
    Chunk chunk = new Chunk(world, primer, chunkX, chunkZ);
    byte[] biomeArray = chunk.getBiomeArray();
    for (int i = 0; i < biomeArray.length; ++i) {
        biomeArray[i] = (byte) Biome.getIdForBiome(biomesForGen[i]);
    }
    chunk.resetRelightChecks();
    return chunk;
}
Also used : Chunk(net.minecraft.world.chunk.Chunk) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Example 27 with ChunkPrimer

use of net.minecraft.world.chunk.ChunkPrimer in project RFToolsDimensions by McJty.

the class GenericChunkGenerator method provideChunk.

@Override
public Chunk provideChunk(int chunkX, int chunkZ) {
    this.rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomesForGeneration(this.biomesForGeneration, chunkX * 4 - 2, chunkZ * 4 - 2, 10, 10);
    terrainGenerator.generate(chunkX, chunkZ, chunkprimer);
    this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomes(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16);
    terrainGenerator.replaceBlocksForBiome(chunkX, chunkZ, chunkprimer, this.biomesForGeneration);
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_TENDRILS)) {
        this.tendrilGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_CANYONS)) {
        this.canyonGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_PYRAMIDS)) {
        this.pyramidGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_ORBS)) {
        this.sphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_HUGEORBS)) {
        this.hugeSphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_SCATTEREDORBS)) {
        this.scatteredSphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_LIQUIDORBS)) {
        this.liquidSphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_HUGELIQUIDORBS)) {
        this.hugeLiquidSphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_CAVES)) {
        this.caveGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_DENSE_CAVES)) {
        this.denseCaveGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_RAVINES)) {
        this.ravineGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_MINESHAFT)) {
        this.mineshaftGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_VILLAGE)) {
        this.villageGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_STRONGHOLD)) {
        this.strongholdGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_FORTRESS)) {
        this.genNetherBridge.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_SCATTERED)) {
        this.scatteredFeatureGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_SWAMPHUT)) {
        this.genSwampHut.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_DESERTTEMPLE)) {
        this.genDesertTemple.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_JUNGLETEMPLE)) {
        this.genJungleTemple.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_IGLOO)) {
        this.genIgloo.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_OCEAN_MONUMENT)) {
        this.oceanMonumentGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.getTerrainType() == TerrainType.TERRAIN_INVERTIGO) {
        reverse(chunkprimer);
    }
    Chunk chunk = new Chunk(this.worldObj, chunkprimer, chunkX, chunkZ);
    byte[] abyte = chunk.getBiomeArray();
    for (int i = 0; i < abyte.length; ++i) {
        abyte[i] = (byte) Biome.getIdForBiome(this.biomesForGeneration[i]);
    }
    chunk.generateSkylightMap();
    return chunk;
}
Also used : Chunk(net.minecraft.world.chunk.Chunk) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Example 28 with ChunkPrimer

use of net.minecraft.world.chunk.ChunkPrimer in project RFToolsDimensions by McJty.

the class GenericChunkGenerator method generateChunk.

@Override
public Chunk generateChunk(int chunkX, int chunkZ) {
    this.rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomesForGeneration(this.biomesForGeneration, chunkX * 4 - 2, chunkZ * 4 - 2, 10, 10);
    terrainGenerator.generate(chunkX, chunkZ, chunkprimer);
    this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomes(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16);
    terrainGenerator.replaceBlocksForBiome(chunkX, chunkZ, chunkprimer, this.biomesForGeneration);
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_TENDRILS)) {
        this.tendrilGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_CANYONS)) {
        this.canyonGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_PYRAMIDS)) {
        this.pyramidGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_ORBS)) {
        this.sphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_HUGEORBS)) {
        this.hugeSphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_SCATTEREDORBS)) {
        this.scatteredSphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_LIQUIDORBS)) {
        this.liquidSphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_HUGELIQUIDORBS)) {
        this.hugeLiquidSphereGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_CAVES)) {
        this.caveGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_DENSE_CAVES)) {
        this.denseCaveGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasFeatureType(FeatureType.FEATURE_RAVINES)) {
        this.ravineGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_MINESHAFT)) {
        this.mineshaftGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_VILLAGE)) {
        this.villageGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_STRONGHOLD)) {
        this.strongholdGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_FORTRESS)) {
        this.genNetherBridge.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_SCATTERED)) {
        this.scatteredFeatureGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_SWAMPHUT)) {
        this.genSwampHut.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_DESERTTEMPLE)) {
        this.genDesertTemple.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_JUNGLETEMPLE)) {
        this.genJungleTemple.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_IGLOO)) {
        this.genIgloo.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.hasStructureType(StructureType.STRUCTURE_OCEAN_MONUMENT)) {
        this.oceanMonumentGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
    }
    if (dimensionInformation.getTerrainType() == TerrainType.TERRAIN_INVERTIGO) {
        reverse(chunkprimer);
    }
    Chunk chunk = new Chunk(this.worldObj, chunkprimer, chunkX, chunkZ);
    byte[] abyte = chunk.getBiomeArray();
    for (int i = 0; i < abyte.length; ++i) {
        abyte[i] = (byte) Biome.getIdForBiome(this.biomesForGeneration[i]);
    }
    chunk.generateSkylightMap();
    return chunk;
}
Also used : Chunk(net.minecraft.world.chunk.Chunk) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Example 29 with ChunkPrimer

use of net.minecraft.world.chunk.ChunkPrimer in project RFToolsDimensions by McJty.

the class LostCitiesTerrainGenerator method doCityChunk.

private void doCityChunk(int chunkX, int chunkZ, ChunkPrimerHelper helper, BuildingInfo info) {
    ChunkPrimer primer = helper.getPrimer();
    boolean building = info.hasBuilding;
    Random rand = new Random(provider.seed * 377 + chunkZ * 341873128712L + chunkX * 132897987541L);
    rand.nextFloat();
    rand.nextFloat();
    int index = 0;
    for (int x = 0; x < 16; ++x) {
        for (int z = 0; z < 16; ++z) {
            int height = 0;
            while (height < WorldgenConfiguration.bedrockLayer) {
                BaseTerrainGenerator.setBlockState(primer, index++, bedrock);
                height++;
            }
            while (height < WorldgenConfiguration.bedrockLayer + 30 + rand.nextInt(3)) {
                BaseTerrainGenerator.setBlockState(primer, index++, baseBlock);
                height++;
            }
            if (building) {
                index = generateBuilding(helper, info, rand, chunkX, chunkZ, index, x, z, height);
            } else {
                index = generateStreet(helper, info, rand, chunkX, chunkZ, index, x, z, height);
            }
        }
    }
    if (building) {
        if (info.getDamageArea().hasExplosions()) {
            fixAfterExplosion(helper, info, rand);
        }
    }
}
Also used : ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Example 30 with ChunkPrimer

use of net.minecraft.world.chunk.ChunkPrimer in project SpongeCommon by SpongePowered.

the class MixinChunkGeneratorHell method populate.

@Override
public void populate(World world, MutableBlockVolume buffer, ImmutableBiomeVolume biomes) {
    int x = GenericMath.floor(buffer.getBlockMin().getX() / 16f);
    int z = GenericMath.floor(buffer.getBlockMin().getZ() / 16f);
    ChunkPrimer chunkprimer = new ChunkBufferPrimer(buffer);
    this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
    this.prepareHeights(x, z, chunkprimer);
    this.buildSurfaces(x, z, chunkprimer);
}
Also used : ChunkBufferPrimer(org.spongepowered.common.util.gen.ChunkBufferPrimer) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Aggregations

ChunkPrimer (net.minecraft.world.chunk.ChunkPrimer)49 Chunk (net.minecraft.world.chunk.Chunk)38 IBlockState (net.minecraft.block.state.IBlockState)8 BlockPos (net.minecraft.util.math.BlockPos)3 Biome (net.minecraft.world.biome.Biome)3 ChunkBufferPrimer (org.spongepowered.common.util.gen.ChunkBufferPrimer)3 Nonnull (javax.annotation.Nonnull)2 ChunkPos (net.minecraft.util.math.ChunkPos)2 BOPOverworldBiome (biomesoplenty.common.biome.overworld.BOPOverworldBiome)1 Vector3i (com.flowpowered.math.vector.Vector3i)1 MapGenStructureHook (ivorius.reccomplex.world.gen.feature.structure.MapGenStructureHook)1 Random (java.util.Random)1 Nullable (javax.annotation.Nullable)1 Pair (kotlin.Pair)1 WorldProviderAsteroids (micdoodle8.mods.galacticraft.planets.asteroids.dimension.WorldProviderAsteroids)1 MutableBlockPos (net.minecraft.util.math.BlockPos.MutableBlockPos)1 ChunkCoordIntPair (net.minecraft.world.ChunkCoordIntPair)1 World (net.minecraft.world.World)1 BiomeProvider (net.minecraft.world.biome.BiomeProvider)1 ChunkGeneratorOverworld (net.minecraft.world.gen.ChunkGeneratorOverworld)1