Compare commits

...
Author SHA1 Message Date
miozune afe3c54c29 Add config to not optimize computation for GUI overlap (#314) 2022-10-17 20:59:14 +02:00
Jason MitchellandGitHub GTNH Actions 2cab09e91b Try/Catch AIOBE - maybe fixes #295 (#312)
* Try/Catch AIOBE - maybe fixes #295

* spotlessApply

Co-authored-by: GitHub GTNH Actions <unknown>
2022-10-17 11:34:06 +02:00
4 changed files with 24 additions and 4 deletions

No files matched your search

+7 -3
View File
@@ -153,8 +153,12 @@ public class ItemsGrid {
invalidSlotMap = new boolean[rows * columns];
perPage = columns * rows;
checkGuiOverlap(gui, 0, columns - 2, 1);
checkGuiOverlap(gui, columns - 1, 1, -1);
if (NEIClientConfig.optimizeGuiOverlapComputation()) {
checkGuiOverlap(gui, 0, columns - 2, 1);
checkGuiOverlap(gui, columns - 1, 1, -1);
} else {
checkGuiOverlap(gui, 0, columns, 1);
}
if (oldRows != rows || oldColumns != columns || !Arrays.equals(oldSlotMap, invalidSlotMap)) {
onGridChanged();
@@ -164,7 +168,7 @@ public class ItemsGrid {
private void checkGuiOverlap(GuiContainer gui, int start, int end, int dir) {
boolean validColumn = false;
for (int c = start; c != end && !validColumn; c += dir) {
for (int c = start; c != end && (!NEIClientConfig.optimizeGuiOverlapComputation() || !validColumn); c += dir) {
validColumn = true;
for (int r = 0; r < rows; r++) {
@@ -274,6 +274,11 @@ public class NEIClientConfig {
.getBooleanValue(false);
API.addOption(new OptionToggleButton("inventory.ignore_potion_overlap", true));
tag.getTag("inventory.optimize_gui_overlap_computation")
.setComment("Optimize computation for GUI overlap")
.getBooleanValue(false);
API.addOption(new OptionToggleButton("inventory.optimize_gui_overlap_computation", true));
tag.getTag("tools.handler_load_from_config")
.setComment("ADVANCED: Load handlers from config")
.getBooleanValue(false);
@@ -540,6 +545,10 @@ public class NEIClientConfig {
return getBooleanSetting("inventory.ignore_potion_overlap");
}
public static boolean optimizeGuiOverlapComputation() {
return getBooleanSetting("inventory.optimize_gui_overlap_computation");
}
public static boolean isEnabled() {
return enabledOverride && getBooleanSetting("inventory.widgetsenabled");
}
@@ -605,7 +605,11 @@ public abstract class TemplateRecipeHandler implements ICraftingHandler, IUsageH
}
public PositionedStack getResultStack(int recipe) {
return arecipes.get(recipe).getResult();
try {
return arecipes.get(recipe).getResult();
} catch (ArrayIndexOutOfBoundsException ignored) {
return null;
}
}
public List<PositionedStack> getOtherStacks(int recipe) {
@@ -161,6 +161,9 @@ nei.options.inventory.creative_tab_style.false=JEI
nei.options.inventory.ignore_potion_overlap=Ignore overlap with potion effect HUD
nei.options.inventory.ignore_potion_overlap.true=Yes
nei.options.inventory.ignore_potion_overlap.false=No
nei.options.inventory.optimize_gui_overlap_computation=Optimize computation for GUI overlap
nei.options.inventory.optimize_gui_overlap_computation.true=Yes
nei.options.inventory.optimize_gui_overlap_computation.false=No
nei.options.inventory.widgetsenabled.true=NEI Enabled
nei.options.inventory.widgetsenabled.false=NEI Disabled
nei.options.inventory.cheatmode.0=Recipe Mode