Merge pull request #4018 from starlottemusic/patch-2

Scroll Tick sound in GUIs
This commit is contained in:
simibubi 2022-12-07 17:35:12 +01:00 committed by GitHub
commit 3d8a147d79
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 java.util.function.Function;
import com.simibubi.create.AllKeys; 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.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour.StepContext;
import com.simibubi.create.foundation.utility.Components; import com.simibubi.create.foundation.utility.Components;
import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Lang;
import net.minecraft.ChatFormatting; 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.Component;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
@ -124,8 +127,10 @@ public class ScrollInput extends AbstractSimiWidget {
clampState(); 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(); onChanged();
}
return priorState != state; return priorState != state;
} }