package net.minecraft.world.item;

import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;

public class ItemUtils {
    public static InteractionResultHolder<ItemStack> useDrink(final Level bqb, final Player bec, final InteractionHand anf) {
        bec.startUsingItem(anf);
        return InteractionResultHolder.<ItemStack>consume(bec.getItemInHand(anf));
    }
    
    public static ItemStack createBucketResult(final ItemStack bki1, final Player bec, final ItemStack bki3) {
        if (bec.abilities.instabuild) {
            if (!bec.inventory.contains(bki3)) {
                bec.inventory.add(bki3);
            }
            return bki1;
        }
        bki1.shrink(1);
        if (bki1.isEmpty()) {
            return bki3;
        }
        if (!bec.inventory.add(bki3)) {
            bec.drop(bki3, false);
        }
        return bki1;
    }
}
