package net.minecraft.client.renderer.entity.layers;

import net.minecraft.Util;
import com.google.common.collect.Maps;
import java.util.EnumMap;
import net.minecraft.world.entity.Entity;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.MultiBufferSource;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.animal.horse.Markings;
import java.util.Map;
import net.minecraft.client.model.HorseModel;
import net.minecraft.world.entity.animal.horse.Horse;

public class HorseMarkingLayer extends RenderLayer<Horse, HorseModel<Horse>> {
    private static final Map<Markings, ResourceLocation> LOCATION_BY_MARKINGS;
    
    public HorseMarkingLayer(final RenderLayerParent<Horse, HorseModel<Horse>> eid) {
        super(eid);
    }
    
    @Override
    public void render(final PoseStack dhl, final MultiBufferSource ebz, final int integer, final Horse azo, final float float5, final float float6, final float float7, final float float8, final float float9, final float float10) {
        final ResourceLocation uh12 = HorseMarkingLayer.LOCATION_BY_MARKINGS.get(azo.getMarkings());
        if (uh12 == null || azo.isInvisible()) {
            return;
        }
        final VertexConsumer dhp13 = ebz.getBuffer(RenderType.entityTranslucent(uh12));
        ((RenderLayer<T, HorseModel>)this).getParentModel().renderToBuffer(dhl, dhp13, integer, LivingEntityRenderer.getOverlayCoords(azo, 0.0f), 1.0f, 1.0f, 1.0f, 1.0f);
    }
    
    static {
        LOCATION_BY_MARKINGS = Util.<Map<Markings, ResourceLocation>>make(Maps.newEnumMap(Markings.class), enumMap -> {
            enumMap.put(Markings.NONE, null);
            enumMap.put(Markings.WHITE, new ResourceLocation("textures/entity/horse/horse_markings_white.png"));
            enumMap.put(Markings.WHITE_FIELD, new ResourceLocation("textures/entity/horse/horse_markings_whitefield.png"));
            enumMap.put(Markings.WHITE_DOTS, new ResourceLocation("textures/entity/horse/horse_markings_whitedots.png"));
            enumMap.put(Markings.BLACK_DOTS, new ResourceLocation("textures/entity/horse/horse_markings_blackdots.png"));
        });
    }
}
