Repository navigation
fix(ui): only play a json ui click sound when the control declares one - #71
Merged
notchyves merged 1 commit intoNov 6, 2026
Merged
Conversation
Every click on a clickable overlay element played random.click, even when the json ui control had no sound_name. Container slot buttons (container_slot_button_prototype) declare none, so moving items in chests and the inventory clicked like a menu button. Clicks now play the control's sound_name (buttons and, newly passed through, toggles), stay silent on json ui controls without one, and keep random.click for Perlin's own menu buttons.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Moving items in a chest or in the inventory plays the menu button click sound (
random.click) on every slot click. The vanilla client makes no click sound there.Cause
PerlinWorldRenderplayed a click for any pressed overlay element thatOverlayHoverIsButtonconsidered clickable. It started fromclickName = "random.click"and only overrode it with the element'ssndattribute when there was one. JSON UI slot buttons are emitted with classbt, so they always clicked.In the vanilla JSON UI (
ui/ui_common.json):button(line 79),close_button,toggle@common.toggle_visuals,inventory_selected_icon_buttonandinventory_take_progress_icon_buttondeclare"sound_name": "random.click";container_slot_button_prototype(line 4814) is a plain"type": "button"with nosound_name;Change
RmlEmit: thesnd/vol/pitattributes come from oneSoundAttrshelper, used for buttons and now also for toggles. Toggles clicked before only through the old default.RmlBackend::OverlayHoverClickSoundreplacesOverlayHoverIsButton+OverlayHoverSound. It walks up from the hovered element:snd: play that sound;bt) withoutsnd: no sound, as in vanilla;btn,sbtn,row, …):random.click, as before.PerlinWorldRenderplays only what that function returns.Testing