use of net.minecraft.world.chunk.ChunkPrimer in project SpongeCommon by SpongePowered.
the class MixinChunkGeneratorOverworld 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);
this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
this.biomesForGeneration = getBiomesFromGenerator(x, z);
ChunkPrimer chunkprimer = new ChunkBufferPrimer(buffer);
this.setBlocksInChunk(x, z, chunkprimer);
setBedrock(buffer);
}
use of net.minecraft.world.chunk.ChunkPrimer in project SpongeCommon by SpongePowered.
the class SpongeChunkGenerator method generateChunk.
@Override
public Chunk generateChunk(int chunkX, int chunkZ) {
this.rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);
this.cachedBiomes.reuse(new Vector3i(chunkX * 16, 0, chunkZ * 16));
this.biomeGenerator.generateBiomes(this.cachedBiomes);
ImmutableBiomeVolume biomeBuffer = this.cachedBiomes.getImmutableBiomeCopy();
// Generate base terrain
ChunkPrimer chunkprimer = new ChunkPrimer();
MutableBlockVolume blockBuffer = new ChunkPrimerBuffer(chunkprimer, chunkX, chunkZ);
this.baseGenerator.populate((org.spongepowered.api.world.World) this.world, blockBuffer, biomeBuffer);
if (!(this.baseGenerator instanceof SpongeGenerationPopulator)) {
replaceBiomeBlocks(this.world, this.rand, chunkX, chunkZ, chunkprimer, biomeBuffer);
}
// Apply the generator populators to complete the blockBuffer
for (GenerationPopulator populator : this.genpop) {
populator.populate((org.spongepowered.api.world.World) this.world, blockBuffer, biomeBuffer);
}
// Get unique biomes to determine what generator populators to run
List<BiomeType> uniqueBiomes = Lists.newArrayList();
BiomeType biome;
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
biome = this.cachedBiomes.getBiome(chunkX * 16 + x, 0, chunkZ * 16 + z);
if (!uniqueBiomes.contains(biome)) {
uniqueBiomes.add(biome);
}
}
}
// run our generator populators
for (BiomeType type : uniqueBiomes) {
BiomeGenerationSettings settings = getBiomeSettings(type);
for (GenerationPopulator populator : settings.getGenerationPopulators()) {
populator.populate((org.spongepowered.api.world.World) this.world, blockBuffer, biomeBuffer);
}
}
// Assemble chunk
Chunk chunk;
if (this.baseGenerator instanceof SpongeGenerationPopulator && ((SpongeGenerationPopulator) this.baseGenerator).getCachedChunk() != null) {
chunk = ((SpongeGenerationPopulator) this.baseGenerator).getCachedChunk();
((IMixinChunk) chunk).fill(chunkprimer);
} else {
chunk = new Chunk(this.world, chunkprimer, chunkX, chunkZ);
this.cachedBiomes.fill(chunk.getBiomeArray());
}
chunk.generateSkylightMap();
return chunk;
}
use of net.minecraft.world.chunk.ChunkPrimer in project MorePlanets by SteveKunG.
the class ChunkGeneratorNibiru method generateChunk.
@Override
public Chunk generateChunk(int chunkX, int chunkZ) {
this.rand.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L);
ChunkPrimer chunkprimer = new ChunkPrimer();
this.setBlocksInChunk(chunkX, chunkZ, chunkprimer);
this.biomesForGeneration = this.worldObj.getBiomeProvider().getBiomesForGeneration(this.biomesForGeneration, chunkX * 16, chunkZ * 16, 16, 16);
this.replaceBlocksForBiome(chunkX, chunkZ, chunkprimer, this.biomesForGeneration);
this.caveGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
this.ravineGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
this.mineshaftGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
this.strongholdGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
this.pyramidGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
this.jungleTempleGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
this.oceanMonumentGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
this.villageGenerator.generate(this.worldObj, chunkX, chunkZ, chunkprimer);
this.dungeonGenerator.generate(this.worldObj, chunkX, chunkZ, 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;
}
use of net.minecraft.world.chunk.ChunkPrimer in project Galacticraft by micdoodle8.
the class ChunkProviderVenus method provideChunk.
@Override
public Chunk provideChunk(int x, int z) {
this.rand.setSeed((long) x * 341873128712L + (long) z * 132897987541L);
ChunkPrimer chunkprimer = new ChunkPrimer();
this.setBlocksInChunk(x, z, chunkprimer);
this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16);
this.lavaCaveGenerator.generate(this, this.worldObj, x, z, chunkprimer);
this.replaceBlocksForBiome(x, z, chunkprimer, this.biomesForGeneration);
this.caveGenerator.generate(this, this.worldObj, x, z, chunkprimer);
this.dungeonGenerator.generate(this, this.worldObj, x, z, chunkprimer);
Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
byte[] abyte = chunk.getBiomeArray();
for (int i = 0; i < abyte.length; ++i) {
abyte[i] = (byte) this.biomesForGeneration[i].biomeID;
}
chunk.generateSkylightMap();
return chunk;
}
use of net.minecraft.world.chunk.ChunkPrimer in project Galacticraft by micdoodle8.
the class ChunkProviderAsteroids method provideChunk.
@Override
public Chunk provideChunk(int par1, int par2) {
ChunkPrimer primer = new ChunkPrimer();
// long time1 = System.nanoTime();
this.rand.setSeed(par1 * 341873128712L + par2 * 132897987541L);
// final Block[] ids = new Block[65536];
// final byte[] meta = new byte[65536];
this.generateTerrain(par1, par2, primer, false);
if (this.worldObj.provider instanceof WorldProviderAsteroids && ((WorldProviderAsteroids) this.worldObj.provider).checkHasAsteroids()) {
this.dungeonGenerator.generate(this, this.worldObj, par1, par2, primer);
}
// long time2 = System.nanoTime();
final Chunk var4 = new Chunk(this.worldObj, primer, par1, par2);
final byte[] var5 = var4.getBiomeArray();
for (int var6 = 0; var6 < var5.length; ++var6) {
var5[var6] = (byte) BiomeGenBaseAsteroids.asteroid.biomeID;
}
// long time3 = System.nanoTime();
this.generateSkylightMap(var4, par1, par2);
// }
return var4;
}
Aggregations