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 dsq) {
        super(dsq);
    }
    
    @Override
    public void render(final SpawnerBlockEntity bxk, final float float2, final PoseStack cyl, final MultiBufferSource dqt, final int integer5, final int integer6) {
        cyl.pushPose();
        cyl.translate(0.5, 0.0, 0.5);
        final BaseSpawner bjd8 = bxk.getSpawner();
        final Entity akq9 = bjd8.getOrCreateDisplayEntity();
        if (akq9 != null) {
            float float3 = 0.53125f;
            final float float4 = Math.max(akq9.getBbWidth(), akq9.getBbHeight());
            if (float4 > 1.0) {
                float3 /= float4;
            }
            cyl.translate(0.0, 0.4000000059604645, 0.0);
            cyl.mulPose(Vector3f.YP.rotationDegrees((float)Mth.lerp(float2, bjd8.getoSpin(), bjd8.getSpin()) * 10.0f));
            cyl.translate(0.0, -0.20000000298023224, 0.0);
            cyl.mulPose(Vector3f.XP.rotationDegrees(-30.0f));
            cyl.scale(float3, float3, float3);
            Minecraft.getInstance().getEntityRenderDispatcher().<Entity>render(akq9, 0.0, 0.0, 0.0, 0.0f, float2, cyl, dqt, integer5);
        }
        cyl.popPose();
    }
}
