Scroll Tick sound in GUIs

Added the Scroll Tick sound to ScrollInput boxes within GUIs for consistency with in-world scroll boxes.
This commit is contained in:
starlottemusic 2022-11-14 17:37:47 -05:00 committed by GitHub
parent cf87508276
commit 8fbaaa60f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
}