package net.minecraft.client.renderer.blockentity;

import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.BaseSpawner;
import net.minecraft.world.entity.Entity;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Mth;
import com.mojang.math.Vector3f;
import net.minecraft.client.renderer.MultiBufferSource;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.world.level.block.entity.SpawnerBlockEntity;

public class SpawnerRenderer extends BlockEntityRenderer<SpawnerBlockEntity> {
    public SpawnerRenderer(final BlockEntityRenderDispatcher edw) {
        super(edw);
    }
    
    @Override
    public void render(final SpawnerBlockEntity cek, final float float2, final PoseStack dhl, final MultiBufferSource ebz, final int integer5, final int integer6) {
        dhl.pushPose();
        dhl.translate(0.5, 0.0, 0.5);
        final BaseSpawner bpd8 = cek.getSpawner();
        final Entity aom9 = bpd8.getOrCreateDisplayEntity();
        if (aom9 != null) {
            float float3 = 0.53125f;
            final float float4 = Math.max(aom9.getBbWidth(), aom9.getBbHeight());
            if (float4 > 1.0) {
                float3 /= float4;
            }
            dhl.translate(0.0, 0.4000000059604645, 0.0);
            dhl.mulPose(Vector3f.YP.rotationDegrees((float)Mth.lerp(float2, bpd8.getoSpin(), bpd8.getSpin()) * 10.0f));
            dhl.translate(0.0, -0.20000000298023224, 0.0);
            dhl.mulPose(Vector3f.XP.rotationDegrees(-30.0f));
            dhl.scale(float3, float3, float3);
            Minecraft.getInstance().getEntityRenderDispatcher().<Entity>render(aom9, 0.0, 0.0, 0.0, 0.0f, float2, dhl, ebz, integer5);
        }
        dhl.popPose();
    }
}
