diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-04-13 16:22:09 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2022-04-13 16:22:09 +0800 |
| commit | 7353154ff0e24606e864147c034acd29056e2161 (patch) | |
| tree | 75d220ceeb472596f594967a2568f70a9f733c3e /runtime/src/main | |
| parent | 9bd86550edcd67c5092d7e6846ff81da495a47bd (diff) | |
| download | RoughlyEnoughItems-7353154ff0e24606e864147c034acd29056e2161.tar.gz RoughlyEnoughItems-7353154ff0e24606e864147c034acd29056e2161.tar.bz2 RoughlyEnoughItems-7353154ff0e24606e864147c034acd29056e2161.zip | |
Add option to disable compact arrows
Diffstat (limited to 'runtime/src/main')
4 files changed, 24 insertions, 8 deletions
diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java index 76c7e269c..968cf4148 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/config/ConfigObjectImpl.java @@ -357,6 +357,11 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { } @Override + public boolean isUsingCompactTabButtons() { + return advanced.accessibility.useCompactTabButtons; + } + + @Override public boolean isLowerConfigButton() { return appearance.layout.configButtonLocation == ConfigButtonPosition.LOWER; } @@ -521,7 +526,8 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { public static class Basics { @ConfigEntry.Gui.Excluded public List<FavoriteEntry> favorites = new ArrayList<>(); - @Comment("Declares whether cheating mode is on.") @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) private CheatingMode cheating = CheatingMode.OFF; + @Comment("Declares whether cheating mode is on.") @ConfigEntry.Gui.EnumHandler(option = ConfigEntry.Gui.EnumHandler.EnumDisplayOption.BUTTON) + private CheatingMode cheating = CheatingMode.OFF; private boolean favoritesEnabled = true; @ConfigEntry.Gui.CollapsibleObject(startExpanded = true) private KeyBindings keyBindings = new KeyBindings(); @@ -631,6 +637,7 @@ public class ConfigObjectImpl implements ConfigObject, ConfigData { @Comment("Declares how the scrollbar in composite screen should act.") private boolean compositeScrollBarPermanent = false; private boolean toastDisplayedOnCopyIdentifier = true; @Comment("Declares whether REI should use compact tabs for categories.") private boolean useCompactTabs = true; + @Comment("Declares whether REI should use compact tab buttons for categories.") private boolean useCompactTabButtons = true; } public static class Search { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java index b1f131197..1613d7f18 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/CompositeDisplayViewingScreen.java @@ -108,6 +108,8 @@ public class CompositeDisplayViewingScreen extends AbstractDisplayViewingScreen public void init() { super.init(); boolean isCompactTabs = ConfigObject.getInstance().isUsingCompactTabs(); + boolean isCompactTabButtons = ConfigObject.getInstance().isUsingCompactTabButtons(); + int tabButtonsSize = isCompactTabButtons ? 10 : 16; int tabSize = isCompactTabs ? 24 : 28; this.children().clear(); this.widgets.clear(); @@ -120,7 +122,7 @@ public class CompositeDisplayViewingScreen extends AbstractDisplayViewingScreen DisplaySpec display = categoryMap.get(category).get(selectedRecipeIndex); int guiWidth = Mth.clamp(category.getDisplayWidth(display.provideInternalDisplay()) + 30, 0, largestWidth) + 100; int guiHeight = Mth.clamp(category.getDisplayHeight() + 40, 166, largestHeight); - this.tabsPerPage = Math.max(5, Mth.floor((guiWidth - 20d) / tabSize)); + this.tabsPerPage = Math.max(5, Mth.floor((guiWidth - tabButtonsSize * 2d) / tabSize)); if (this.tabsPage == -1) { this.tabsPage = selectedCategoryIndex / tabsPerPage; } @@ -207,21 +209,23 @@ public class CompositeDisplayViewingScreen extends AbstractDisplayViewingScreen tab.setRenderer(tabCategory, tabCategory.getIcon(), tabCategory.getTitle(), j == selectedCategoryIndex); } } - this.widgets.add(Widgets.createButton(new Rectangle(bounds.x + 2, bounds.y - 16, 10, 10), new TranslatableComponent("text.rei.left_arrow")) + this.widgets.add(Widgets.createButton(new Rectangle(bounds.x + 2, bounds.y - (isCompactTabButtons ? 16 : 20), tabButtonsSize, tabButtonsSize), new TranslatableComponent("text.rei.left_arrow")) .onClick(button -> { tabsPage--; if (tabsPage < 0) tabsPage = Mth.ceil(categories.size() / (float) tabsPerPage) - 1; CompositeDisplayViewingScreen.this.init(); }) + .tooltipLine(new TranslatableComponent("text.rei.previous_page")) .enabled(categories.size() > tabsPerPage)); - this.widgets.add(Widgets.createButton(new Rectangle(bounds.x + bounds.width - 12, bounds.y - 16, 10, 10), new TranslatableComponent("text.rei.right_arrow")) + this.widgets.add(Widgets.createButton(new Rectangle(bounds.x + bounds.width - (isCompactTabButtons ? tabButtonsSize + 2 : tabButtonsSize + 3), bounds.y - (isCompactTabButtons ? 16 : 20), tabButtonsSize, tabButtonsSize), new TranslatableComponent("text.rei.right_arrow")) .onClick(button -> { tabsPage++; if (tabsPage > Mth.ceil(categories.size() / (float) tabsPerPage) - 1) tabsPage = 0; CompositeDisplayViewingScreen.this.init(); }) + .tooltipLine(new TranslatableComponent("text.rei.next_page")) .enabled(categories.size() > tabsPerPage)); this.widgets.add(Widgets.createClickableLabel(new Point(bounds.x + 4 + scrollListBounds.width / 2, bounds.y + 6), categories.get(selectedCategoryIndex).getTitle(), label -> { diff --git a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java index 47f914e5d..a5ea0a957 100644 --- a/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java +++ b/runtime/src/main/java/me/shedaniel/rei/impl/client/gui/screen/DefaultDisplayViewingScreen.java @@ -162,28 +162,32 @@ public class DefaultDisplayViewingScreen extends AbstractDisplayViewingScreen { } boolean isCompactTabs = ConfigObject.getInstance().isUsingCompactTabs(); + boolean isCompactTabButtons = ConfigObject.getInstance().isUsingCompactTabButtons(); + int tabButtonsSize = isCompactTabButtons ? 10 : 16; int tabSize = isCompactTabs ? 24 : 28; - this.tabsPerPage = Math.max(5, Mth.floor((guiWidth - 20d) / tabSize)); + this.tabsPerPage = Math.max(5, Mth.floor((guiWidth - tabButtonsSize * 2d) / tabSize)); if (this.categoryPages == -1) { this.categoryPages = Math.max(0, selectedCategoryIndex / tabsPerPage); } this.page = Mth.clamp(page, 0, getCurrentTotalPages() - 1); - this.widgets.add(Widgets.createButton(new Rectangle(bounds.x, bounds.y - 16, 10, 10), new TranslatableComponent("text.rei.left_arrow")) + this.widgets.add(Widgets.createButton(new Rectangle(bounds.x, bounds.y - (isCompactTabButtons ? 16 : 20), tabButtonsSize, tabButtonsSize), new TranslatableComponent("text.rei.left_arrow")) .onClick(button -> { categoryPages--; if (categoryPages < 0) categoryPages = Mth.ceil(categories.size() / (float) tabsPerPage) - 1; DefaultDisplayViewingScreen.this.init(); }) + .tooltipLine(new TranslatableComponent("text.rei.previous_page")) .enabled(categories.size() > tabsPerPage)); - this.widgets.add(Widgets.createButton(new Rectangle(bounds.x + bounds.width - 10, bounds.y - 16, 10, 10), new TranslatableComponent("text.rei.right_arrow")) + this.widgets.add(Widgets.createButton(new Rectangle(bounds.x + bounds.width - tabButtonsSize - (isCompactTabButtons ? 0 : 1), bounds.y - (isCompactTabButtons ? 16 : 20), tabButtonsSize, tabButtonsSize), new TranslatableComponent("text.rei.right_arrow")) .onClick(button -> { categoryPages++; if (categoryPages > Mth.ceil(categories.size() / (float) tabsPerPage) - 1) categoryPages = 0; DefaultDisplayViewingScreen.this.init(); }) + .tooltipLine(new TranslatableComponent("text.rei.next_page")) .enabled(categories.size() > tabsPerPage)); this.widgets.add(categoryBack = Widgets.createButton(new Rectangle(bounds.getX() + 5, bounds.getY() + 5, 12, 12), new TranslatableComponent("text.rei.left_arrow")) .onClick(button -> previousCategory()).tooltipLine(new TranslatableComponent("text.rei.previous_category"))); @@ -354,7 +358,7 @@ public class DefaultDisplayViewingScreen extends AbstractDisplayViewingScreen { } PanelWidget.render(matrices, bounds, -1, delta); fill(matrices, bounds.x + 17, bounds.y + 5, bounds.x + bounds.width - 17, bounds.y + 17, darkStripesColor.value().getColor()); - fill(matrices, bounds.x + 17, bounds.y + 19, bounds.x + bounds.width - 17, bounds.y + 30, darkStripesColor.value().getColor()); + fill(matrices, bounds.x + 17, bounds.y + 19, bounds.x + bounds.width - 17, bounds.y + 31, darkStripesColor.value().getColor()); for (TabWidget tab : tabs) { if (!tab.isSelected()) { tab.render(matrices, mouseX, mouseY, delta); diff --git a/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json b/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json index b96037482..6f8b677f0 100755 --- a/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json +++ b/runtime/src/main/resources/assets/roughlyenoughitems/lang/en_us.json @@ -221,6 +221,7 @@ "config.roughlyenoughitems.search.asyncSearch": "Async Search:", "config.roughlyenoughitems.search.asyncSearchPartitionSize": "Async Search Partition Size:", "config.roughlyenoughitems.accessibility.useCompactTabs": "Compact Tabs:", + "config.roughlyenoughitems.accessibility.useCompactTabButtons": "Compact Tab Arrow Buttons:", "config.roughlyenoughitems.theme": "Appearance Theme:", "config.roughlyenoughitems.theme.dark": "Dark Theme", "config.roughlyenoughitems.theme.light": "Light Theme", |
