Skip to content

Commit

Permalink
Fix IOOBE.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchej123 committed Mar 24, 2021
1 parent 146e882 commit c971199
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions src/codechicken/nei/recipe/GuiRecipe.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,17 +196,19 @@ private void prevPage() {
}

private void nextType() {
recipetype++;
if (recipetype >= currenthandlers.size())
recipetype = 0;
page = 0;
recipeTabs.calcPageNumber();
setRecipePage(++recipetype);
}

private void prevType() {
recipetype--;
setRecipePage(--recipetype);
}

public void setRecipePage(int idx) {
recipetype = idx;
if (recipetype < 0)
recipetype = currenthandlers.size() - 1;
else if (recipetype >= currenthandlers.size())
recipetype = 0;
page = 0;
recipeTabs.calcPageNumber();
}
Expand Down
4 changes: 2 additions & 2 deletions src/codechicken/nei/recipe/GuiRecipeTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public boolean onButtonPress(boolean rightclick) {
int newIdx = guiRecipe.currenthandlers.indexOf(handler);
if (newIdx == -1)
return false;
guiRecipe.recipetype = newIdx;

guiRecipe.setRecipePage(newIdx);
return true;
}

Expand Down

0 comments on commit c971199

Please sign in to comment.