package net.minecraft.world.item;

import net.minecraft.stats.Stat;
import net.minecraft.stats.Stats;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.ThrownPotion;
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 ThrowablePotionItem extends PotionItem {
    public ThrowablePotionItem(final Properties a) {
        super(a);
    }
    
    @Override
    public InteractionResultHolder<ItemStack> use(final Level bqb, final Player bec, final InteractionHand anf) {
        final ItemStack bki5 = bec.getItemInHand(anf);
        if (!bqb.isClientSide) {
            final ThrownPotion bfd6 = new ThrownPotion(bqb, bec);
            bfd6.setItem(bki5);
            bfd6.shootFromRotation(bec, bec.xRot, bec.yRot, -20.0f, 0.5f, 1.0f);
            bqb.addFreshEntity(bfd6);
        }
        bec.awardStat(Stats.ITEM_USED.get(this));
        if (!bec.abilities.instabuild) {
            bki5.shrink(1);
        }
        return InteractionResultHolder.<ItemStack>sidedSuccess(bki5, bqb.isClientSide());
    }
}
