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

import net.minecraft.world.entity.Entity;
import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.model.EntityModel;
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.client.model.PigModel;
import net.minecraft.world.entity.animal.Pig;

public class PigSaddleLayer extends RenderLayer<Pig, PigModel<Pig>> {
    private static final ResourceLocation SADDLE_LOCATION;
    private final PigModel<Pig> model;
    
    public PigSaddleLayer(final RenderLayerParent<Pig, PigModel<Pig>> dwv) {
        super(dwv);
        this.model = new PigModel<Pig>(0.5f);
    }
    
    @Override
    public void render(final PoseStack cyl, final MultiBufferSource dqt, final int integer, final Pig atq, final float float5, final float float6, final float float7, final float float8, final float float9, final float float10) {
        if (!atq.hasSaddle()) {
            return;
        }
        ((RenderLayer<T, PigModel<Pig>>)this).getParentModel().copyPropertiesTo(this.model);
        this.model.prepareMobModel(atq, float5, float6, float7);
        this.model.setupAnim(atq, float5, float6, float8, float9, float10);
        final VertexConsumer cyo12 = dqt.getBuffer(RenderType.entityCutoutNoCull(PigSaddleLayer.SADDLE_LOCATION));
        this.model.renderToBuffer(cyl, cyo12, integer, OverlayTexture.NO_OVERLAY, 1.0f, 1.0f, 1.0f, 1.0f);
    }
    
    static {
        SADDLE_LOCATION = new ResourceLocation("textures/entity/pig/pig_saddle.png");
    }
}
