Matt-MX / KtPaperGui

Declarative GUI focused library for PaperMC. Made for personal use but open source enjoy! :)
Apache License 2.0
28 stars 5 forks source link

Sound builder #23

Closed Matt-MX closed 3 months ago

Matt-MX commented 5 months ago

Ability to chain sounds together for more complex sound feedback.

Kotlin

val custom = soundBuilder {
  emitter(self)
  location { player.location.clone().add(0.0, 100.0, 0.0) } 

  play(someSoundKey) volume 1.0 pitch 2.0 relative true
  wait(1.tick)
  play(someOtherSoundKey) volume 2.0 pitch 0.0 emitter self
}

// ...
player.playSound(custom)

Java

SoundBuilder custom = new SoundBuilder()
  .play(Sound.of(someSoundKey).volume(1.0).pitch(2.0).relative())
  .wait(1L)
  .play(Sound.of(someOtherSoundKey).volue(2.0).pitch(0.0).relative());

// ...
custom.playSound(player);