29 lines
788 B
Java
29 lines
788 B
Java
package net.minecraft.world.item;
|
|
|
|
import net.minecraft.sounds.SoundEvents;
|
|
import net.minecraft.sounds.SoundSource;
|
|
import net.minecraft.world.InteractionHand;
|
|
import net.minecraft.world.InteractionResult;
|
|
import net.minecraft.world.entity.player.Player;
|
|
import net.minecraft.world.level.Level;
|
|
|
|
public class SplashPotionItem extends ThrowablePotionItem {
|
|
public SplashPotionItem(Item.Properties properties) {
|
|
super(properties);
|
|
}
|
|
|
|
@Override
|
|
public InteractionResult use(Level level, Player player, InteractionHand hand) {
|
|
level.playSound(
|
|
null,
|
|
player.getX(),
|
|
player.getY(),
|
|
player.getZ(),
|
|
SoundEvents.SPLASH_POTION_THROW,
|
|
SoundSource.PLAYERS,
|
|
0.5F,
|
|
0.4F / (level.getRandom().nextFloat() * 0.4F + 0.8F)
|
|
);
|
|
return super.use(level, player, hand);
|
|
}
|
|
}
|