Search in sources :

Example 6 with BiomeType

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);
        }
    }
}
Also used : BiomeType(org.spongepowered.api.world.biome.BiomeType) VirtualBiomeType(org.spongepowered.api.world.biome.VirtualBiomeType) VirtualBiomeType(org.spongepowered.api.world.biome.VirtualBiomeType)

Example 7 with BiomeType

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);
            }
        }
    }
}
Also used : BiomeType(org.spongepowered.api.world.biome.BiomeType) UnmodifiableBiomeVolume(org.spongepowered.api.world.extent.UnmodifiableBiomeVolume) Vector3i(com.flowpowered.math.vector.Vector3i)

Example 8 with BiomeType

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);
            }
        }
    }
}
Also used : BiomeType(org.spongepowered.api.world.biome.BiomeType) UnmodifiableBiomeVolume(org.spongepowered.api.world.extent.UnmodifiableBiomeVolume) Vector3i(com.flowpowered.math.vector.Vector3i)

Example 9 with BiomeType

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);
            }
        }
    }
}
Also used : BiomeType(org.spongepowered.api.world.biome.BiomeType)

Example 10 with BiomeType

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());
        }
    }
}
Also used : BiomeType(org.spongepowered.api.world.biome.BiomeType) Vector3i(com.flowpowered.math.vector.Vector3i)

Aggregations

BiomeType (org.spongepowered.api.world.biome.BiomeType)25 Vector3i (com.flowpowered.math.vector.Vector3i)10 VirtualBiomeType (org.spongepowered.api.world.biome.VirtualBiomeType)9 BiomeGenerationSettings (org.spongepowered.api.world.biome.BiomeGenerationSettings)8 ImmutableBiomeVolume (org.spongepowered.api.world.extent.ImmutableBiomeVolume)5 GenerationPopulator (org.spongepowered.api.world.gen.GenerationPopulator)5 Biome (net.minecraft.world.biome.Biome)4 UnmodifiableBiomeVolume (org.spongepowered.api.world.extent.UnmodifiableBiomeVolume)4 ArrayList (java.util.ArrayList)3 Extent (org.spongepowered.api.world.extent.Extent)3 Populator (org.spongepowered.api.world.gen.Populator)3 Timing (co.aikar.timings.Timing)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 BlockPos (net.minecraft.util.math.BlockPos)2 World (net.minecraft.world.World)2 Chunk (net.minecraft.world.chunk.Chunk)2 ChunkGeneratorOverworld (net.minecraft.world.gen.ChunkGeneratorOverworld)2 DataContainer (org.spongepowered.api.data.DataContainer)2 EventManager (org.spongepowered.api.event.EventManager)2 BiomeGenerator (org.spongepowered.api.world.gen.BiomeGenerator)2