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> eid) {
        this.renderer = eid;
    }
    
    protected static <T extends LivingEntity> void coloredCutoutModelCopyLayerRender(final EntityModel<T> dvv1, final EntityModel<T> dvv2, final ResourceLocation uh, final PoseStack dhl, final MultiBufferSource ebz, final int integer, final T aoy, 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 (!aoy.isInvisible()) {
            dvv1.copyPropertiesTo(dvv2);
            dvv2.prepareMobModel(aoy, float8, float9, float13);
            dvv2.setupAnim(aoy, float8, float9, float10, float11, float12);
            RenderLayer.<T>renderColoredCutoutModel(dvv2, uh, dhl, ebz, integer, aoy, float14, float15, float16);
        }
    }
    
    protected static <T extends LivingEntity> void renderColoredCutoutModel(final EntityModel<T> dvv, final ResourceLocation uh, final PoseStack dhl, final MultiBufferSource ebz, final int integer, final T aoy, final float float7, final float float8, final float float9) {
        final VertexConsumer dhp10 = ebz.getBuffer(RenderType.entityCutoutNoCull(uh));
        dvv.renderToBuffer(dhl, dhp10, integer, LivingEntityRenderer.getOverlayCoords(aoy, 0.0f), float7, float8, float9, 1.0f);
    }
    
    public M getParentModel() {
        return this.renderer.getModel();
    }
    
    protected ResourceLocation getTextureLocation(final T aom) {
        return this.renderer.getTextureLocation(aom);
    }
    
    public abstract void render(final PoseStack dhl, final MultiBufferSource ebz, final int integer, final T aom, final float float5, final float float6, final float float7, final float float8, final float float9, final float float10);
}
