Skip to content

Commit 438d16e

Browse files
committed
Fix shift-clicky.
- Reverse traversal of sort button when SHIFT is pressed (resolves #897)
1 parent 2fec0ce commit 438d16e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/main/java/com/terraformersmc/modmenu/config/option/ConfigOptionStorage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static <E extends Enum<E>> E cycleEnum(String key, Class<E> typeClass) {
5353
public static <E extends Enum<E>> E cycleEnum(String key, Class<E> typeClass, int amount) {
5454
E[] values = typeClass.getEnumConstants();
5555
E currentValue = getEnum(key, typeClass);
56-
E newValue = values[(currentValue.ordinal() + amount) % values.length];
56+
E newValue = values[(currentValue.ordinal() + values.length + amount) % values.length];
5757
setEnum(key, newValue);
5858
return newValue;
5959
}

src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ protected void init() {
152152

153153
// Sorting button
154154
this.sortingButton = ButtonWidget.builder(sortingText, button -> {
155-
ModMenuConfig.SORTING.cycleValue();
155+
ModMenuConfig.SORTING.cycleValue(this.client.isShiftPressed() ? -1 : 1);
156156
ModMenuConfigManager.save();
157157
modList.reloadFilters();
158158
button.setMessage(ModMenuConfig.SORTING.getButtonText());

0 commit comments

Comments
 (0)