diff options
author | NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> | 2023-10-10 02:31:07 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-09 17:31:07 +0200 |
commit | 97af5634a0c794b76e7c2592a2068bbd4c24f379 (patch) | |
tree | 55c0cef208c173d47fff887c7d75dac64612ef5f /src/main/java | |
parent | 4f0ab889fb184ca504e3edfb1b969411432d797c (diff) | |
download | NotEnoughUpdates-97af5634a0c794b76e7c2592a2068bbd4c24f379.tar.gz NotEnoughUpdates-97af5634a0c794b76e7c2592a2068bbd4c24f379.tar.bz2 NotEnoughUpdates-97af5634a0c794b76e7c2592a2068bbd4c24f379.zip |
Add paginator to reforges in /hex overlay (#868)
Add page i nator to reforges in /hex overlay
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java index fb936a4d..a3af232f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/hex/GuiCustomHex.java @@ -718,6 +718,38 @@ public class GuiCustomHex extends Gui { } } + if (currentState == EnchantState.HAS_ITEM_IN_BOOKS) { + ItemStack pageUpStack = cc.getLowerChestInventory().getStackInSlot(17); + ItemStack pageDownStack = cc.getLowerChestInventory().getStackInSlot(35); + if (pageUpStack != null && pageDownStack != null) { + currentPage = 0; + boolean upIsGlass = pageUpStack.getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane); + boolean downIsGlass = pageDownStack.getItem() == Item.getItemFromBlock(Blocks.stained_glass_pane); + int page = -1; + + expectedMaxPage = 1; + if (!downIsGlass) { + try { + page = Integer.parseInt(Utils.getRawTooltip(pageDownStack).get(1).substring(11)) - 1; + expectedMaxPage = page + 1; + } catch (Exception ignored) { + } + } + if (page == -1 && !upIsGlass) { + try { + page = Integer.parseInt(Utils.getRawTooltip(pageUpStack).get(1).substring(11)) + 1; + expectedMaxPage = page; + } catch (Exception ignored) { + } + } + if (page == -1) { + currentPage = 1; + } else { + currentPage = page; + } + } + } + isChangingEnchLevel = false; searchRemovedFromRemovable = false; @@ -1822,7 +1854,7 @@ public class GuiCustomHex extends Gui { fr.drawString("Applied", guiLeft + 247, guiTop + 7, 0x404040, false); //Page Text - /*if (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT) { + if (currentState == EnchantState.HAS_ITEM_IN_BOOKS) { String pageStr = "Page: " + currentPage + "/" + expectedMaxPage; int pageStrLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(pageStr); Utils.drawStringCentered(pageStr, @@ -1838,7 +1870,7 @@ public class GuiCustomHex extends Gui { Utils.drawTexturedRect(guiLeft + X_SIZE / 2 + pageStrLen / 2 + 2, guiTop + 6, 15, 15, 15 / 512f, 30 / 512f, 372 / 512f, 387 / 512f, GL11.GL_NEAREST ); - }*/ + } tooltipToDisplay = renderSettings(mouseX, mouseY, tooltipToDisplay); @@ -3321,7 +3353,8 @@ public class GuiCustomHex extends Gui { if (Mouse.getEventButtonState() && (currentState == EnchantState.HAS_ITEM || currentState == EnchantState.ADDING_ENCHANT || currentState == EnchantState.HAS_ITEM_IN_HEX || currentState == EnchantState.ADDING_BOOK || - currentState == EnchantState.ADDING_GEMSTONE || currentState == EnchantState.APPLYING_GEMSTONE)) { + currentState == EnchantState.ADDING_GEMSTONE || currentState == EnchantState.APPLYING_GEMSTONE || + currentState == EnchantState.HAS_ITEM_IN_BOOKS)) { if (mouseY > guiTop + 6 && mouseY < guiTop + 6 + 15) { String pageStr = "Page: " + currentPage + "/" + expectedMaxPage; int pageStrLen = Minecraft.getMinecraft().fontRendererObj.getStringWidth(pageStr); |