Search in sources :

Example 1 with BOPOverworldBiome

use of biomesoplenty.common.biome.overworld.BOPOverworldBiome in project BiomesOPlenty by Glitchfiend.

the class ChunkGeneratorOverworldBOP method getWeightedTerrainSettings.

private TerrainSettings getWeightedTerrainSettings(int localX, int localZ, Biome[] biomes) {
    // Rivers shouldn't be influenced by the neighbors
    Biome centerBiome = biomes[localX + 2 + (localZ + 2) * 10];
    if (centerBiome == Biomes.RIVER || centerBiome == Biomes.FROZEN_RIVER || ((centerBiome instanceof BOPOverworldBiome) && ((BOPOverworldBiome) centerBiome).noNeighborTerrainInfuence)) {
        return this.biomeTerrainSettings.get(centerBiome);
    }
    // Otherwise, get weighted average of properties from this and surrounding biomes
    TerrainSettings settings = new TerrainSettings();
    for (int i = -2; i <= 2; ++i) {
        for (int j = -2; j <= 2; ++j) {
            float weight = radialFalloff5x5[i + 2 + (j + 2) * 5];
            TerrainSettings biomeSettings = this.biomeTerrainSettings.get(biomes[localX + i + 2 + (localZ + j + 2) * 10]);
            if (biomeSettings != null) {
                settings.avgHeight += weight * biomeSettings.avgHeight;
                settings.variationAbove += weight * biomeSettings.variationAbove;
                settings.variationBelow += weight * biomeSettings.variationBelow;
                settings.minHeight += weight * biomeSettings.minHeight;
                settings.maxHeight += weight * biomeSettings.maxHeight;
                settings.sidewaysNoiseAmount += weight * biomeSettings.sidewaysNoiseAmount;
                for (int k = 0; k < settings.octaveWeights.length; k++) {
                    settings.octaveWeights[k] += weight * biomeSettings.octaveWeights[k];
                }
            }
        }
    }
    return settings;
}
Also used : BOPOverworldBiome(biomesoplenty.common.biome.overworld.BOPOverworldBiome) Biome(net.minecraft.world.biome.Biome) BOPOverworldBiome(biomesoplenty.common.biome.overworld.BOPOverworldBiome)

Aggregations

BOPOverworldBiome (biomesoplenty.common.biome.overworld.BOPOverworldBiome)1 Biome (net.minecraft.world.biome.Biome)1