Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package yaboichips.modname.classes;
- import net.minecraft.client.audio.SimpleSound;
- import net.minecraft.client.audio.SoundHandler;
- import net.minecraft.client.audio.TickableSound;
- import net.minecraft.client.audio.UnderwaterAmbientSounds;
- import net.minecraft.client.entity.player.ClientPlayerEntity;
- import net.minecraft.util.SoundCategory;
- import net.minecraft.util.SoundEvents;
- import yaboichips.modname.lists.ItemList;
- import yaboichips.modname.lists.SoundList;
- public class SaberSoundEvent extends TickableSound {
- private final ClientPlayerEntity player;
- private final SoundHandler soundHandler;
- private int delay = 0;
- public SaberSoundEvent(ClientPlayerEntity player, SoundHandler soundHandlerIn) {
- super(SoundList.BUZZ, SoundCategory.NEUTRAL);
- this.player = player;
- this.soundHandler = soundHandlerIn;
- this.repeat = true;
- this.repeatDelay = 0;
- this.volume = 0.1F;
- }
- public void tick() {
- if (this.player.getHeldItemMainhand().getItem() == ItemList.blue_lightsaber) {
- this.delay = 0;
- this.soundHandler.play(new SaberSound.SubSound(this.player, SoundList.BUZZ));
- } else {
- this.donePlaying = true;
- }
- }
- }
Add Comment
Please, Sign In to add comment