Search in sources :

Example 46 with ChunkPrimer

use of net.minecraft.world.chunk.ChunkPrimer in project Cavern2 by kegare.

the class ChunkGeneratorWideDesert method generateChunk.

@Override
public Chunk generateChunk(int x, int z) {
    rand.setSeed(x * 341873128712L + z * 132897987541L);
    ChunkPrimer primer = new ChunkPrimer();
    setBlocksInChunk(x, z, primer);
    replaceBiomeBlocks(x, z, primer);
    caveGenerator.generate(world, x, z, primer);
    villageGenerator.generate(world, x, z, primer);
    Chunk chunk = new Chunk(this.world, primer, x, z);
    byte[] biomes = chunk.getBiomeArray();
    for (int i = 0; i < biomes.length; ++i) {
        biomes[i] = (byte) Biome.getIdForBiome(Biomes.DESERT);
    }
    chunk.generateSkylightMap();
    return chunk;
}
Also used : Chunk(net.minecraft.world.chunk.Chunk) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Example 47 with ChunkPrimer

use of net.minecraft.world.chunk.ChunkPrimer in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class ChunkProviderDestinyIslands method generateChunk.

@Override
public Chunk generateChunk(int x, int z) {
    this.chunkX = x;
    this.chunkZ = z;
    this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16);
    IBlockState state;
    int yOffset = 60;
    for (int xPos = 0; xPos < 16; xPos++) {
        for (int zPos = 0; zPos < 16; zPos++) {
            int top = 15 + yOffset;
            for (int depth = 1 + yOffset; depth < top; depth++) {
                if (depth < 14 + yOffset)
                    state = Blocks.WATER.getDefaultState();
                else
                    state = Blocks.SAND.getDefaultState();
                chunkprimer.setBlockState(xPos, top - depth + yOffset, zPos, state);
            }
            chunkprimer.setBlockState(xPos, 0 + yOffset, zPos, Blocks.BEDROCK.getDefaultState());
        }
    }
    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    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 : IBlockState(net.minecraft.block.state.IBlockState) Chunk(net.minecraft.world.chunk.Chunk) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Example 48 with ChunkPrimer

use of net.minecraft.world.chunk.ChunkPrimer in project Kingdom-Keys-Re-Coded by Wehavecookies56.

the class ChunkProviderDiveToTheHeart method generateChunk.

@Override
public Chunk generateChunk(int x, int z) {
    this.chunkX = x;
    this.chunkZ = z;
    this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
    ChunkPrimer chunkprimer = new ChunkPrimer();
    this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomes(this.biomesForGeneration, x * 16, z * 16, 16, 16);
    Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
    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 49 with ChunkPrimer

use of net.minecraft.world.chunk.ChunkPrimer in project Minestuck by mraof.

the class ChunkProviderLands method generateChunk.

@Override
public Chunk generateChunk(int x, int z) {
    ChunkPrimer primer = terrainGenerator.createChunk(x, z);
    Chunk chunk = new Chunk(this.landWorld, primer, x, z);
    chunk.generateSkylightMap();
    Biome[] biomes = landWorld.getBiomeProvider().getBiomes(null, x * 16, z * 16, 16, 16);
    byte[] chunkBiomes = chunk.getBiomeArray();
    for (int i = 0; i < chunkBiomes.length; i++) chunkBiomes[i] = (byte) Biome.getIdForBiome(biomes[i]);
    structureHandler.generate(landWorld, x, z, primer);
    villageHandler.generate(landWorld, x, z, primer);
    return chunk;
}
Also used : Biome(net.minecraft.world.biome.Biome) Chunk(net.minecraft.world.chunk.Chunk) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Example 50 with ChunkPrimer

use of net.minecraft.world.chunk.ChunkPrimer in project Minestuck by mraof.

the class LandTerrainGenBase method createChunk.

@Override
public ChunkPrimer createChunk(int chunkX, int chunkZ) {
    IBlockState ground = provider.getGroundBlock();
    IBlockState upper = provider.getUpperBlock();
    IBlockState surface = provider.getSurfaceBlock();
    IBlockState river = provider.blockRegistry.getBlockState("river");
    IBlockState ocean = provider.blockRegistry.getBlockState("ocean");
    ChunkPrimer primer = new ChunkPrimer();
    // original code
    int[] topBlock = getHeightMap(chunkX, chunkZ);
    int[] topRiverBlock = getRiverHeightMap(chunkX, chunkZ);
    for (int x = 0; x < 16; x++) for (int z = 0; z < 16; z++) {
        primer.setBlockState(x, 0, z, Blocks.BEDROCK.getDefaultState());
        int riverHeight = Math.max(0, topRiverBlock[x << 4 | z] - Math.max(0, seaHeight - topBlock[x << 4 | z]));
        int y;
        int yMax = topBlock[x << 4 | z] - 3 - riverHeight;
        for (y = 1; y < yMax; y++) {
            primer.setBlockState(x, y, z, ground);
        }
        int upperBlockHeight = (riverHeight > 0 || yMax + 3 >= seaHeight) ? 2 : 3;
        for (; y < yMax + upperBlockHeight; y++) primer.setBlockState(x, y, z, upper);
        if (y >= seaHeight && riverHeight == 0)
            primer.setBlockState(x, y, z, surface);
        else {
            for (int i = y + riverHeight; y < i; y++) primer.setBlockState(x, y, z, river);
            for (; y <= seaHeight; y++) primer.setBlockState(x, y, z, ocean);
        }
    }
    return primer;
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Aggregations

ChunkPrimer (net.minecraft.world.chunk.ChunkPrimer)55 Chunk (net.minecraft.world.chunk.Chunk)44 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 WorldProviderAsteroids (micdoodle8.mods.galacticraft.planets.asteroids.dimension.WorldProviderAsteroids)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 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