use of org.spongepowered.api.world.biome.BiomeType in project SpongeCommon by SpongePowered.
the class ObjectArrayMutableBiomeBuffer method fill.
public void fill(byte[] biomes) {
for (int x = 0; x < this.size.getX(); x++) {
for (int z = 0; z < this.size.getZ(); z++) {
BiomeType type = this.biomes[x + z * this.size.getX()];
if (type instanceof VirtualBiomeType) {
type = ((VirtualBiomeType) type).getPersistedType();
}
biomes[x + z * this.size.getX()] = (byte) Biome.getIdForBiome((Biome) type);
}
}
}
use of org.spongepowered.api.world.biome.BiomeType in project SpongeCommon by SpongePowered.
the class SpongeBiomeVolumeWorker method merge.
@Override
public void merge(BiomeVolume second, BiomeVolumeMerger merger, MutableBiomeVolume destination) {
final Vector3i offsetSecond = align(second);
final int xOffsetSecond = offsetSecond.getX();
final int yOffsetSecond = offsetSecond.getY();
final int zOffsetSecond = offsetSecond.getZ();
final Vector3i offsetDestination = align(destination);
final int xOffsetDestination = offsetDestination.getX();
final int yOffsetDestination = offsetDestination.getY();
final int zOffsetDestination = offsetDestination.getZ();
final UnmodifiableBiomeVolume firstUnmodifiableArea = this.volume.getUnmodifiableBiomeView();
final int xMin = firstUnmodifiableArea.getBiomeMin().getX();
final int yMin = firstUnmodifiableArea.getBiomeMin().getY();
final int zMin = firstUnmodifiableArea.getBiomeMin().getZ();
final int xMax = firstUnmodifiableArea.getBiomeMax().getX();
final int yMax = firstUnmodifiableArea.getBiomeMax().getY();
final int zMax = firstUnmodifiableArea.getBiomeMax().getZ();
final UnmodifiableBiomeVolume secondUnmodifiableArea = second.getUnmodifiableBiomeView();
for (int z = zMin; z <= zMax; z++) {
for (int y = yMin; y <= yMax; y++) {
for (int x = xMin; x <= xMax; x++) {
final BiomeType biome = merger.merge(firstUnmodifiableArea, x, y, z, secondUnmodifiableArea, x + xOffsetSecond, y + yOffsetSecond, z + zOffsetSecond);
destination.setBiome(x + xOffsetDestination, y + yOffsetDestination, z + zOffsetDestination, biome);
}
}
}
}
use of org.spongepowered.api.world.biome.BiomeType in project SpongeCommon by SpongePowered.
the class SpongeBiomeVolumeWorker method map.
@Override
public void map(BiomeVolumeMapper mapper, MutableBiomeVolume destination) {
final Vector3i offset = align(destination);
final int xOffset = offset.getX();
final int yOffset = offset.getY();
final int zOffset = offset.getZ();
final UnmodifiableBiomeVolume unmodifiableArea = this.volume.getUnmodifiableBiomeView();
final int xMin = unmodifiableArea.getBiomeMin().getX();
final int yMin = unmodifiableArea.getBiomeMin().getY();
final int zMin = unmodifiableArea.getBiomeMin().getZ();
final int xMax = unmodifiableArea.getBiomeMax().getX();
final int yMax = unmodifiableArea.getBiomeMax().getY();
final int zMax = unmodifiableArea.getBiomeMax().getZ();
for (int z = zMin; z <= zMax; z++) {
for (int y = yMin; y <= yMax; y++) {
for (int x = xMin; x <= xMax; x++) {
final BiomeType biome = mapper.map(unmodifiableArea, x, y, z);
destination.setBiome(x + xOffset, y + yOffset, z + zOffset, biome);
}
}
}
}
use of org.spongepowered.api.world.biome.BiomeType in project SpongeCommon by SpongePowered.
the class SpongeMutableBiomeVolumeWorker method fill.
@Override
public void fill(BiomeVolumeFiller filler) {
final int xMin = this.volume.getBiomeMin().getX();
final int yMin = this.volume.getBiomeMin().getY();
final int zMin = this.volume.getBiomeMin().getZ();
final int xMax = this.volume.getBiomeMax().getX();
final int yMax = this.volume.getBiomeMax().getY();
final int zMax = this.volume.getBiomeMax().getZ();
for (int z = zMin; z <= zMax; z++) {
for (int y = yMin; y <= yMax; y++) {
for (int x = xMin; x <= xMax; x++) {
final BiomeType biome = filler.produce(x, y, z);
this.volume.setBiome(x, y, z, biome);
}
}
}
}
use of org.spongepowered.api.world.biome.BiomeType in project SpongeCommon by SpongePowered.
the class SpongeChunkGenerator method replaceBiomeBlocks.
public void replaceBiomeBlocks(World world, Random rand, int x, int z, ChunkPrimer chunk, ImmutableBiomeVolume biomes) {
double d0 = 0.03125D;
this.stoneNoise = this.noise4.getRegion(this.stoneNoise, x * 16, z * 16, 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
Vector3i min = biomes.getBiomeMin();
for (int x0 = 0; x0 < 16; ++x0) {
for (int z0 = 0; z0 < 16; ++z0) {
BiomeType biomegenbase = biomes.getBiome(min.getX() + x0, 0, min.getZ() + z0);
generateBiomeTerrain(world, rand, chunk, x * 16 + x0, z * 16 + z0, this.stoneNoise[x0 + z0 * 16], getBiomeSettings(biomegenbase).getGroundCoverLayers());
}
}
}
Aggregations