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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations