minecraft-source/src/net/minecraft/world/item/LingeringPotionItem.java

30 lines
1.2 KiB
Java

package net.minecraft.world.item;
import net.minecraft.sounds.SoundSource;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.alchemy.PotionUtils;
import net.minecraft.network.chat.Component;
import java.util.List;
import javax.annotation.Nullable;
import net.minecraft.world.level.Level;
public class LingeringPotionItem extends ThrowablePotionItem {
public LingeringPotionItem(final Properties a) {
super(a);
}
@Override
public void appendHoverText(final ItemStack bek, @Nullable final Level bjt, final List<Component> list, final TooltipFlag bft) {
PotionUtils.addPotionTooltip(bek, list, 0.25f);
}
@Override
public InteractionResultHolder<ItemStack> use(final Level bjt, final Player ayg, final InteractionHand ajh) {
bjt.playSound(null, ayg.getX(), ayg.getY(), ayg.getZ(), SoundEvents.LINGERING_POTION_THROW, SoundSource.NEUTRAL, 0.5f, 0.4f / (LingeringPotionItem.random.nextFloat() * 0.4f + 0.8f));
return super.use(bjt, ayg, ajh);
}
}