package net.minecraft.world.item;

import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.level.block.Block;
import net.minecraft.tags.Tag;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.Level;

public class ShearsItem extends Item {
    public ShearsItem(final Properties a) {
        super(a);
    }
    
    @Override
    public boolean mineBlock(final ItemStack bki, final Level bqb, final BlockState cfj, final BlockPos fu, final LivingEntity aoy) {
        if (!bqb.isClientSide && !cfj.getBlock().is(BlockTags.FIRE)) {
            bki.<LivingEntity>hurtAndBreak(1, aoy, aoy -> aoy.broadcastBreakEvent(EquipmentSlot.MAINHAND));
        }
        return cfj.is(BlockTags.LEAVES) || cfj.is(Blocks.COBWEB) || cfj.is(Blocks.GRASS) || cfj.is(Blocks.FERN) || cfj.is(Blocks.DEAD_BUSH) || cfj.is(Blocks.VINE) || cfj.is(Blocks.TRIPWIRE) || cfj.is(BlockTags.WOOL) || super.mineBlock(bki, bqb, cfj, fu, aoy);
    }
    
    @Override
    public boolean isCorrectToolForDrops(final BlockState cfj) {
        return cfj.is(Blocks.COBWEB) || cfj.is(Blocks.REDSTONE_WIRE) || cfj.is(Blocks.TRIPWIRE);
    }
    
    @Override
    public float getDestroySpeed(final ItemStack bki, final BlockState cfj) {
        if (cfj.is(Blocks.COBWEB) || cfj.is(BlockTags.LEAVES)) {
            return 15.0f;
        }
        if (cfj.is(BlockTags.WOOL)) {
            return 5.0f;
        }
        return super.getDestroySpeed(bki, cfj);
    }
}
