use of org.terasology.world.propagation.BiomeChange in project Terasology by MovingBlocks.
the class WorldProviderCoreImpl method setBiome.
@Override
public Biome setBiome(Vector3i worldPos, Biome biome) {
Vector3i chunkPos = ChunkMath.calcChunkPos(worldPos);
CoreChunk chunk = chunkProvider.getChunk(chunkPos);
if (chunk != null) {
Vector3i blockPos = ChunkMath.calcBlockPos(worldPos);
Biome oldBiomeType = chunk.setBiome(blockPos.x, blockPos.y, blockPos.z, biome);
if (oldBiomeType != biome) {
BiomeChange oldChange = biomeChanges.get(worldPos);
if (oldChange == null) {
biomeChanges.put(worldPos, new BiomeChange(worldPos, oldBiomeType, biome));
} else {
oldChange.setTo(biome);
}
for (Vector3i pos : ChunkMath.getChunkRegionAroundWorldPos(worldPos, 1)) {
RenderableChunk dirtiedChunk = chunkProvider.getChunk(pos);
if (dirtiedChunk != null) {
dirtiedChunk.setDirty(true);
}
}
notifyBiomeChanged(worldPos, biome, oldBiomeType);
}
return oldBiomeType;
}
return null;
}
Aggregations