From 8fbaaa60f204904bf1ebc7fa9f3f3921f7fdf2f1 Mon Sep 17 00:00:00 2001 From: starlottemusic <65743811+starlottemusic@users.noreply.github.com> Date: Mon, 14 Nov 2022 17:37:47 -0500 Subject: [PATCH] Scroll Tick sound in GUIs Added the Scroll Tick sound to ScrollInput boxes within GUIs for consistency with in-world scroll boxes. --- .../simibubi/create/foundation/gui/widget/ScrollInput.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/foundation/gui/widget/ScrollInput.java b/src/main/java/com/simibubi/create/foundation/gui/widget/ScrollInput.java index 4f810c3ab..02589aa85 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widget/ScrollInput.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widget/ScrollInput.java @@ -4,11 +4,14 @@ import java.util.function.Consumer; import java.util.function.Function; import com.simibubi.create.AllKeys; +import com.simibubi.create.AllSoundEvents; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour.StepContext; import com.simibubi.create.foundation.utility.Components; import com.simibubi.create.foundation.utility.Lang; import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.resources.sounds.SimpleSoundInstance; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; @@ -124,8 +127,10 @@ public class ScrollInput extends AbstractSimiWidget { clampState(); - if (priorState != state) + if (priorState != state) { + Minecraft.getInstance().getSoundManager().play(SimpleSoundInstance.forUI(AllSoundEvents.SCROLL_VALUE.getMainEvent(), 1.5f + 0.1f * (state-min)/(max-min))); onChanged(); + } return priorState != state; }