package net.minecraft.client.renderer.entity;

import net.minecraft.world.entity.LivingEntity;
import java.util.Iterator;
import java.util.List;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.entity.Entity;
import net.minecraft.core.BlockPos;
import net.minecraft.util.Mth;
import com.mojang.math.Vector3f;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.entity.layers.RenderLayer;
import net.minecraft.client.renderer.entity.layers.CatCollarLayer;
import net.minecraft.client.model.CatModel;
import net.minecraft.world.entity.animal.Cat;

public class CatRenderer extends MobRenderer<Cat, CatModel<Cat>> {
    public CatRenderer(final EntityRenderDispatcher dvf) {
        super(dvf, new CatModel(0.0f), 0.4f);
        this.addLayer(new CatCollarLayer(this));
    }
    
    @Override
    public ResourceLocation getTextureLocation(final Cat ate) {
        return ate.getResourceLocation();
    }
    
    @Override
    protected void scale(final Cat ate, final PoseStack cyl, final float float3) {
        super.scale(ate, cyl, float3);
        cyl.scale(0.8f, 0.8f, 0.8f);
    }
    
    @Override
    protected void setupRotations(final Cat ate, final PoseStack cyl, final float float3, final float float4, final float float5) {
        super.setupRotations(ate, cyl, float3, float4, float5);
        final float float6 = ate.getLieDownAmount(float5);
        if (float6 > 0.0f) {
            cyl.translate(0.4f * float6, 0.15f * float6, 0.1f * float6);
            cyl.mulPose(Vector3f.ZP.rotationDegrees(Mth.rotLerp(float6, 0.0f, 90.0f)));
            final BlockPos fk8 = new BlockPos(ate);
            final List<Player> list9 = ate.level.<Player>getEntitiesOfClass(Player.class, new AABB(fk8).inflate(2.0, 2.0, 2.0));
            for (final Player ayj11 : list9) {
                if (ayj11.isSleeping()) {
                    cyl.translate(0.15f * float6, 0.0, 0.0);
                    break;
                }
            }
        }
    }
}
