package net.minecraft.world.level.block;

import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleTypes;
import java.util.Random;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.core.Direction;
import net.minecraft.world.phys.shapes.CollisionContext;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.shapes.VoxelShape;

public class TorchBlock extends Block {
    protected static final VoxelShape AABB;
    
    protected TorchBlock(final Properties c) {
        super(c);
    }
    
    @Override
    public VoxelShape getShape(final BlockState byj, final BlockGetter bjg, final BlockPos fk, final CollisionContext cvq) {
        return TorchBlock.AABB;
    }
    
    @Override
    public BlockState updateShape(final BlockState byj1, final Direction fp, final BlockState byj3, final LevelAccessor bjx, final BlockPos fk5, final BlockPos fk6) {
        if (fp == Direction.DOWN && !this.canSurvive(byj1, bjx, fk5)) {
            return Blocks.AIR.defaultBlockState();
        }
        return super.updateShape(byj1, fp, byj3, bjx, fk5, fk6);
    }
    
    @Override
    public boolean canSurvive(final BlockState byj, final LevelReader bjz, final BlockPos fk) {
        return Block.canSupportCenter(bjz, fk.below(), Direction.UP);
    }
    
    @Override
    public void animateTick(final BlockState byj, final Level bjw, final BlockPos fk, final Random random) {
        final double double6 = fk.getX() + 0.5;
        final double double7 = fk.getY() + 0.7;
        final double double8 = fk.getZ() + 0.5;
        bjw.addParticle(ParticleTypes.SMOKE, double6, double7, double8, 0.0, 0.0, 0.0);
        bjw.addParticle(ParticleTypes.FLAME, double6, double7, double8, 0.0, 0.0, 0.0);
    }
    
    static {
        AABB = Block.box(6.0, 0.0, 6.0, 10.0, 10.0, 10.0);
    }
}
