Skip to content

Commit

Permalink
Fix cycling controls not playing a sound when activated using the key…
Browse files Browse the repository at this point in the history
…board

Fixes #2309
  • Loading branch information
haykam821 authored and MeeniMc committed Oct 22, 2024
1 parent 37dc5f6 commit 9cba24e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (this.option.isAvailable() && button == 0 && this.dim.containsCursor(mouseX, mouseY)) {
cycleControl(Screen.hasShiftDown());
this.playClickSound();

return true;
}

Expand All @@ -120,7 +118,9 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
return false;
}

public void cycleControl(boolean reverse) {
private void cycleControl(boolean reverse) {
this.playClickSound();

if (reverse) {
this.currentIndex = (this.currentIndex + this.allowedValues.length - 1) % this.allowedValues.length;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,6 @@ public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (this.option.isAvailable() && button == 0 && this.dim.containsCursor(mouseX, mouseY)) {
toggleControl();
this.playClickSound();

return true;
}

Expand All @@ -82,15 +80,14 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {

if (CommonInputs.selected(keyCode)) {
toggleControl();
this.playClickSound();

return true;
}

return false;
}

public void toggleControl() {
private void toggleControl() {
this.playClickSound();
this.option.setValue(!this.option.getValue());
}
}
Expand Down

0 comments on commit 9cba24e

Please sign in to comment.