File tree Expand file tree Collapse file tree 5 files changed +23
-13
lines changed
gui/impl/clickgui/buttons/setting Expand file tree Collapse file tree 5 files changed +23
-13
lines changed Original file line number Diff line number Diff line change 1+ package com.lambda.core
2+
3+ import com.lambda.core.SoundManager.toIdentifier
4+ import net.minecraft.sound.SoundEvent
5+ import net.minecraft.util.Identifier
6+
7+ enum class LambdaSound (val id : Identifier ) {
8+ MODULE_TOGGLE (" module_toggle" .toIdentifier());
9+
10+ val event: SoundEvent = SoundEvent .of(id)
11+ }
Original file line number Diff line number Diff line change 11package com.lambda.core
22
33import com.lambda.Lambda
4- import com.lambda.context.SafeContext
4+ import com.lambda.Lambda.mc
55import net.minecraft.client.sound.PositionedSoundInstance
66import net.minecraft.registry.Registries
77import net.minecraft.registry.Registry
@@ -18,17 +18,11 @@ object SoundManager : Loadable {
1818 return " Loaded ${LambdaSound .entries.size} sounds"
1919 }
2020
21- enum class LambdaSound (val id : Identifier ) {
22- MODULE_TOGGLE (" module_toggle" .toIdentifier());
23-
24- val event: SoundEvent = SoundEvent .of(id)
25- }
26-
27- fun SafeContext.playSound (event : SoundEvent , pitch : Float = 1.0f) {
21+ fun playSound (event : SoundEvent , pitch : Float = 1.0f) {
2822 mc.soundManager.play(
2923 PositionedSoundInstance .master(event, pitch)
3024 )
3125 }
3226
33- private fun String.toIdentifier () = Identifier (" ${ Lambda .MOD_ID } : ${ this } " )
27+ fun String.toIdentifier () = Identifier (Lambda .MOD_ID , this )
3428}
Original file line number Diff line number Diff line change 11package com.lambda.gui.impl.clickgui.buttons.setting
22
33import com.lambda.config.settings.comparable.BooleanSetting
4+ import com.lambda.core.LambdaSound
45import com.lambda.core.SoundManager
56import com.lambda.core.SoundManager.playSound
67import com.lambda.graphics.animation.Animation.Companion.exp
78import com.lambda.gui.api.GuiEvent
89import com.lambda.gui.api.component.core.list.ChildLayer
910import com.lambda.gui.impl.clickgui.buttons.SettingButton
1011import com.lambda.module.modules.client.GuiSettings
11- import com.lambda.threading.runSafe
1212import com.lambda.util.Mouse
1313import com.lambda.util.math.ColorUtils.setAlpha
1414import com.lambda.util.math.MathUtils.lerp
@@ -50,8 +50,6 @@ class BooleanButton(
5050
5151 override fun performClickAction (e : GuiEvent .MouseClick ) {
5252 if (e.button == Mouse .Button .Left ) value = ! value
53- runSafe {
54- playSound(SoundManager .LambdaSound .MODULE_TOGGLE .event)
55- }
53+ playSound(LambdaSound .MODULE_TOGGLE .event)
5654 }
5755}
Original file line number Diff line number Diff line change 1+ {
2+ "module_toggle" : {
3+ "sounds" : [
4+ " lambda:ui/module_toggle"
5+ ]
6+ }
7+ }
File renamed without changes.
You can’t perform that action at this time.
0 commit comments