Search in sources :

Example 11 with ChunkPrimer

use of net.minecraft.world.chunk.ChunkPrimer in project Wizardry by TeamWizardry.

the class ChunkGeneratorUnderWorld method generateChunk.

@Nonnull
@Override
public Chunk generateChunk(int x, int z) {
    ChunkPrimer chunkprimer = new ChunkPrimer();
    // Get a list of blocks to check lighting for, as a "side effect" of actually generating the clouds
    List<Pair<BlockPos, BlockPos>> litBlocks = generate(x, z, chunkprimer);
    Chunk chunk = new Chunk(world, chunkprimer, x, z);
    litBlocks.forEach(pair -> {
        BlockPos lower = pair.getFirst();
        BlockPos upper = pair.getSecond();
        for (int i = 0; i < 15; i++) {
            if (lower.getY() + i > upper.getY())
                return;
            chunk.setLightFor(EnumSkyBlock.BLOCK, lower.up(i), 15 - i);
        }
    });
    return chunk;
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) Chunk(net.minecraft.world.chunk.Chunk) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer) Pair(kotlin.Pair) Nonnull(javax.annotation.Nonnull)

Example 12 with ChunkPrimer

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

the class ChunkProviderSkaia method generateChunk.

@Override
public Chunk generateChunk(int x, int z) {
    ChunkPrimer primer = new ChunkPrimer();
    double[] generated0 = new double[256];
    double[] generated1 = new double[256];
    double[] generated2 = new double[256];
    int[] topBlock = new int[256];
    generated0 = this.noiseGen1.generateNoiseOctaves(generated0, x * 16, 10, z * 16, 16, 1, 16, .1, 0, .1);
    generated1 = this.noiseGen5.generateNoiseOctaves(generated1, x * 16, 10, z * 16, 16, 1, 16, .04, 0, .04);
    generated2 = this.noiseGen2.generateNoiseOctaves(generated2, x * 16, 10, z * 16, 16, 1, 16, .01, 0, .01);
    for (int i = 0; i < 256; i++) {
        int y = (int) (128 + generated0[i] + generated1[i] + generated2[i]);
        topBlock[i] = (y & 511) <= 255 ? y & 255 : 255 - y & 255;
    }
    byte chessTileMetadata = (byte) ((Math.abs(x) + Math.abs(z)) % 2);
    IBlockState block = MinestuckBlocks.chessTile.getDefaultState().withProperty(BlockChessTile.BLOCK_TYPE, BlockChessTile.BlockType.values()[chessTileMetadata]);
    for (int posX = 0; posX < 16; posX++) for (int posZ = 0; posZ < 16; posZ++) for (int posY = 0; posY <= topBlock[posX * 16 + posZ]; posY++) {
        primer.setBlockState(posX, posY, posZ, block);
    }
    // y * 256, z * 16, x
    Chunk chunk = new Chunk(this.skaiaWorld, primer, x, z);
    // this.castleGenerator.generate(skaiaWorld, x, z, primer);
    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 13 with ChunkPrimer

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

the class ChunkGeneratorCavenia method generateChunk.

@Override
public Chunk generateChunk(int chunkX, int chunkZ) {
    rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);
    biomesForGeneration = world.getBiomeProvider().getBiomes(biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16);
    ChunkPrimer primer = new ChunkPrimer();
    setBlocksInChunk(primer);
    if (CaveniaConfig.generateCaves) {
        caveGenerator.generate(world, chunkX, chunkZ, primer);
    }
    replaceBiomeBlocks(chunkX, chunkZ, primer);
    veinGenerator.generate(world, rand, biomesForGeneration, 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(biomesForGeneration[i]);
    }
    return chunk;
}
Also used : Chunk(net.minecraft.world.chunk.Chunk) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Example 14 with ChunkPrimer

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

the class ChunkGeneratorCrownCliffs method generateChunk.

@Override
public Chunk generateChunk(int chunkX, int chunkZ) {
    rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);
    ChunkPrimer primer = new ChunkPrimer();
    setBlocksInChunk(chunkX, chunkZ, primer);
    biomesForGeneration = world.getBiomeProvider().getBiomes(biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16);
    replaceBiomeBlocks(chunkX, chunkZ, primer, biomesForGeneration);
    caveGenerator.generate(world, chunkX, chunkZ, primer);
    ravineGenerator.generate(world, chunkX, chunkZ, primer);
    mineshaftGenerator.generate(world, chunkX, chunkZ, primer);
    Chunk chunk = new Chunk(world, primer, chunkX, chunkZ);
    byte[] biomes = chunk.getBiomeArray();
    for (int i = 0; i < biomes.length; ++i) {
        biomes[i] = (byte) Biome.getIdForBiome(biomesForGeneration[i]);
    }
    chunk.generateSkylightMap();
    return chunk;
}
Also used : Chunk(net.minecraft.world.chunk.Chunk) ChunkPrimer(net.minecraft.world.chunk.ChunkPrimer)

Example 15 with ChunkPrimer

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

the class ChunkGeneratorCavern method generateChunk.

@Override
public Chunk generateChunk(int chunkX, int chunkZ) {
    rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);
    biomesForGeneration = world.getBiomeProvider().getBiomes(biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16);
    ChunkPrimer primer = new ChunkPrimer();
    setBlocksInChunk(primer);
    if (CavernConfig.generateCaves) {
        caveGenerator.generate(world, chunkX, chunkZ, primer);
    }
    if (CavernConfig.generateRavine) {
        ravineGenerator.generate(world, chunkX, chunkZ, primer);
    }
    if (CavernConfig.generateExtremeCaves) {
        extremeCaveGenerator.generate(world, chunkX, chunkZ, primer);
    }
    if (CavernConfig.generateExtremeRavine) {
        extremeRavineGenerator.generate(world, chunkX, chunkZ, primer);
    }
    if (CavernConfig.generateMineshaft) {
        mineshaftGenerator.generate(world, chunkX, chunkZ, primer);
    }
    replaceBiomeBlocks(chunkX, chunkZ, primer);
    veinGenerator.generate(world, rand, biomesForGeneration, 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(biomesForGeneration[i]);
    }
    return chunk;
}
Also used : Chunk(net.minecraft.world.chunk.Chunk) 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