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 bje, final BlockPos fk, final ColorResolver colorResolver) {
        return bje.getBlockTint(fk, colorResolver);
    }
    
    public static int getAverageGrassColor(final BlockAndTintGetter bje, final BlockPos fk) {
        return getAverageColor(bje, fk, BiomeColors.GRASS_COLOR_RESOLVER);
    }
    
    public static int getAverageFoliageColor(final BlockAndTintGetter bje, final BlockPos fk) {
        return getAverageColor(bje, fk, BiomeColors.FOLIAGE_COLOR_RESOLVER);
    }
    
    public static int getAverageWaterColor(final BlockAndTintGetter bje, final BlockPos fk) {
        return getAverageColor(bje, fk, BiomeColors.WATER_COLOR_RESOLVER);
    }
    
    static {
        GRASS_COLOR_RESOLVER = Biome::getGrassColor;
        FOLIAGE_COLOR_RESOLVER = ((bkt, double2, double3) -> bkt.getFoliageColor());
        WATER_COLOR_RESOLVER = ((bkt, double2, double3) -> bkt.getWaterColor());
    }
}
