diff options
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java | 12 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java | 3 |
2 files changed, 11 insertions, 4 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java b/src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java index cdd9c51..cf4e2f0 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/data/OptionSubcategory.java @@ -14,6 +14,8 @@ public class OptionSubcategory { public ArrayList<BasicOption> options = new ArrayList<>(); public ArrayList<ConfigPageButton> topButtons = new ArrayList<>(); public ArrayList<ConfigPageButton> bottomButtons = new ArrayList<>(); + private ArrayList<BasicOption> filteredOptions = new ArrayList<>(); + private int drawLastY; public OptionSubcategory(String name) { this.name = name; @@ -21,7 +23,7 @@ public class OptionSubcategory { public int draw(long vg, int x, int y) { String filter = OneConfigGui.INSTANCE == null ? "" : OneConfigGui.INSTANCE.getSearchValue().toLowerCase().trim(); - ArrayList<BasicOption> filteredOptions = new ArrayList<>(options); + filteredOptions = new ArrayList<>(options); ArrayList<ConfigPageButton> filteredTop = new ArrayList<>(topButtons); ArrayList<ConfigPageButton> filteredBottom = new ArrayList<>(bottomButtons); if (!filter.equals("") && !name.toLowerCase().contains(filter)) { @@ -70,7 +72,7 @@ public class OptionSubcategory { optionY += 16; } - int drawLastY = optionY; + drawLastY = optionY; if (filteredOptions.size() > 0) { for (int i = 0; i < filteredOptions.size(); i++) { BasicOption option = filteredOptions.get(i); @@ -94,6 +96,10 @@ public class OptionSubcategory { optionY += page.getHeight() + 16; } + return optionY - y; + } + + public void drawLast(long vg, int x) { for (int i = 0; i < filteredOptions.size(); i++) { BasicOption option = filteredOptions.get(i); option.drawLast(vg, x, drawLastY); @@ -108,8 +114,6 @@ public class OptionSubcategory { } drawLastY += option.getHeight() + 16; } - - return optionY - y; } public String getName() { diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java index e3301bb..205de07 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java @@ -43,6 +43,9 @@ public class ModConfigPage extends Page { for (OptionSubcategory subCategory : page.categories.get(selectedCategory).subcategories) { optionY += subCategory.draw(vg, x + 30, optionY); } + for (OptionSubcategory subCategory : page.categories.get(selectedCategory).subcategories) { + subCategory.drawLast(vg, x + 30); + } totalSize = optionY - y; } |