Guest User

Untitled

a guest
May 20th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. package yaboichips.modname.classes;
  2.  
  3. import net.minecraft.client.audio.SimpleSound;
  4. import net.minecraft.client.audio.SoundHandler;
  5. import net.minecraft.client.audio.TickableSound;
  6. import net.minecraft.client.audio.UnderwaterAmbientSounds;
  7. import net.minecraft.client.entity.player.ClientPlayerEntity;
  8. import net.minecraft.util.SoundCategory;
  9. import net.minecraft.util.SoundEvents;
  10. import yaboichips.modname.lists.ItemList;
  11. import yaboichips.modname.lists.SoundList;
  12.  
  13.  
  14. public class SaberSoundEvent extends TickableSound {
  15. private final ClientPlayerEntity player;
  16. private final SoundHandler soundHandler;
  17. private int delay = 0;
  18.  
  19. public SaberSoundEvent(ClientPlayerEntity player, SoundHandler soundHandlerIn) {
  20. super(SoundList.BUZZ, SoundCategory.NEUTRAL);
  21. this.player = player;
  22. this.soundHandler = soundHandlerIn;
  23. this.repeat = true;
  24. this.repeatDelay = 0;
  25. this.volume = 0.1F;
  26. }
  27.  
  28. public void tick() {
  29. if (this.player.getHeldItemMainhand().getItem() == ItemList.blue_lightsaber) {
  30. this.delay = 0;
  31. this.soundHandler.play(new SaberSound.SubSound(this.player, SoundList.BUZZ));
  32. } else {
  33. this.donePlaying = true;
  34. }
  35. }
  36. }
Add Comment
Please, Sign In to add comment