package net.minecraft.client.renderer.entity;

import net.minecraft.world.entity.Entity;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.client.renderer.block.BlockRenderDispatcher;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.BlockAndTintGetter;
import net.minecraft.client.renderer.texture.OverlayTexture;
import java.util.Random;
import net.minecraft.client.renderer.ItemBlockRenderTypes;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.RenderShape;
import net.minecraft.client.renderer.MultiBufferSource;
import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.world.entity.item.FallingBlockEntity;

public class FallingBlockRenderer extends EntityRenderer<FallingBlockEntity> {
    public FallingBlockRenderer(final EntityRenderDispatcher egm) {
        super(egm);
        this.shadowRadius = 0.5f;
    }
    
    @Override
    public void render(final FallingBlockEntity bbf, final float float2, final float float3, final PoseStack dhl, final MultiBufferSource ebz, final int integer) {
        final BlockState cfj8 = bbf.getBlockState();
        if (cfj8.getRenderShape() != RenderShape.MODEL) {
            return;
        }
        final Level bqb9 = bbf.getLevel();
        if (cfj8 == bqb9.getBlockState(bbf.blockPosition()) || cfj8.getRenderShape() == RenderShape.INVISIBLE) {
            return;
        }
        dhl.pushPose();
        final BlockPos fu10 = new BlockPos(bbf.getX(), bbf.getBoundingBox().maxY, bbf.getZ());
        dhl.translate(-0.5, 0.0, -0.5);
        final BlockRenderDispatcher ecq11 = Minecraft.getInstance().getBlockRenderer();
        ecq11.getModelRenderer().tesselateBlock(bqb9, ecq11.getBlockModel(cfj8), cfj8, fu10, dhl, ebz.getBuffer(ItemBlockRenderTypes.getMovingBlockRenderType(cfj8)), false, new Random(), cfj8.getSeed(bbf.getStartPos()), OverlayTexture.NO_OVERLAY);
        dhl.popPose();
        super.render(bbf, float2, float3, dhl, ebz, integer);
    }
    
    @Override
    public ResourceLocation getTextureLocation(final FallingBlockEntity bbf) {
        return TextureAtlas.LOCATION_BLOCKS;
    }
}
