package com.acethewildfire.acesbs.item.custom;

import com.acethewildfire.acesbs.AcesBS;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.recipe.RecipeEntry;
import net.minecraft.recipe.RecipeType;
import net.minecraft.recipe.SmeltingRecipe;
import net.minecraft.recipe.input.SingleStackRecipeInput;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;

import java.util.List;
import java.util.Optional;


public class SmeltingPickaxe extends Item {
    public SmeltingPickaxe(Settings settings) {
        super(settings);
    }

    @Override
    public boolean postMine(ItemStack stack, World world, BlockState state, BlockPos pos, LivingEntity miner) {
        if (!world.isClient() && miner instanceof PlayerEntity player) {

            List<ItemStack> drops = Block.getDroppedStacks(state, (ServerWorld) world, pos, null, player, stack);

            for (ItemStack drop : drops) {
                stack.damage(drop.getCount(), miner, EquipmentSlot.MAINHAND);
            }
        }

        return super.postMine(stack, world, state, pos, miner);
    }
}
