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

import com.mojang.blaze3d.vertex.VertexConsumer;
import net.minecraft.client.renderer.entity.LivingEntityRenderer;
import net.minecraft.client.renderer.RenderType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.client.renderer.MultiBufferSource;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.model.EntityModel;
import net.minecraft.world.entity.Entity;

public abstract class RenderLayer<T extends Entity, M extends EntityModel<T>> {
    private final RenderLayerParent<T, M> renderer;
    
    public RenderLayer(final RenderLayerParent<T, M> dwv) {
        this.renderer = dwv;
    }
    
    protected static <T extends LivingEntity> void coloredCutoutModelCopyLayerRender(final EntityModel<T> dla1, final EntityModel<T> dla2, final ResourceLocation sm, final PoseStack cyl, final MultiBufferSource dqt, final int integer, final T akz, final float float8, final float float9, final float float10, final float float11, final float float12, final float float13, final float float14, final float float15, final float float16) {
        if (!akz.isInvisible()) {
            dla1.copyPropertiesTo(dla2);
            dla2.prepareMobModel(akz, float8, float9, float13);
            dla2.setupAnim(akz, float8, float9, float10, float11, float12);
            RenderLayer.<T>renderColoredCutoutModel(dla2, sm, cyl, dqt, integer, akz, float14, float15, float16);
        }
    }
    
    protected static <T extends LivingEntity> void renderColoredCutoutModel(final EntityModel<T> dla, final ResourceLocation sm, final PoseStack cyl, final MultiBufferSource dqt, final int integer, final T akz, final float float7, final float float8, final float float9) {
        final VertexConsumer cyo10 = dqt.getBuffer(RenderType.entityCutoutNoCull(sm));
        dla.renderToBuffer(cyl, cyo10, integer, LivingEntityRenderer.getOverlayCoords(akz, 0.0f), float7, float8, float9, 1.0f);
    }
    
    public M getParentModel() {
        return this.renderer.getModel();
    }
    
    protected ResourceLocation getTextureLocation(final T akq) {
        return this.renderer.getTextureLocation(akq);
    }
    
    public abstract void render(final PoseStack cyl, final MultiBufferSource dqt, final int integer, final T akq, final float float5, final float float6, final float float7, final float float8, final float float9, final float float10);
}
