package net.minecraft.client.renderer.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.world.entity.Entity;
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 dvf) {
        super(dvf);
        this.shadowRadius = 0.5f;
    }
    
    @Override
    public void render(final FallingBlockEntity awa, final float float2, final float float3, final PoseStack cyl, final MultiBufferSource dqt, final int integer) {
        final BlockState byj8 = awa.getBlockState();
        if (byj8.getRenderShape() != RenderShape.MODEL) {
            return;
        }
        final Level bjw9 = awa.getLevel();
        if (byj8 == bjw9.getBlockState(new BlockPos(awa)) || byj8.getRenderShape() == RenderShape.INVISIBLE) {
            return;
        }
        cyl.pushPose();
        final BlockPos fk10 = new BlockPos(awa.getX(), awa.getBoundingBox().maxY, awa.getZ());
        cyl.translate(-0.5, 0.0, -0.5);
        final BlockRenderDispatcher drk11 = Minecraft.getInstance().getBlockRenderer();
        drk11.getModelRenderer().tesselateBlock(bjw9, drk11.getBlockModel(byj8), byj8, fk10, cyl, dqt.getBuffer(ItemBlockRenderTypes.getChunkRenderType(byj8)), false, new Random(), byj8.getSeed(awa.getStartPos()), OverlayTexture.NO_OVERLAY);
        cyl.popPose();
        super.render(awa, float2, float3, cyl, dqt, integer);
    }
    
    @Override
    public ResourceLocation getTextureLocation(final FallingBlockEntity awa) {
        return TextureAtlas.LOCATION_BLOCKS;
    }
}
