package net.minecraft.client.renderer;

import net.minecraft.world.level.biome.Biome;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.world.level.ColorResolver;

public class BiomeColors {
    public static final ColorResolver GRASS_COLOR_RESOLVER;
    public static final ColorResolver FOLIAGE_COLOR_RESOLVER;
    public static final ColorResolver WATER_COLOR_RESOLVER;
    
    private static int getAverageColor(final BlockAndTintGetter bpe, final BlockPos fu, final ColorResolver colorResolver) {
        return bpe.getBlockTint(fu, colorResolver);
    }
    
    public static int getAverageGrassColor(final BlockAndTintGetter bpe, final BlockPos fu) {
        return getAverageColor(bpe, fu, BiomeColors.GRASS_COLOR_RESOLVER);
    }
    
    public static int getAverageFoliageColor(final BlockAndTintGetter bpe, final BlockPos fu) {
        return getAverageColor(bpe, fu, BiomeColors.FOLIAGE_COLOR_RESOLVER);
    }
    
    public static int getAverageWaterColor(final BlockAndTintGetter bpe, final BlockPos fu) {
        return getAverageColor(bpe, fu, BiomeColors.WATER_COLOR_RESOLVER);
    }
    
    static {
        GRASS_COLOR_RESOLVER = Biome::getGrassColor;
        FOLIAGE_COLOR_RESOLVER = ((bre, double2, double3) -> bre.getFoliageColor());
        WATER_COLOR_RESOLVER = ((bre, double2, double3) -> bre.getWaterColor());
    }
}
