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