Skip to content

fix(ui): only play a json ui click sound when the control declares one - #71

Merged
notchyves merged 1 commit into
theselauraproject:mainfrom
NaySurGithub:fix/slot-click-sound
Nov 6, 2026
Merged

notchyves merged 1 commit into
theselauraproject:mainfrom
NaySurGithub:fix/slot-click-sound

Conversation

@NaySurGithub

Copy link
Copy Markdown
Contributor

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

PerlinWorldRender played a click for any pressed overlay element that OverlayHoverIsButton considered clickable. It started from clickName = "random.click" and only overrode it with the element's snd attribute when there was one. JSON UI slot buttons are emitted with class bt, 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_button and inventory_take_progress_icon_button declare "sound_name": "random.click";
  • container_slot_button_prototype (line 4814) is a plain "type": "button" with no sound_name;
  • sliders and edit boxes declare none either.

Change

  • RmlEmit: the snd / vol / pit attributes come from one SoundAttrs helper, used for buttons and now also for toggles. Toggles clicked before only through the old default.
  • RmlBackend::OverlayHoverClickSound replaces OverlayHoverIsButton + OverlayHoverSound. It walks up from the hovered element:
    • an element with snd: play that sound;
    • a JSON UI control (bt) without snd: no sound, as in vanilla;
    • one of Perlin's own menu buttons (btn, sbtn, row, …): random.click, as before.
  • PerlinWorldRender plays only what that function returns.

Testing

  • macOS arm64 Release build.
  • In game: no click when moving items in the inventory or a chest; menu buttons, server screen buttons and toggles still click.

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.
@notchyves
notchyves merged commit 561dac6 into theselauraproject:main Nov 6, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants