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

import net.minecraft.world.entity.Entity;
import com.mojang.blaze3d.vertex.VertexConsumer;
import com.mojang.math.Vector3f;
import net.minecraft.util.Mth;
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.client.model.PlayerModel;
import net.minecraft.client.player.AbstractClientPlayer;

public class Deadmau5EarsLayer extends RenderLayer<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> {
    public Deadmau5EarsLayer(final RenderLayerParent<AbstractClientPlayer, PlayerModel<AbstractClientPlayer>> eid) {
        super(eid);
    }
    
    @Override
    public void render(final PoseStack dhl, final MultiBufferSource ebz, final int integer, final AbstractClientPlayer ebc, final float float5, final float float6, final float float7, final float float8, final float float9, final float float10) {
        if (!"deadmau5".equals(ebc.getName().getString()) || !ebc.isSkinLoaded() || ebc.isInvisible()) {
            return;
        }
        final VertexConsumer dhp12 = ebz.getBuffer(RenderType.entitySolid(ebc.getSkinTextureLocation()));
        final int integer2 = LivingEntityRenderer.getOverlayCoords(ebc, 0.0f);
        for (int integer3 = 0; integer3 < 2; ++integer3) {
            final float float11 = Mth.lerp(float7, ebc.yRotO, ebc.yRot) - Mth.lerp(float7, ebc.yBodyRotO, ebc.yBodyRot);
            final float float12 = Mth.lerp(float7, ebc.xRotO, ebc.xRot);
            dhl.pushPose();
            dhl.mulPose(Vector3f.YP.rotationDegrees(float11));
            dhl.mulPose(Vector3f.XP.rotationDegrees(float12));
            dhl.translate(0.375f * (integer3 * 2 - 1), 0.0, 0.0);
            dhl.translate(0.0, -0.375, 0.0);
            dhl.mulPose(Vector3f.XP.rotationDegrees(-float12));
            dhl.mulPose(Vector3f.YP.rotationDegrees(-float11));
            final float float13 = 1.3333334f;
            dhl.scale(1.3333334f, 1.3333334f, 1.3333334f);
            ((RenderLayer<T, PlayerModel>)this).getParentModel().renderEars(dhl, dhp12, integer, integer2);
            dhl.popPose();
        }
    }
}
