diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-08 18:29:09 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-08 18:29:09 -0500 |
commit | 076733d8ad73a2cfccb910e0bb1dc71c00d8ded1 (patch) | |
tree | f09524ceb73bf6a32536664a30dbabdbd3332e55 /src/main/java | |
parent | 79e2b6cc14ce934ad3882a66d693cdc5db29c31c (diff) | |
download | NotEnoughUpdates-076733d8ad73a2cfccb910e0bb1dc71c00d8ded1.tar.gz NotEnoughUpdates-076733d8ad73a2cfccb910e0bb1dc71c00d8ded1.tar.bz2 NotEnoughUpdates-076733d8ad73a2cfccb910e0bb1dc71c00d8ded1.zip |
Click on the hud to send command (#78)
* Click on the hud to run the command
* i forgor how much xp goes into slayer level 9
* Fix? I can't test it
* fix 2
* move pet inv display tooltip to the left of the inventory to avoid conflicts
Co-authored-by: nopothegamer <40329022+nopothegamer@users.noreply.github.com>
Co-authored-by: Lulonaut <67191924+Lulonaut@users.noreply.github.com>
Co-authored-by: Lulonaut <lulonaut@tutanota.de>
Diffstat (limited to 'src/main/java')
5 files changed, 358 insertions, 356 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index f3a38b13..99e3fb04 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2576,63 +2576,11 @@ public class NEUEventListener { @SubscribeEvent public void onItemTooltip(ItemTooltipEvent event) { if (!neu.isOnSkyblock()) return; - /*if(NotEnoughUpdates.INSTANCE.config.improvedSBMenu.hideEmptyPanes && - event.itemStack.getItem().equals(Item.getItemFromBlock(Blocks.stained_glass_pane))) { - String first = Utils.cleanColour(event.toolTip.get(0)); - first = first.replaceAll("\\(.*\\)", "").trim(); - if(first.length() == 0) { - event.toolTip.clear(); - } - }*/ - //AH prices - /*if(Minecraft.getMinecraft().currentScreen != null) { - if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { - GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; - ContainerChest container = (ContainerChest) chest.inventorySlots; - String containerName = container.getLowerChestInventory().getDisplayName().getUnformattedText(); - if(containerName.trim().equals("Auctions Browser")) { - String internalname = neu.manager.getInternalNameForItem(event.itemStack); - if(internalname != null) { - for(int i=0; i<event.toolTip.size(); i++) { - String line = event.toolTip.get(i); - if(line.contains(EnumChatFormatting.GRAY + "Bidder: ") || - line.contains(EnumChatFormatting.GRAY + "Starting bid: ") || - line.contains(EnumChatFormatting.GRAY + "Buy it now: ")) { - neu.manager.updatePrices(); - JsonObject auctionInfo = neu.manager.getItemAuctionInfo(internalname); - - if(auctionInfo != null) { - NumberFormat format = NumberFormat.getInstance(Locale.US); - int auctionPrice = (int)(auctionInfo.get("price").getAsFloat() / auctionInfo.get("count").getAsFloat()); - float costOfEnchants = neu.manager.getCostOfEnchants(internalname, - event.itemStack.getTagCompound()); - int priceWithEnchants = auctionPrice+(int)costOfEnchants; - - event.toolTip.add(++i, EnumChatFormatting.GRAY + "Average price: " + - EnumChatFormatting.GOLD + format.format(auctionPrice) + " coins"); - if(costOfEnchants > 0) { - event.toolTip.add(++i, EnumChatFormatting.GRAY + "Average price (w/ enchants): " + - EnumChatFormatting.GOLD + - format.format(priceWithEnchants) + " coins"); - } - - if(neu.manager.config.advancedPriceInfo.value) { - int salesVolume = (int) auctionInfo.get("sales").getAsFloat(); - int flipPrice = (int)(0.93*priceWithEnchants); + //Render the pet inventory display tooltip to the left to avoid things from other mods rendering over the tooltip + if (event.itemStack.getTagCompound().getBoolean("NEUPETINVDISPLAY")) { + GlStateManager.translate(-200, 0, 0); + } - event.toolTip.add(++i, EnumChatFormatting.GRAY + "Flip Price (93%): " + - EnumChatFormatting.GOLD + format.format(flipPrice) + " coins"); - event.toolTip.add(++i, EnumChatFormatting.GRAY + "Volume: " + - EnumChatFormatting.GOLD + format.format(salesVolume) + " sales/day"); - } - break; - } - } - } - } - } - } - }*/ if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && NotEnoughUpdates.INSTANCE.config.hidden.dev && event.toolTip.size() > 0 && event.toolTip.get(event.toolTip.size() - 1).startsWith(EnumChatFormatting.DARK_GRAY + "NBT: ")) { event.toolTip.remove(event.toolTip.size() - 1); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 5487a96c..1fbffd5f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -1838,12 +1838,12 @@ public class NEUOverlay extends Gui { if (NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud && NotEnoughUpdates.INSTANCE.config.misc.hidePotionEffect && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && isWardrobeSystemOnMainServer()) { - if (getWardrobeSlot(1) != null) { - slot1 = getWardrobeSlot(4); - slot2 = getWardrobeSlot(3); - slot3 = getWardrobeSlot(2); - slot4 = getWardrobeSlot(1); - } + if (getWardrobeSlot(1) != null) { + slot1 = getWardrobeSlot(4); + slot2 = getWardrobeSlot(3); + slot3 = getWardrobeSlot(2); + slot4 = getWardrobeSlot(1); + } if (guiScreen instanceof GuiInventory) { renderingArmorHud = true; selectedArmor = 9; @@ -1886,12 +1886,20 @@ public class NEUOverlay extends Gui { GlStateManager.bindTexture(0); tooltipToDisplay = Lists.newArrayList( - EnumChatFormatting.RED+"Warning", - EnumChatFormatting.GREEN+"You need to open /wardrobe", - EnumChatFormatting.GREEN+"To cache your armour" + EnumChatFormatting.RED + "Warning", + EnumChatFormatting.GREEN + "You need to open /wardrobe", + EnumChatFormatting.GREEN + "To cache your armour" ); if (mouseX >= ((width - 208) / 2f) && mouseX < ((width - 208) / 2f) + 16) { - //top slot + if (mouseY >= ((height + 60) / 2f - 105) && mouseY <= ((height + 60) / 2f - 105) + 70 && NotEnoughUpdates.INSTANCE.config.customArmour.sendWardrobeCommand) { + if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) { + if (Mouse.getEventButtonState()) { + if (ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/wardrobe") == 0) { + NotEnoughUpdates.INSTANCE.sendChatMessage("/wardrobe"); + } + } + } + } if (mouseY >= ((height + 60) / 2f - 105) && mouseY <= ((height + 60) / 2f - 105) + 16) { Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); GL11.glTranslatef(0, 0, -401); @@ -1901,6 +1909,15 @@ public class NEUOverlay extends Gui { } if (slot1 != null && slot2 != null && slot3 != null && slot4 != null) { if (mouseX >= ((width - 208) / 2f) && mouseX < ((width - 208) / 2f) + 16) { + if (mouseY >= ((height + 60) / 2f - 105) && mouseY <= ((height + 60) / 2f - 105) + 70 && NotEnoughUpdates.INSTANCE.config.customArmour.sendWardrobeCommand) { + if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) { + if (Mouse.getEventButtonState()) { + if (ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/wardrobe") == 0) { + NotEnoughUpdates.INSTANCE.sendChatMessage("/wardrobe"); + } + } + } + } //top slot if (mouseY >= ((height + 60) / 2f - 105) && mouseY <= ((height + 60) / 2f - 105) + 16) { tooltipToDisplay = slot1.getTooltip(Minecraft.getMinecraft().thePlayer, false); @@ -1938,6 +1955,7 @@ public class NEUOverlay extends Gui { petSlot = NotEnoughUpdates.INSTANCE.manager.jsonToStack( NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( PetInfoOverlay.getCurrentPet().petType + ";" + PetInfoOverlay.getCurrentPet().rarity.petId)); + petSlot.getTagCompound().setBoolean("NEUPETINVDISPLAY", true); ItemStack petInfo = petSlot; if (guiScreen instanceof GuiInventory) { @@ -1983,364 +2001,384 @@ public class NEUOverlay extends Gui { Utils.drawItemStack(petInfo, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 72); renderingPetHud = true; + + List<String> tooltipToDisplay = null; + if (petInfo != null) { + if (mouseX >= ((width - 208) / 2f) && mouseX < ((width - 208) / 2f) + 16) { + if (mouseY >= ((height + 60) / 2f - 105) + 72 && mouseY <= ((height + 60) / 2f - 105) + 88 && NotEnoughUpdates.INSTANCE.config.petOverlay.sendPetsCommand) { + if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) { + if (Mouse.getEventButtonState()) { + if (ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/pets") == 0) { + NotEnoughUpdates.INSTANCE.sendChatMessage("/pets"); + } + } + } + tooltipToDisplay = petInfo.getTooltip(Minecraft.getMinecraft().thePlayer, false); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + tooltipToDisplay = null; + GL11.glTranslatef(0, 0, -80); + } + } + } } } - SunTzu.setEnabled(textField.getText().toLowerCase().startsWith("potato")); + SunTzu.setEnabled(textField.getText().toLowerCase().startsWith("potato")); - updateGuiGroupSize(); + updateGuiGroupSize(); - if (guiScaleLast != Utils.peekGuiScale().getScaleFactor()) { - guiScaleLast = Utils.peekGuiScale().getScaleFactor(); - redrawItems = true; - } + if (guiScaleLast != Utils.peekGuiScale().getScaleFactor()) { + guiScaleLast = Utils.peekGuiScale().getScaleFactor(); + redrawItems = true; + } - if (oldWidthMult != getWidthMult()) { - oldWidthMult = getWidthMult(); - redrawItems = true; - } + if (oldWidthMult != getWidthMult()) { + oldWidthMult = getWidthMult(); + redrawItems = true; + } - yaw++; - yaw %= 360; + yaw++; + yaw %= 360; - bg = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.backgroundColour), true); - fg = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.foregroundColour)); - Color fgCustomOpacity = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.foregroundColour), true); + bg = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.backgroundColour), true); + fg = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.foregroundColour)); + Color fgCustomOpacity = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.foregroundColour), true); - Color fgFavourite2 = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.favouriteColour), true); - Color fgFavourite = new Color((int) (fgFavourite2.getRed() * 0.8f), (int) (fgFavourite2.getGreen() * 0.8f), - (int) (fgFavourite2.getBlue() * 0.8f), fgFavourite2.getAlpha()); + Color fgFavourite2 = new Color(SpecialColour.specialToChromaRGB(NotEnoughUpdates.INSTANCE.config.itemlist.favouriteColour), true); + Color fgFavourite = new Color((int) (fgFavourite2.getRed() * 0.8f), (int) (fgFavourite2.getGreen() * 0.8f), + (int) (fgFavourite2.getBlue() * 0.8f), fgFavourite2.getAlpha()); - if (itemPaneOpen) { - if (itemPaneTabOffset.getValue() == 0) { - if (itemPaneOffsetFactor.getTarget() != 2 / 3f) { - itemPaneOffsetFactor.setTarget(2 / 3f); - itemPaneOffsetFactor.resetTimer(); + if (itemPaneOpen) { + if (itemPaneTabOffset.getValue() == 0) { + if (itemPaneOffsetFactor.getTarget() != 2 / 3f) { + itemPaneOffsetFactor.setTarget(2 / 3f); + itemPaneOffsetFactor.resetTimer(); + } + } else { + if (itemPaneTabOffset.getTarget() != 0) { + itemPaneTabOffset.setTarget(0); + itemPaneTabOffset.resetTimer(); + } } } else { - if (itemPaneTabOffset.getTarget() != 0) { - itemPaneTabOffset.setTarget(0); - itemPaneTabOffset.resetTimer(); + if (itemPaneOffsetFactor.getValue() == 1) { + if (itemPaneTabOffset.getTarget() != 20) { + itemPaneTabOffset.setTarget(20); + itemPaneTabOffset.resetTimer(); + } + } else { + if (itemPaneOffsetFactor.getTarget() != 1f) { + itemPaneOffsetFactor.setTarget(1f); + itemPaneOffsetFactor.resetTimer(); + } } } - } else { - if (itemPaneOffsetFactor.getValue() == 1) { - if (itemPaneTabOffset.getTarget() != 20) { - itemPaneTabOffset.setTarget(20); - itemPaneTabOffset.resetTimer(); - } - } else { - if (itemPaneOffsetFactor.getTarget() != 1f) { - itemPaneOffsetFactor.setTarget(1f); - itemPaneOffsetFactor.resetTimer(); + + itemPaneOffsetFactor.tick(); + itemPaneTabOffset.tick(); + infoPaneOffsetFactor.tick(); + + if (page > getMaxPages() - 1) setPage(getMaxPages() - 1); + if (page < 0) setPage(0); + + GlStateManager.disableLighting(); + + /* + * Item selection (right) gui element rendering + */ + int paneWidth = (int) (width / 3 * getWidthMult()); + int leftSide = (int) (width * getItemPaneOffsetFactor()); + int rightSide = leftSide + paneWidth - getBoxPadding() - getItemBoxXPadding(); + + //Tab + if (NotEnoughUpdates.INSTANCE.config.itemlist.tabOpen) { + Minecraft.getMinecraft().getTextureManager().bindTexture(itemPaneTabArrow); + GlStateManager.color(1f, 1f, 1f, 0.3f); + Utils.drawTexturedRect(width - itemPaneTabOffset.getValue() * 64 / 20f, height / 2f - 32, 64, 64); + GlStateManager.bindTexture(0); + + if (!itemPaneOpen && mouseX > width - itemPaneTabOffset.getValue() && mouseY > height / 2 - 32 + && mouseY < height / 2 + 32) { + itemPaneOpen = true; } } - } - itemPaneOffsetFactor.tick(); - itemPaneTabOffset.tick(); - infoPaneOffsetFactor.tick(); + //Atomic reference used so that below lambda doesn't complain about non-effectively-final variable + AtomicReference<JsonObject> tooltipToDisplay = new AtomicReference<>(null); + //System.out.println(itemPaneOffsetFactor.getValue()); + if (itemPaneOffsetFactor.getValue() < 0.99) { + if (NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor > 0.5) { + BackgroundBlur.renderBlurredBackground(NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor, + width, height, + leftSide + getBoxPadding() - 5, getBoxPadding() - 5, + paneWidth - getBoxPadding() * 2 + 10, height - getBoxPadding() * 2 + 10, + itemPaneOffsetFactor.getValue() > 0.01); + Gui.drawRect(leftSide + getBoxPadding() - 5, getBoxPadding() - 5, + leftSide + getBoxPadding() - 5 + paneWidth - getBoxPadding() * 2 + 10, + getBoxPadding() - 5 + height - getBoxPadding() * 2 + 10, 0xc8101010); + } - if (page > getMaxPages() - 1) setPage(getMaxPages() - 1); - if (page < 0) setPage(0); + drawRect(leftSide + getBoxPadding() - 5, getBoxPadding() - 5, + leftSide + paneWidth - getBoxPadding() + 5, height - getBoxPadding() + 5, bg.getRGB()); - GlStateManager.disableLighting(); + renderNavElement(leftSide + getBoxPadding() + getItemBoxXPadding(), rightSide, getMaxPages(), page + 1, + Utils.peekGuiScale().getScaleFactor() < 4 ? "Page: " : ""); - /* - * Item selection (right) gui element rendering - */ - int paneWidth = (int) (width / 3 * getWidthMult()); - int leftSide = (int) (width * getItemPaneOffsetFactor()); - int rightSide = leftSide + paneWidth - getBoxPadding() - getItemBoxXPadding(); - - //Tab - if (NotEnoughUpdates.INSTANCE.config.itemlist.tabOpen) { - Minecraft.getMinecraft().getTextureManager().bindTexture(itemPaneTabArrow); - GlStateManager.color(1f, 1f, 1f, 0.3f); - Utils.drawTexturedRect(width - itemPaneTabOffset.getValue() * 64 / 20f, height / 2f - 32, 64, 64); - GlStateManager.bindTexture(0); + //Sort bar + drawRect(leftSide + getBoxPadding() + getItemBoxXPadding() - 1, + height - getBoxPadding() - ITEM_SIZE - 2, + rightSide + 1, + height - getBoxPadding(), fgCustomOpacity.getRGB()); - if (!itemPaneOpen && mouseX > width - itemPaneTabOffset.getValue() && mouseY > height / 2 - 32 - && mouseY < height / 2 + 32) { - itemPaneOpen = true; - } - } + float sortIconsMinX = (sortIcons.length + orderIcons.length) * (ITEM_SIZE + ITEM_PADDING) + ITEM_SIZE; + float availableX = rightSide - (leftSide + getBoxPadding() + getItemBoxXPadding()); + float sortOrderScaleFactor = Math.min(1, availableX / sortIconsMinX); - //Atomic reference used so that below lambda doesn't complain about non-effectively-final variable - AtomicReference<JsonObject> tooltipToDisplay = new AtomicReference<>(null); - //System.out.println(itemPaneOffsetFactor.getValue()); - if (itemPaneOffsetFactor.getValue() < 0.99) { - if (NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor > 0.5) { - BackgroundBlur.renderBlurredBackground(NotEnoughUpdates.INSTANCE.config.itemlist.bgBlurFactor, - width, height, - leftSide + getBoxPadding() - 5, getBoxPadding() - 5, - paneWidth - getBoxPadding() * 2 + 10, height - getBoxPadding() * 2 + 10, - itemPaneOffsetFactor.getValue() > 0.01); - Gui.drawRect(leftSide + getBoxPadding() - 5, getBoxPadding() - 5, - leftSide + getBoxPadding() - 5 + paneWidth - getBoxPadding() * 2 + 10, - getBoxPadding() - 5 + height - getBoxPadding() * 2 + 10, 0xc8101010); - } - - drawRect(leftSide + getBoxPadding() - 5, getBoxPadding() - 5, - leftSide + paneWidth - getBoxPadding() + 5, height - getBoxPadding() + 5, bg.getRGB()); - - renderNavElement(leftSide + getBoxPadding() + getItemBoxXPadding(), rightSide, getMaxPages(), page + 1, - Utils.peekGuiScale().getScaleFactor() < 4 ? "Page: " : ""); - - //Sort bar - drawRect(leftSide + getBoxPadding() + getItemBoxXPadding() - 1, - height - getBoxPadding() - ITEM_SIZE - 2, - rightSide + 1, - height - getBoxPadding(), fgCustomOpacity.getRGB()); - - float sortIconsMinX = (sortIcons.length + orderIcons.length) * (ITEM_SIZE + ITEM_PADDING) + ITEM_SIZE; - float availableX = rightSide - (leftSide + getBoxPadding() + getItemBoxXPadding()); - float sortOrderScaleFactor = Math.min(1, availableX / sortIconsMinX); - - int scaledITEM_SIZE = (int) (ITEM_SIZE * sortOrderScaleFactor); - int scaledItemPaddedSize = (int) ((ITEM_SIZE + ITEM_PADDING) * sortOrderScaleFactor); - int iconTop = height - getBoxPadding() - (ITEM_SIZE + scaledITEM_SIZE) / 2 - 1; - - boolean hoveredOverControl = false; - for (int i = 0; i < orderIcons.length; i++) { - int orderIconX = leftSide + getBoxPadding() + getItemBoxXPadding() + i * scaledItemPaddedSize; - drawRect(orderIconX, iconTop, scaledITEM_SIZE + orderIconX, iconTop + scaledITEM_SIZE, fg.getRGB()); - - Minecraft.getMinecraft().getTextureManager().bindTexture(getCompareMode() == i ? orderIconsActive[i] : orderIcons[i]); - GlStateManager.color(1f, 1f, 1f, 1f); - Utils.drawTexturedRect(orderIconX, iconTop, scaledITEM_SIZE, scaledITEM_SIZE, 0, 1, 0, 1, GL11.GL_NEAREST); + int scaledITEM_SIZE = (int) (ITEM_SIZE * sortOrderScaleFactor); + int scaledItemPaddedSize = (int) ((ITEM_SIZE + ITEM_PADDING) * sortOrderScaleFactor); + int iconTop = height - getBoxPadding() - (ITEM_SIZE + scaledITEM_SIZE) / 2 - 1; - Minecraft.getMinecraft().getTextureManager().bindTexture(getCompareAscending().get(i) ? ascending_overlay : descending_overlay); - GlStateManager.color(1f, 1f, 1f, 1f); - Utils.drawTexturedRect(orderIconX, iconTop, scaledITEM_SIZE, scaledITEM_SIZE, 0, 1, 0, 1, GL11.GL_NEAREST); - GlStateManager.bindTexture(0); + boolean hoveredOverControl = false; + for (int i = 0; i < orderIcons.length; i++) { + int orderIconX = leftSide + getBoxPadding() + getItemBoxXPadding() + i * scaledItemPaddedSize; + drawRect(orderIconX, iconTop, scaledITEM_SIZE + orderIconX, iconTop + scaledITEM_SIZE, fg.getRGB()); + + Minecraft.getMinecraft().getTextureManager().bindTexture(getCompareMode() == i ? orderIconsActive[i] : orderIcons[i]); + GlStateManager.color(1f, 1f, 1f, 1f); + Utils.drawTexturedRect(orderIconX, iconTop, scaledITEM_SIZE, scaledITEM_SIZE, 0, 1, 0, 1, GL11.GL_NEAREST); - if (mouseY > iconTop && mouseY < iconTop + scaledITEM_SIZE) { - if (mouseX > orderIconX && mouseX < orderIconX + scaledITEM_SIZE) { - hoveredOverControl = true; - if (System.currentTimeMillis() - millisLastMouseMove > 400) { - String text = EnumChatFormatting.GRAY + "Order "; - if (i == COMPARE_MODE_ALPHABETICAL) text += "Alphabetically"; - else if (i == COMPARE_MODE_RARITY) text += "by Rarity"; - else if (i == COMPARE_MODE_VALUE) text += "by Item Worth"; - else text = null; - if (text != null) textToDisplay = Utils.createList(text); + Minecraft.getMinecraft().getTextureManager().bindTexture(getCompareAscending().get(i) ? ascending_overlay : descending_overlay); + GlStateManager.color(1f, 1f, 1f, 1f); + Utils.drawTexturedRect(orderIconX, iconTop, scaledITEM_SIZE, scaledITEM_SIZE, 0, 1, 0, 1, GL11.GL_NEAREST); + GlStateManager.bindTexture(0); + + if (mouseY > iconTop && mouseY < iconTop + scaledITEM_SIZE) { + if (mouseX > orderIconX && mouseX < orderIconX + scaledITEM_SIZE) { + hoveredOverControl = true; + if (System.currentTimeMillis() - millisLastMouseMove > 400) { + String text = EnumChatFormatting.GRAY + "Order "; + if (i == COMPARE_MODE_ALPHABETICAL) text += "Alphabetically"; + else if (i == COMPARE_MODE_RARITY) text += "by Rarity"; + else if (i == COMPARE_MODE_VALUE) text += "by Item Worth"; + else text = null; + if (text != null) textToDisplay = Utils.createList(text); + } } } } - } - for (int i = 0; i < sortIcons.length; i++) { - int sortIconX = rightSide - scaledITEM_SIZE - i * scaledItemPaddedSize; - drawRect(sortIconX, iconTop, scaledITEM_SIZE + sortIconX, iconTop + scaledITEM_SIZE, fg.getRGB()); - Minecraft.getMinecraft().getTextureManager().bindTexture(getSortMode() == i ? sortIconsActive[i] : sortIcons[i]); - GlStateManager.color(1f, 1f, 1f, 1f); - Utils.drawTexturedRect(sortIconX, iconTop, scaledITEM_SIZE, scaledITEM_SIZE, 0, 1, 0, 1, GL11.GL_NEAREST); - GlStateManager.bindTexture(0); + for (int i = 0; i < sortIcons.length; i++) { + int sortIconX = rightSide - scaledITEM_SIZE - i * scaledItemPaddedSize; + drawRect(sortIconX, iconTop, scaledITEM_SIZE + sortIconX, iconTop + scaledITEM_SIZE, fg.getRGB()); + Minecraft.getMinecraft().getTextureManager().bindTexture(getSortMode() == i ? sortIconsActive[i] : sortIcons[i]); + GlStateManager.color(1f, 1f, 1f, 1f); + Utils.drawTexturedRect(sortIconX, iconTop, scaledITEM_SIZE, scaledITEM_SIZE, 0, 1, 0, 1, GL11.GL_NEAREST); + GlStateManager.bindTexture(0); - if (mouseY > iconTop && mouseY < iconTop + scaledITEM_SIZE) { - if (mouseX > sortIconX && mouseX < sortIconX + scaledITEM_SIZE) { - hoveredOverControl = true; - if (System.currentTimeMillis() - millisLastMouseMove > 400) { - String text = EnumChatFormatting.GRAY + "Filter "; - if (i == SORT_MODE_ALL) text = EnumChatFormatting.GRAY + "No Filter"; - else if (i == SORT_MODE_MOB) text += "Mobs"; - else if (i == SORT_MODE_PET) text += "Pets"; - else if (i == SORT_MODE_TOOL) text += "Tools"; - else if (i == SORT_MODE_ARMOR) text += "Armor"; - else if (i == SORT_MODE_ACCESSORY) text += "Accessories"; - else text = null; - if (text != null) textToDisplay = Utils.createList(text); + if (mouseY > iconTop && mouseY < iconTop + scaledITEM_SIZE) { + if (mouseX > sortIconX && mouseX < sortIconX + scaledITEM_SIZE) { + hoveredOverControl = true; + if (System.currentTimeMillis() - millisLastMouseMove > 400) { + String text = EnumChatFormatting.GRAY + "Filter "; + if (i == SORT_MODE_ALL) text = EnumChatFormatting.GRAY + "No Filter"; + else if (i == SORT_MODE_MOB) text += "Mobs"; + else if (i == SORT_MODE_PET) text += "Pets"; + else if (i == SORT_MODE_TOOL) text += "Tools"; + else if (i == SORT_MODE_ARMOR) text += "Armor"; + else if (i == SORT_MODE_ACCESSORY) text += "Accessories"; + else text = null; + if (text != null) textToDisplay = Utils.createList(text); + } } } } - } - if (!hoveredOverControl) { - millisLastMouseMove = System.currentTimeMillis(); - } + if (!hoveredOverControl) { + millisLastMouseMove = System.currentTimeMillis(); + } - if (selectedItemGroup != null) { - if (mouseX < selectedItemGroupX - 1 || mouseX > selectedItemGroupX + 17 || - mouseY < selectedItemGroupY - 1 || mouseY > selectedItemGroupY + 17) { - int selectedX = Math.min(selectedItemGroupX, width - getBoxPadding() - 18 * selectedItemGroup.size()); - if (mouseX < selectedX - 1 || mouseX > selectedX - 1 + 18 * selectedItemGroup.size() || - mouseY < selectedItemGroupY + 17 || mouseY > selectedItemGroupY + 35) { - selectedItemGroup = null; - selectedItemMillis = -1; + if (selectedItemGroup != null) { + if (mouseX < selectedItemGroupX - 1 || mouseX > selectedItemGroupX + 17 || + mouseY < selectedItemGroupY - 1 || mouseY > selectedItemGroupY + 17) { + int selectedX = Math.min(selectedItemGroupX, width - getBoxPadding() - 18 * selectedItemGroup.size()); + if (mouseX < selectedX - 1 || mouseX > selectedX - 1 + 18 * selectedItemGroup.size() || + mouseY < selectedItemGroupY + 17 || mouseY > selectedItemGroupY + 35) { + selectedItemGroup = null; + selectedItemMillis = -1; + } } } - } - if (!hoverInv) { - iterateItemSlots(new ItemSlotConsumer() { - public void consume(int x, int y, int id) { - JsonObject json = getSearchedItemPage(id); - if (json == null) { - return; - } - if (mouseX > x - 1 && mouseX < x + ITEM_SIZE + 1) { - if (mouseY > y - 1 && mouseY < y + ITEM_SIZE + 1) { - String internalname = json.get("internalname").getAsString(); - if (searchedItemsSubgroup.containsKey(internalname)) { - if (selectedItemMillis == -1) selectedItemMillis = System.currentTimeMillis(); - if (System.currentTimeMillis() - selectedItemMillis > 200 && - (selectedItemGroup == null || selectedItemGroup.isEmpty())) { - - ArrayList<JsonObject> children = new ArrayList<>(); - children.add(json); - for (String itemname : searchedItemsSubgroup.get(internalname)) { - children.add(manager.getItemInformation().get(itemname)); + if (!hoverInv) { + iterateItemSlots(new ItemSlotConsumer() { + public void consume(int x, int y, int id) { + JsonObject json = getSearchedItemPage(id); + if (json == null) { + return; + } + if (mouseX > x - 1 && mouseX < x + ITEM_SIZE + 1) { + if (mouseY > y - 1 && mouseY < y + ITEM_SIZE + 1) { + String internalname = json.get("internalname").getAsString(); + if (searchedItemsSubgroup.containsKey(internalname)) { + if (selectedItemMillis == -1) selectedItemMillis = System.currentTimeMillis(); + if (System.currentTimeMillis() - selectedItemMillis > 200 && + (selectedItemGroup == null || selectedItemGroup.isEmpty())) { + + ArrayList<JsonObject> children = new ArrayList<>(); + children.add(json); + for (String itemname : searchedItemsSubgroup.get(internalname)) { + children.add(manager.getItemInformation().get(itemname)); + } + + selectedItemGroup = children; + selectedItemGroupX = x; + selectedItemGroupY = y; } - - selectedItemGroup = children; - selectedItemGroupX = x; - selectedItemGroupY = y; + } else { + tooltipToDisplay.set(json); } - } else { - tooltipToDisplay.set(json); } } } - } - }); - } + }); + } - //Iterate through all item slots and display the appropriate item - int itemBoxXPadding = getItemBoxXPadding(); - int xStart = (int) (width * getItemPaneOffsetFactor()) + getBoxPadding() + itemBoxXPadding; + //Iterate through all item slots and display the appropriate item + int itemBoxXPadding = getItemBoxXPadding(); + int xStart = (int) (width * getItemPaneOffsetFactor()) + getBoxPadding() + itemBoxXPadding; - if (OpenGlHelper.isFramebufferEnabled()) { - renderItemsFromImage(xStart, width, height); - renderEnchOverlay(); + if (OpenGlHelper.isFramebufferEnabled()) { + renderItemsFromImage(xStart, width, height); + renderEnchOverlay(); - checkFramebufferSizes(width, height); + checkFramebufferSizes(width, height); - if (redrawItems || !NotEnoughUpdates.INSTANCE.config.hidden.cacheRenderedItempane) { - renderItemsToImage(width, height, fgFavourite2, fgFavourite, fgCustomOpacity, true, true); - redrawItems = false; + if (redrawItems || !NotEnoughUpdates.INSTANCE.config.hidden.cacheRenderedItempane) { + renderItemsToImage(width, height, fgFavourite2, fgFavourite, fgCustomOpacity, true, true); + redrawItems = false; + } + } else { + renderItems(xStart, true, true, true); } - } else { - renderItems(xStart, true, true, true); - } - - if (selectedItemGroup != null) { - GL11.glTranslatef(0, 0, 10); - int selectedX = Math.min(selectedItemGroupX, width - getBoxPadding() - 18 * selectedItemGroup.size()); + if (selectedItemGroup != null) { + GL11.glTranslatef(0, 0, 10); - GlStateManager.enableDepth(); - GlStateManager.depthFunc(GL11.GL_LESS); - drawRect(selectedX, selectedItemGroupY + 18, - selectedX - 2 + 18 * selectedItemGroup.size(), selectedItemGroupY + 34, fgCustomOpacity.getRGB()); - drawRect(selectedX - 1, selectedItemGroupY + 17, - selectedX - 2 + 18 * selectedItemGroup.size(), selectedItemGroupY + 34, new Color(180, 180, 180).getRGB()); - drawRect(selectedX, selectedItemGroupY + 18, - selectedX - 1 + 18 * selectedItemGroup.size(), selectedItemGroupY + 35, new Color(30, 30, 30).getRGB()); - drawRect(selectedX - 1 + 2, selectedItemGroupY + 17 + 2, - selectedX - 1 + 18 * selectedItemGroup.size() + 2, selectedItemGroupY + 35 + 2, 0xa0000000); - GlStateManager.depthFunc(GL11.GL_LEQUAL); - - GL11.glTranslatef(0, 0, 10); + int selectedX = Math.min(selectedItemGroupX, width - getBoxPadding() - 18 * selectedItemGroup.size()); - tooltipToDisplay.set(null); - if (mouseY > selectedItemGroupY + 17 && mouseY < selectedItemGroupY + 35) { - for (int i = 0; i < selectedItemGroup.size(); i++) { - if (mouseX >= selectedX - 1 + 18 * i && mouseX <= selectedX + 17 + 18 * i) { - tooltipToDisplay.set(selectedItemGroup.get(i)); + GlStateManager.enableDepth(); + GlStateManager.depthFunc(GL11.GL_LESS); + drawRect(selectedX, selectedItemGroupY + 18, + selectedX - 2 + 18 * selectedItemGroup.size(), selectedItemGroupY + 34, fgCustomOpacity.getRGB()); + drawRect(selectedX - 1, selectedItemGroupY + 17, + selectedX - 2 + 18 * selectedItemGroup.size(), selectedItemGroupY + 34, new Color(180, 180, 180).getRGB()); + drawRect(selectedX, selectedItemGroupY + 18, + selectedX - 1 + 18 * selectedItemGroup.size(), selectedItemGroupY + 35, new Color(30, 30, 30).getRGB()); + drawRect(selectedX - 1 + 2, selectedItemGroupY + 17 + 2, + selectedX - 1 + 18 * selectedItemGroup.size() + 2, selectedItemGroupY + 35 + 2, 0xa0000000); + GlStateManager.depthFunc(GL11.GL_LEQUAL); + + GL11.glTranslatef(0, 0, 10); + + tooltipToDisplay.set(null); + if (mouseY > selectedItemGroupY + 17 && mouseY < selectedItemGroupY + 35) { + for (int i = 0; i < selectedItemGroup.size(); i++) { + if (mouseX >= selectedX - 1 + 18 * i && mouseX <= selectedX + 17 + 18 * i) { + tooltipToDisplay.set(selectedItemGroup.get(i)); + } } } - } - for (int i = 0; i < selectedItemGroup.size(); i++) { - JsonObject item = selectedItemGroup.get(i); - Utils.drawItemStack(manager.jsonToStack(item), selectedX + 18 * i, selectedItemGroupY + 18); + for (int i = 0; i < selectedItemGroup.size(); i++) { + JsonObject item = selectedItemGroup.get(i); + Utils.drawItemStack(manager.jsonToStack(item), selectedX + 18 * i, selectedItemGroupY + 18); + } + + GL11.glTranslatef(0, 0, -20); } - GL11.glTranslatef(0, 0, -20); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.disableLighting(); } - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.1F); - GlStateManager.disableLighting(); - } + /* + * Search bar & quickcommand elements + */ + guiGroup.render(0, 0); + resetAnchors(true); - /* - * Search bar & quickcommand elements - */ - guiGroup.render(0, 0); - resetAnchors(true); + /* + * Item info (left) gui element rendering + */ - /* - * Item info (left) gui element rendering - */ + rightSide = (int) (width * getInfoPaneOffsetFactor()); + leftSide = rightSide - paneWidth; - rightSide = (int) (width * getInfoPaneOffsetFactor()); - leftSide = rightSide - paneWidth; + if (activeInfoPane != null) { + activeInfoPane.tick(); + activeInfoPane.render(width, height, bg, fg, Utils.peekGuiScale(), mouseX, mouseY); - if (activeInfoPane != null) { - activeInfoPane.tick(); - activeInfoPane.render(width, height, bg, fg, Utils.peekGuiScale(), mouseX, mouseY); + GlStateManager.color(1f, 1f, 1f, 1f); + Minecraft.getMinecraft().getTextureManager().bindTexture(close); + Utils.drawTexturedRect(rightSide - getBoxPadding() - 8, getBoxPadding() - 8, 16, 16); + GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); + } - GlStateManager.color(1f, 1f, 1f, 1f); - Minecraft.getMinecraft().getTextureManager().bindTexture(close); - Utils.drawTexturedRect(rightSide - getBoxPadding() - 8, getBoxPadding() - 8, 16, 16); - GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); - } + //Render tooltip + JsonObject json = tooltipToDisplay.get(); + if (json != null) { + + ItemStack stack = manager.jsonToStack(json); + { + NBTTagCompound tag = stack.getTagCompound(); + tag.setBoolean("DisablePetExp", true); + stack.setTagCompound(tag); + } - //Render tooltip - JsonObject json = tooltipToDisplay.get(); - if (json != null) { + List<String> text = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false); - ItemStack stack = manager.jsonToStack(json); - { - NBTTagCompound tag = stack.getTagCompound(); - tag.setBoolean("DisablePetExp", true); - stack.setTagCompound(tag); - } + String internalname = json.get("internalname").getAsString(); + if (!NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoInvItem) { + ItemPriceInformation.addToTooltip(text, internalname, stack); + } - List<String> text = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false); + boolean hasClick = false; + boolean hasInfo = false; + if (json.has("clickcommand") && !json.get("clickcommand").getAsString().isEmpty()) { + hasClick = true; + } + if (json.has("info") && json.get("info").getAsJsonArray().size() > 0) { + hasInfo = true; + } - String internalname = json.get("internalname").getAsString(); - if (!NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoInvItem) { - ItemPriceInformation.addToTooltip(text, internalname, stack); - } + if (hasClick || hasInfo) text.add(""); + if (hasClick) + text.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "LMB/R : View recipe!"); + if (hasInfo) + text.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "RMB : View additional information!"); - boolean hasClick = false; - boolean hasInfo = false; - if (json.has("clickcommand") && !json.get("clickcommand").getAsString().isEmpty()) { - hasClick = true; + textToDisplay = text; } - if (json.has("info") && json.get("info").getAsJsonArray().size() > 0) { - hasInfo = true; + if (textToDisplay != null) { + Utils.drawHoveringText(textToDisplay, mouseX, mouseY, width, height, -1, fr); + textToDisplay = null; } - if (hasClick || hasInfo) text.add(""); - if (hasClick) - text.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "LMB/R : View recipe!"); - if (hasInfo) - text.add(EnumChatFormatting.YELLOW.toString() + EnumChatFormatting.BOLD + "RMB : View additional information!"); - - textToDisplay = text; - } - if (textToDisplay != null) { - Utils.drawHoveringText(textToDisplay, mouseX, mouseY, width, height, -1, fr); - textToDisplay = null; - } - - GlStateManager.enableBlend(); - GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); - GlStateManager.enableAlpha(); - GlStateManager.alphaFunc(516, 0.1F); - GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + GlStateManager.disableLighting(); - Utils.pushGuiScale(-1); + Utils.pushGuiScale(-1); - if (System.currentTimeMillis() - lastSearchMode > 120000 && NotEnoughUpdates.INSTANCE.config.toolbar.autoTurnOffSearchMode - || !NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { - searchMode = false; + if (System.currentTimeMillis() - lastSearchMode > 120000 && NotEnoughUpdates.INSTANCE.config.toolbar.autoTurnOffSearchMode + || !NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { + searchMode = false; + } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/CustomArmour.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/CustomArmour.java index 5ebbeb46..3fe9ebeb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/CustomArmour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/CustomArmour.java @@ -17,6 +17,14 @@ public class CustomArmour { @Expose @ConfigOption( + name = "Click To Open Wardrobe", + desc = "Click on the hud to open /wardrobe" + ) + @ConfigEditorBoolean + public boolean sendWardrobeCommand = true; + + @Expose + @ConfigOption( name = "GUI Colour", desc = "Change the colour of the GUI" ) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java index e8d385b5..0880a1f8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/PetOverlay.java @@ -74,6 +74,14 @@ public class PetOverlay { @Expose
@ConfigOption(
+ name = "Pet Inventory Display",
+ desc = "Shows an overlay in your inventory showing your current pet"
+ )
+ @ConfigEditorBoolean
+ public boolean petInvDisplay = true;
+
+ @Expose
+ @ConfigOption(
name = "GUI Colour",
desc = "Change the colour of the GUI"
)
@@ -84,9 +92,9 @@ public class PetOverlay { @Expose
@ConfigOption(
- name = "Pet Inventory Display",
- desc = "Shows an overlay in your inventory showing your current pet"
+ name = "Click To Open Pets",
+ desc = "Click on the hud to open /pets"
)
@ConfigEditorBoolean
- public boolean petInvDisplay = false;
+ public boolean sendPetsCommand = true;
}
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/SlayerOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/SlayerOverlay.java index a7bb0b66..2a62d803 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/SlayerOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/SlayerOverlay.java @@ -175,7 +175,7 @@ public class SlayerOverlay extends TextOverlay { if (xpPerBoss != 0 && slayerIntXP > 0) { lineMap.put(5, EnumChatFormatting.YELLOW + "Bosses till next Lvl: " + EnumChatFormatting.LIGHT_PURPLE + - (bossesUntilNextLevel > 1000 ? "?" : bossesUntilNextLevel)); + (bossesUntilNextLevel > 2000 ? "?" : bossesUntilNextLevel)); } if (timeSinceLastBoss > 0 && timeSinceLastBoss2 > 0) { |