diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e52f15..91bd160 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,3 +5,4 @@ - Updated bundle handling - Added Ukrainian translation (ttrafford7) - Added support for ItemLocks +- Added an option to change behavior of extra slots (e.g. offhand) when sorting diff --git a/common/src/main/java/dev/terminalmc/clientsort/config/Config.java b/common/src/main/java/dev/terminalmc/clientsort/config/Config.java index ef5876b..7690ada 100644 --- a/common/src/main/java/dev/terminalmc/clientsort/config/Config.java +++ b/common/src/main/java/dev/terminalmc/clientsort/config/Config.java @@ -50,6 +50,9 @@ public static class Options { public static final HotbarMode defaultHotbarMode = HotbarMode.HARD; public HotbarMode hotbarMode = defaultHotbarMode; + public static final ExtraSlotMode defaultExtraSlotMode = ExtraSlotMode.NONE; + public ExtraSlotMode extraSlotMode = defaultExtraSlotMode; + public enum HotbarMode { NONE, HARD, @@ -64,6 +67,20 @@ public String lowerName() { } } + public enum ExtraSlotMode { + NONE, + HOTBAR, + INVENTORY; + + public String lowerName() { + return switch(this) { + case NONE -> "none"; + case HOTBAR -> "hotbar"; + case INVENTORY -> "inventory"; + }; + } + } + public static final boolean defaultLmbBundle = false; public boolean lmbBundle = defaultLmbBundle; diff --git a/common/src/main/java/dev/terminalmc/clientsort/gui/screen/ClothScreenProvider.java b/common/src/main/java/dev/terminalmc/clientsort/gui/screen/ClothScreenProvider.java index da6f874..8e1f268 100644 --- a/common/src/main/java/dev/terminalmc/clientsort/gui/screen/ClothScreenProvider.java +++ b/common/src/main/java/dev/terminalmc/clientsort/gui/screen/ClothScreenProvider.java @@ -89,6 +89,17 @@ else if (val > 100) return Optional.of( .setSaveConsumer(val -> options.hotbarMode = val) .build()); + general.addEntry(eb.startEnumSelector(localized("option", "extraSlotMode"), + Config.Options.ExtraSlotMode.class, options.extraSlotMode) + .setEnumNameProvider(val -> localized("extraSlotMode", + ((Config.Options.ExtraSlotMode)val).lowerName())) + .setTooltipSupplier(val -> Optional.of(new Component[]{ + localized("extraSlotMode", val.lowerName() + ".tooltip") + })) + .setDefaultValue(Config.Options.defaultExtraSlotMode) + .setSaveConsumer(val -> options.extraSlotMode = val) + .build()); + general.addEntry(eb.startBooleanToggle(localized("option", "lmbBundle"), options.lmbBundle) .setTooltip(localized("option", "lmbBundle.tooltip")) diff --git a/common/src/main/java/dev/terminalmc/clientsort/inventory/ContainerScreenHelper.java b/common/src/main/java/dev/terminalmc/clientsort/inventory/ContainerScreenHelper.java index 1bd389a..0326b31 100644 --- a/common/src/main/java/dev/terminalmc/clientsort/inventory/ContainerScreenHelper.java +++ b/common/src/main/java/dev/terminalmc/clientsort/inventory/ContainerScreenHelper.java @@ -65,14 +65,20 @@ public int getScope(Slot slot, boolean preferSmallerScopes) { } if (screen instanceof EffectRenderingInventoryScreen) { if (slot.container instanceof Inventory) { + Config.Options options = Config.get().options; if (isHotbarSlot(slot)) { - Config.Options options = Config.get().options; if (options.hotbarMode == Config.Options.HotbarMode.HARD || options.hotbarMode == Config.Options.HotbarMode.SOFT && preferSmallerScopes) { return -1; } } else if (((ISlot) slot).mouseWheelie_getIndexInInv() >= 40) { - return -1; + if (options.extraSlotMode == Config.Options.ExtraSlotMode.NONE) { + return -2; + } else if (options.extraSlotMode == Config.Options.ExtraSlotMode.HOTBAR + && (options.hotbarMode == Config.Options.HotbarMode.HARD + || options.hotbarMode == Config.Options.HotbarMode.SOFT && preferSmallerScopes)) { + return -1; + } } return 0; } else { diff --git a/common/src/main/resources/assets/clientsort/lang/en_us.json b/common/src/main/resources/assets/clientsort/lang/en_us.json index 6b32bd8..278cdf7 100644 --- a/common/src/main/resources/assets/clientsort/lang/en_us.json +++ b/common/src/main/resources/assets/clientsort/lang/en_us.json @@ -12,6 +12,7 @@ "option.clientsort.interactionRateClient": "Singleplayer Interaction Rate", "option.clientsort.interactionRate.tooltip": "Reduce to sort faster, increase if you are experiencing packet rate issues", "option.clientsort.hotbarMode": "Hotbar Mode", + "option.clientsort.extraSlotMode": "Extra Slot Mode", "option.clientsort.lmbBundle": "Bundles use Left Click", "option.clientsort.lmbBundle.tooltip": "In 1.21.2+, bundles use left-click to load, which breaks sorting. If playing on a 1.21.2+ server, enable this option.", @@ -29,6 +30,13 @@ "hotbarMode.clientsort.off": "Off", "hotbarMode.clientsort.off.tooltip": "Hotbar cannot be sorted", + "extraSlotMode.clientsort.none": "None", + "extraSlotMode.clientsort.none.tooltip": "Extra slots will not be sortable", + "extraSlotMode.clientsort.hotbar": "Hotbar", + "extraSlotMode.clientsort.hotbar.tooltip": "Extra slots will be sorted with the hotbar", + "extraSlotMode.clientsort.inventory": "Inventory", + "extraSlotMode.clientsort.inventory.tooltip": "Extra slots will be sorted with the main inventory", + "sortOrder.clientsort.none": "None", "sortOrder.clientsort.alphabet": "Alphabet", "sortOrder.clientsort.creative": "Creative", diff --git a/common/src/main/resources/assets/clientsort/lang/ru_ru.json b/common/src/main/resources/assets/clientsort/lang/ru_ru.json index e584cd2..7bfe7fa 100644 --- a/common/src/main/resources/assets/clientsort/lang/ru_ru.json +++ b/common/src/main/resources/assets/clientsort/lang/ru_ru.json @@ -12,6 +12,7 @@ "option.clientsort.interactionRateClient": "Скорость локального взаимодействия", "option.clientsort.interactionRate.tooltip": "Уменьшите, чтобы ускорить сортировку, увеличьте, если у вас возникли проблемы со скоростью передачи пакетов", "option.clientsort.hotbarMode": "Режим горячей панели", + "option.clientsort.extraSlotMode": "Extra Slot Mode", "option.clientsort.lmbBundle": "Bundles use Right Click", "option.clientsort.lmbBundle.tooltip": "In 1.21.2+, bundles use right-click to load and unload, which breaks sorting. If playing on a 1.21.2+ server, enable this option.", @@ -29,6 +30,13 @@ "hotbarMode.clientsort.off": "Выключено", "hotbarMode.clientsort.off.tooltip": "Горячая панель не может быть отсортирована", + "extraSlotMode.clientsort.none": "None", + "extraSlotMode.clientsort.none.tooltip": "Extra slots will not be sortable", + "extraSlotMode.clientsort.hotbar": "Hotbar", + "extraSlotMode.clientsort.hotbar.tooltip": "Extra slots will be sorted with the hotbar", + "extraSlotMode.clientsort.inventory": "Inventory", + "extraSlotMode.clientsort.inventory.tooltip": "Extra slots will be sorted with the main inventory", + "sortOrder.clientsort.none": "Никакая", "sortOrder.clientsort.alphabet": "Алфавитная", "sortOrder.clientsort.creative": "Творческая", diff --git a/common/src/main/resources/assets/clientsort/lang/uk_ua.json b/common/src/main/resources/assets/clientsort/lang/uk_ua.json index 38fdb3c..7dabcf7 100644 --- a/common/src/main/resources/assets/clientsort/lang/uk_ua.json +++ b/common/src/main/resources/assets/clientsort/lang/uk_ua.json @@ -12,6 +12,7 @@ "option.clientsort.interactionRateClient": "Частота взаємодії в одиночній грі", "option.clientsort.interactionRate.tooltip": "Зменшіть для швидшого сортування, збільшіть якщо виникають проблеми з частотою пакетів", "option.clientsort.hotbarMode": "Режим панелі швидкого доступу", + "option.clientsort.extraSlotMode": "Extra Slot Mode", "option.clientsort.lmbBundle": "Bundles use Left Click", "option.clientsort.lmbBundle.tooltip": "In 1.21.2+, bundles use left-click to load, which breaks sorting. If playing on a 1.21.2+ server, enable this option.", @@ -29,6 +30,13 @@ "hotbarMode.clientsort.off": "Вимкнено", "hotbarMode.clientsort.off.tooltip": "Панель швидкого доступу не може бути відсортована", + "extraSlotMode.clientsort.none": "None", + "extraSlotMode.clientsort.none.tooltip": "Extra slots will not be sortable", + "extraSlotMode.clientsort.hotbar": "Hotbar", + "extraSlotMode.clientsort.hotbar.tooltip": "Extra slots will be sorted with the hotbar", + "extraSlotMode.clientsort.inventory": "Inventory", + "extraSlotMode.clientsort.inventory.tooltip": "Extra slots will be sorted with the main inventory", + "sortOrder.clientsort.none": "Немає", "sortOrder.clientsort.alphabet": "За алфавітом", "sortOrder.clientsort.creative": "Творчий режим", diff --git a/common/src/main/resources/assets/clientsort/lang/zh_cn.json b/common/src/main/resources/assets/clientsort/lang/zh_cn.json index e4b6b3c..97305c6 100644 --- a/common/src/main/resources/assets/clientsort/lang/zh_cn.json +++ b/common/src/main/resources/assets/clientsort/lang/zh_cn.json @@ -12,6 +12,7 @@ "option.clientsort.interactionRateClient": "单机模式交互速率", "option.clientsort.interactionRate.tooltip": "降低值可更快整理, 若遇到发包速率问题, 请将该值增加", "option.clientsort.hotbarMode": "快捷栏模式", + "option.clientsort.extraSlotMode": "Extra Slot Mode", "option.clientsort.lmbBundle": "Bundles use Right Click", "option.clientsort.lmbBundle.tooltip": "In 1.21.2+, bundles use right-click to load and unload, which breaks sorting. If playing on a 1.21.2+ server, enable this option.", @@ -29,6 +30,13 @@ "hotbarMode.clientsort.off": "关闭", "hotbarMode.clientsort.off.tooltip": "不整理快捷栏内容", + "extraSlotMode.clientsort.none": "None", + "extraSlotMode.clientsort.none.tooltip": "Extra slots will not be sortable", + "extraSlotMode.clientsort.hotbar": "Hotbar", + "extraSlotMode.clientsort.hotbar.tooltip": "Extra slots will be sorted with the hotbar", + "extraSlotMode.clientsort.inventory": "Inventory", + "extraSlotMode.clientsort.inventory.tooltip": "Extra slots will be sorted with the main inventory", + "sortOrder.clientsort.none": "无", "sortOrder.clientsort.alphabet": "字母", "sortOrder.clientsort.creative": "创造", diff --git a/common/src/main/resources/assets/clientsort/lang/zh_tw.json b/common/src/main/resources/assets/clientsort/lang/zh_tw.json index 77a8c6a..4a0aaf4 100644 --- a/common/src/main/resources/assets/clientsort/lang/zh_tw.json +++ b/common/src/main/resources/assets/clientsort/lang/zh_tw.json @@ -12,6 +12,7 @@ "option.clientsort.interactionRateClient": "單人遊戲排序速率", "option.clientsort.interactionRate.tooltip": "降低以更快排序,如果遇到封包速率問題則提高", "option.clientsort.hotbarMode": "快捷欄模式", + "option.clientsort.extraSlotMode": "Extra Slot Mode", "option.clientsort.lmbBundle": "Bundles use Right Click", "option.clientsort.lmbBundle.tooltip": "In 1.21.2+, bundles use right-click to load and unload, which breaks sorting. If playing on a 1.21.2+ server, enable this option.", @@ -29,6 +30,13 @@ "hotbarMode.clientsort.off": "停用", "hotbarMode.clientsort.off.tooltip": "快捷欄不能排序", + "extraSlotMode.clientsort.none": "None", + "extraSlotMode.clientsort.none.tooltip": "Extra slots will not be sortable", + "extraSlotMode.clientsort.hotbar": "Hotbar", + "extraSlotMode.clientsort.hotbar.tooltip": "Extra slots will be sorted with the hotbar", + "extraSlotMode.clientsort.inventory": "Inventory", + "extraSlotMode.clientsort.inventory.tooltip": "Extra slots will be sorted with the main inventory", + "sortOrder.clientsort.none": "無", "sortOrder.clientsort.alphabet": "A-Z", "sortOrder.clientsort.creative": "創造模式",