diff options
author | Roman / Nea <roman.graef@gmail.com> | 2022-05-01 23:15:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-01 23:15:47 +0200 |
commit | d6a6f859ce337266e61663636c27dd7630de0235 (patch) | |
tree | b3b967b103c08ad239567a701ed793260bd7c4b6 | |
parent | f16a0731f7446b5a0851ac622245c786780deb10 (diff) | |
parent | 7243827ec602efa0d2386ab53a61472465e8555a (diff) | |
download | NotEnoughUpdates-feature/itemshops.tar.gz NotEnoughUpdates-feature/itemshops.tar.bz2 NotEnoughUpdates-feature/itemshops.zip |
Merge branch 'master' into feature/itemshopsfeature/itemshops
33 files changed, 809 insertions, 526 deletions
diff --git a/Update Notes/2.1.md b/Update Notes/2.1.md index dff52a65..935ca4f1 100644 --- a/Update Notes/2.1.md +++ b/Update Notes/2.1.md @@ -49,7 +49,7 @@ - Added an option to turn off showing next click in chronomatron - Turns off inv search mode after 2 minutes - Made /neustats modlist show normal /neustats if under 15 mods -- Added max enchant book to /neuec - Dokm +- Added max enchant book and max attribute shard to /neuec - Dokm - [Added bingo and Stranded profile icons to /pv](https://cdn.discordapp.com/attachments/832652653292027904/915844465372065842/unknown.png) - Added an icon if neu doesn't know about a gamemode in /pv - Fixed pet overlay not resetting pet when making new profile @@ -80,6 +80,10 @@ - Added optional radius argument for neupackdev subcommands. - whalker - Added tab completion to /neupackdev subcommands. - whalker - Made it if you hold shift in the enchant solvers it overrides prevent missclicks +- Added 6-10 stars to the auction search overlay +- Added 6-10 stars to /neucustomize +- Added support for attributes in neuec +- Added Heavy Pearls to todo overlay - cobble8 ### **Bug Fixes:** - Fix wiki pages freezing the entire game - nea89 - Made titanium overlay and waypoints work with dwarven overlay off @@ -107,7 +111,7 @@ - Added checks for chat messages for dungeon win overlay - Fixed minion tiers crafted by coop members not showing up in /pv - Lulonaut - Fixed crash in /pv when the player had a pet that is not saved in the repo - Lulonaut -- Made it so you can close /et with your inventory keybind +- Fixed some vanilla Minecraft keybinds not working in NEU GUIs ### **Other:** - New icons was added in storage_icons.png - Moved the help icon in /neucustomize over a little diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index bec3dc36..99dce3bb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -21,6 +21,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu; import io.github.moulberry.notenoughupdates.miscgui.GuiPriceGraph; import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; import io.github.moulberry.notenoughupdates.util.Constants; +import io.github.moulberry.notenoughupdates.util.GuiTextures; import io.github.moulberry.notenoughupdates.util.LerpingFloat; import io.github.moulberry.notenoughupdates.util.NotificationHandler; import io.github.moulberry.notenoughupdates.util.SpecialColour; @@ -170,17 +171,27 @@ public class NEUOverlay extends Gui { private final String petRegex = ".*?;[0-5]$"; private final ResourceLocation[] sortIcons = new ResourceLocation[]{ - sort_all, sort_mob, sort_pet, sort_tool, sort_armor, sort_accessory + GuiTextures.sort_all, + GuiTextures.sort_mob, + GuiTextures.sort_pet, + GuiTextures.sort_tool, + GuiTextures.sort_armor, + GuiTextures.sort_accessory }; private final ResourceLocation[] sortIconsActive = new ResourceLocation[]{ - sort_all_active, sort_mob_active, sort_pet_active, sort_tool_active, sort_armor_active, sort_accessory_active + GuiTextures.sort_all_active, + GuiTextures.sort_mob_active, + GuiTextures.sort_pet_active, + GuiTextures.sort_tool_active, + GuiTextures.sort_armor_active, + GuiTextures.sort_accessory_active }; private final ResourceLocation[] orderIcons = new ResourceLocation[]{ - order_alphabetical, order_rarity, order_value + GuiTextures.order_alphabetical, GuiTextures.order_rarity, GuiTextures.order_value }; private final ResourceLocation[] orderIconsActive = new ResourceLocation[]{ - order_alphabetical_active, order_rarity_active, order_value_active + GuiTextures.order_alphabetical_active, GuiTextures.order_rarity_active, GuiTextures.order_value_active }; //Various constants used for GUI structure @@ -449,13 +460,13 @@ public class NEUOverlay extends Gui { if (!NotEnoughUpdates.INSTANCE.config.toolbar.enableSettingsButton) { return; } - Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.quickcommand_background); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(x, y, searchYSize + paddingUnscaled * 2, searchYSize + paddingUnscaled * 2, GL11.GL_NEAREST ); - Minecraft.getMinecraft().getTextureManager().bindTexture(settings); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.settings); GlStateManager.color(1f, 1f, 1f, 1f); Utils.drawTexturedRect((int) x + paddingUnscaled, (int) y + paddingUnscaled, searchYSize, searchYSize @@ -507,13 +518,13 @@ public class NEUOverlay extends Gui { return; } - Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.quickcommand_background); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(x, y, searchYSize + paddingUnscaled * 2, searchYSize + paddingUnscaled * 2, GL11.GL_NEAREST ); - Minecraft.getMinecraft().getTextureManager().bindTexture(help); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.help); GlStateManager.color(1f, 1f, 1f, 1f); Utils.drawTexturedRect((int) x + paddingUnscaled, (int) y + paddingUnscaled, getSearchBarYSize(), getSearchBarYSize() @@ -609,7 +620,7 @@ public class NEUOverlay extends Gui { tag.setString("qc_id", quickCommandStrSplit[0].toLowerCase().trim()); render.setTagCompound(tag); - Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.quickcommand_background); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(x, y, bigItemSize + paddingUnscaled * 2, bigItemSize + paddingUnscaled * 2, GL11.GL_NEAREST @@ -1378,7 +1389,8 @@ public class NEUOverlay extends Gui { "DUNGEON BOW", "DRILL", "GAUNTLET", - "LONGSWORD" + "LONGSWORD", + "DEPLOYABLE" ) >= 0; } else if (getSortMode() == SORT_MODE_ARMOR) { return checkItemType( @@ -1679,12 +1691,12 @@ public class NEUOverlay extends Gui { drawRect(leftSide - 1, top, leftSide - 1 + buttonXSize, top + ySize, fg.getRGB()); GlStateManager.color(1f, 1f, 1f, 1f); - Minecraft.getMinecraft().getTextureManager().bindTexture(rightarrow); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.rightarrow); Utils.drawTexturedRect(leftSide - 1 + leftPressed, top + leftPressed, buttonXSize, ySize, 1, 0, 0, 1 ); - Minecraft.getMinecraft().getTextureManager().bindTexture(rightarrow_overlay); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.rightarrow_overlay); Utils.drawTexturedRect(leftSide - 1, top, buttonXSize, ySize, 1 - leftPressed, leftPressed, 1 - leftPressed, leftPressed @@ -1698,12 +1710,12 @@ public class NEUOverlay extends Gui { drawRect(rightSide + 1 - buttonXSize, top, rightSide + 1, top + ySize, fg.getRGB()); GlStateManager.color(1f, 1f, 1f, 1f); - Minecraft.getMinecraft().getTextureManager().bindTexture(rightarrow); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.rightarrow); Utils.drawTexturedRect(rightSide + 1 - buttonXSize + rightPressed, top + rightPressed, buttonXSize, ySize ); - Minecraft.getMinecraft().getTextureManager().bindTexture(rightarrow_overlay); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.rightarrow_overlay); Utils.drawTexturedRect(rightSide + 1 - buttonXSize, top, buttonXSize, ySize, 1 - rightPressed, rightPressed, 1 - rightPressed, rightPressed @@ -1871,9 +1883,7 @@ public class NEUOverlay extends Gui { ContainerChest container = (ContainerChest) chest.inventorySlots; IInventory lower = container.getLowerChestInventory(); String containerName = lower.getDisplayName().getUnformattedText(); - if (containerName.contains(guiName)) { - wardrobeOpen = true; - } else wardrobeOpen = false; + wardrobeOpen = containerName.contains(guiName); } if (guiScreen instanceof GuiInventory) { wardrobeOpen = false; @@ -1881,28 +1891,6 @@ public class NEUOverlay extends Gui { return wardrobeOpen; } - private int wardrobePage = -1; - - private int getWardrobePage() { - GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; - if (guiScreen instanceof GuiChest) { - if (isInNamedGui("Wardrobe")) { - GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; - ContainerChest container = (ContainerChest) chest.inventorySlots; - IInventory lower = container.getLowerChestInventory(); - String containerName = lower.getDisplayName().getUnformattedText(); - try { - wardrobePage = Integer.parseInt(containerName.substring(10, 11)); - } catch (NumberFormatException e) { - System.out.println(containerName.charAt(10)); - System.out.println("Did hypixel change the wardrobe string?"); - wardrobePage = -1; - } - } else wardrobePage = -1; - } - return wardrobePage; - } - private ItemStack getChestSlotsAsItemStack(int slot) { GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; if (guiScreen instanceof GuiChest) { @@ -1913,62 +1901,12 @@ public class NEUOverlay extends Gui { } } - private int selectedArmor = 9; - - private int getEquippedArmor() { - if (isInNamedGui("Wardrobe")) { - ItemStack nullTest1 = getChestSlotsAsItemStack(8); - ItemStack nullTest2 = getChestSlotsAsItemStack(17); - ItemStack nullTest3 = getChestSlotsAsItemStack(26); - ItemStack nullTest4 = getChestSlotsAsItemStack(35); - ItemStack nullTest5 = getChestSlotsAsItemStack(44); - if (nullTest1 != null || nullTest2 != null || nullTest3 != null || nullTest4 != null || nullTest5 != null) { - selectedArmor = 9; - } - for (int ii = 1; ii < 5; ii++) { - if (ii == 1 || selectedArmor == 9) { - if (getWardrobePage() == ii) { - for (int i = 8; i < 54; i += 9) { - ItemStack stack1 = getChestSlotsAsItemStack(i); - if (stack1 != null) { - String[] lore1 = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack1.getTagCompound()); - for (String line : lore1) { - //System.out.println(line); - if (line.contains("to unequip this armor")) { - selectedArmor = i; - break; - } - } - } - } - } - } - } - } - return selectedArmor; - } - private ItemStack getWardrobeSlot(int armourSlot) { - if (isInNamedGui("Wardrobe")) { - if (getChestSlotsAsItemStack(getEquippedArmor() - armourSlot) != null && getEquippedArmor() != 9) { - return getChestSlotsAsItemStack(getEquippedArmor() - armourSlot); - } else return null; + if (isInNamedGui("Your Equipment")) { + return getChestSlotsAsItemStack(armourSlot); } else return null; } - public boolean isWardrobeSystemOnMainServer() { - JsonElement alphaWardrobeElement = Utils.getElement(Constants.DISABLE, "wardrobeFeature"); - if (alphaWardrobeElement == null || !alphaWardrobeElement.isJsonObject()) { - return true; - } - JsonObject isWardrobe = alphaWardrobeElement.getAsJsonObject(); - if (isWardrobe.has("enableNewWardrob")) { - return isWardrobe.get("enableNewWardrob").getAsBoolean(); - } else { - return true; - } - } - public ItemStack slot1 = null; public ItemStack slot2 = null; public ItemStack slot3 = null; @@ -2015,229 +1953,6 @@ public class NEUOverlay extends Gui { Utils.drawTexturedRect((width - 64) / 2f, (height - 64) / 2f - 114, 64, 64, GL11.GL_LINEAR); GlStateManager.bindTexture(0); } - GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; - - 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 (guiScreen instanceof GuiInventory) { - renderingArmorHud = true; - selectedArmor = 9; - - List<String> tooltipToDisplay = null; - if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 0) { - Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY); - } - if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 1) { - Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_GREY); - } - if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 2) { - Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_DARK); - } - if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 3) { - if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3 && - NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay && petSlot != null) { - Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_TRANSPARENT_PET); - } else { - Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_TRANSPARENT); - } - } - if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 4) { - Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_FSR); - } - - GlStateManager.color(1, 1, 1, 1); - GL11.glTranslatef(0, 0, 401); - float yNumber = (float) (height - 167) / 2f; - Utils.drawTexturedRect((float) ((width - 224.1) / 2f), yNumber, 31, 86, GL11.GL_NEAREST); - GlStateManager.bindTexture(0); - - Utils.drawItemStack(slot1, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105)); - Utils.drawItemStack(slot2, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 18); - Utils.drawItemStack(slot3, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 36); - Utils.drawItemStack(slot4, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 54); - if (slot1 == null) { - Minecraft.getMinecraft().getTextureManager().bindTexture(QUESTION_MARK); - GlStateManager.color(1, 1, 1, 1); - Utils.drawTexturedRect(((width - 208) / 2f), ((height + 60) / 2f - 105), 16, 16, GL11.GL_NEAREST); - GlStateManager.bindTexture(0); - - tooltipToDisplay = Lists.newArrayList( - 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) { - 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); - } - } - - } - 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); - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); - tooltipToDisplay = null; - GL11.glTranslatef(0, 0, -401); - } - if (mouseY >= ((height + 60) / 2f - 105) + 18 && mouseY <= ((height + 60) / 2f - 105) + 34) { - tooltipToDisplay = slot2.getTooltip(Minecraft.getMinecraft().thePlayer, false); - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); - tooltipToDisplay = null; - GL11.glTranslatef(0, 0, -401); - } - if (mouseY >= ((height + 60) / 2f - 105) + 36 && mouseY <= ((height + 60) / 2f - 105) + 52) { - tooltipToDisplay = slot3.getTooltip(Minecraft.getMinecraft().thePlayer, false); - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); - tooltipToDisplay = null; - GL11.glTranslatef(0, 0, -401); - } - if (mouseY >= ((height + 60) / 2f - 105) + 54 && mouseY <= ((height + 60) / 2f - 105) + 70) { - tooltipToDisplay = slot4.getTooltip(Minecraft.getMinecraft().thePlayer, false); - Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); - tooltipToDisplay = null; - GL11.glTranslatef(0, 0, -401); - } - } - GL11.glTranslatef(0, 0, -401); - } - } - } - if (PetInfoOverlay.getCurrentPet() != null) { - if (NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay - && (NotEnoughUpdates.INSTANCE.manager - .jsonToStack(NotEnoughUpdates.INSTANCE.manager - .getItemInformation() - .get(PetInfoOverlay.getCurrentPet().petType + ";" + PetInfoOverlay.getCurrentPet().rarity.petId)) - .hasDisplayName() - || NotEnoughUpdates.INSTANCE.manager - .jsonToStack(NotEnoughUpdates.INSTANCE.manager - .getItemInformation() - .get(PetInfoOverlay.getCurrentPet().petType + ";" + (PetInfoOverlay.getCurrentPet().rarity.petId - 1))) - .hasDisplayName()) - && NotEnoughUpdates.INSTANCE.config.misc.hidePotionEffect && - NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) { - if (!NotEnoughUpdates.INSTANCE.manager - .jsonToStack( - NotEnoughUpdates.INSTANCE.manager - .getItemInformation() - .get(PetInfoOverlay.getCurrentPet().petType + ";" + PetInfoOverlay.getCurrentPet().rarity.petId)) - .hasDisplayName()) { - petSlot = NotEnoughUpdates.INSTANCE.manager.jsonToStack( - NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( - PetInfoOverlay.getCurrentPet().petType + ";" + (PetInfoOverlay.getCurrentPet().rarity.petId - 1))); - } else { - petSlot = NotEnoughUpdates.INSTANCE.manager.jsonToStack( - NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( - PetInfoOverlay.getCurrentPet().petType + ";" + PetInfoOverlay.getCurrentPet().rarity.petId)); - } - petSlot.getTagCompound().setBoolean("NEUPETINVDISPLAY", true); - petSlot.getTagCompound().setBoolean( - "NEUHIDEPETTOOLTIP", - NotEnoughUpdates.INSTANCE.config.petOverlay.hidePetTooltip - ); - ItemStack petInfo = petSlot; - - if (guiScreen instanceof GuiInventory) { - GL11.glTranslatef(0, 0, 401); - if (!NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud || !isWardrobeSystemOnMainServer()) { - if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 0) { - Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY); - } - if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 1) { - Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_GREY); - } - if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 2) { - Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_DARK); - } - if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3) { - Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_TRANSPARENT); - } - if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 4) { - Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_FSR); - } - } else { - if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 0) { - Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY); - } - if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 1) { - Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_GREY); - } - if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 2) { - Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_DARK); - } - if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3) { - Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_TRANSPARENT); - } - if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 4) { - Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_FSR); - } - } - - GlStateManager.color(1, 1, 1, 1); - float yNumber = (float) (height - 23) / 2f; - Utils.drawTexturedRect((float) ((width - 224.1) / 2f), yNumber, 31, 32, GL11.GL_NEAREST); - GlStateManager.bindTexture(0); - - 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")); @@ -2311,7 +2026,7 @@ public class NEUOverlay extends Gui { //Tab if (NotEnoughUpdates.INSTANCE.config.itemlist.tabOpen) { - Minecraft.getMinecraft().getTextureManager().bindTexture(itemPaneTabArrow); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.itemPaneTabArrow); GlStateManager.color(1f, 1f, 1f, 0.3f); Utils.drawTexturedRect(width - itemPaneTabOffset.getValue() * 64 / 20f, height / 2f - 32, 64, 64); GlStateManager.bindTexture(0); @@ -2373,8 +2088,8 @@ public class NEUOverlay extends Gui { Utils.drawTexturedRect(orderIconX, iconTop, scaledITEM_SIZE, scaledITEM_SIZE, 0, 1, 0, 1, GL11.GL_NEAREST); Minecraft.getMinecraft().getTextureManager().bindTexture(getCompareAscending().get(i) - ? ascending_overlay - : descending_overlay); + ? GuiTextures.ascending_overlay + : GuiTextures.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); @@ -2558,7 +2273,7 @@ public class NEUOverlay extends Gui { activeInfoPane.render(width, height, bg, fg, Utils.peekGuiScale(), mouseX, mouseY); GlStateManager.color(1f, 1f, 1f, 1f); - Minecraft.getMinecraft().getTextureManager().bindTexture(close); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.close); Utils.drawTexturedRect(rightSide - getBoxPadding() - 8, getBoxPadding() - 8, 16, 16); GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0); } @@ -2604,7 +2319,7 @@ public class NEUOverlay extends Gui { GlStateManager.enableAlpha(); GlStateManager.alphaFunc(516, 0.1F); GlStateManager.disableLighting(); - + renderInfoHuds(); Utils.pushGuiScale(-1); if (System.currentTimeMillis() - lastSearchMode > 120000 && @@ -2614,6 +2329,245 @@ public class NEUOverlay extends Gui { } } + void renderInfoHuds() { + FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; + + Utils.resetGuiScale(); + Utils.pushGuiScale(Minecraft.getMinecraft().gameSettings.guiScale); + + int width = Utils.peekGuiScale().getScaledWidth(); + int height = Utils.peekGuiScale().getScaledHeight(); + int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; + int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; + GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen; + + if (NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud && + NotEnoughUpdates.INSTANCE.config.misc.hidePotionEffect + && NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) { + if (getWardrobeSlot(10) != null) { + slot1 = getWardrobeSlot(10); + slot2 = getWardrobeSlot(19); + slot3 = getWardrobeSlot(28); + slot4 = getWardrobeSlot(37); + } + if (guiScreen instanceof GuiInventory) { + renderingArmorHud = true; + + List<String> tooltipToDisplay = null; + if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 0) { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY); + } + if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 1) { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_GREY); + } + if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 2) { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_DARK); + } + if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 3) { + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3 && + NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay && petSlot != null) { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_TRANSPARENT_PET); + } else { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_TRANSPARENT); + } + } + if (NotEnoughUpdates.INSTANCE.config.customArmour.colourStyle == 4) { + Minecraft.getMinecraft().getTextureManager().bindTexture(ARMOR_DISPLAY_FSR); + } + + GlStateManager.color(1, 1, 1, 1); + GL11.glTranslatef(0, 0, 401); + float yNumber = (float) (height - 167) / 2f; + Utils.drawTexturedRect((float) ((width - 224.1) / 2f), yNumber, 31, 86, GL11.GL_NEAREST); + GlStateManager.bindTexture(0); + + Utils.drawItemStack(slot1, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105)); + Utils.drawItemStack(slot2, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 18); + Utils.drawItemStack(slot3, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 36); + Utils.drawItemStack(slot4, (int) ((width - 208) / 2f), (int) ((height + 60) / 2f - 105) + 54); + if (slot1 == null) { + Minecraft.getMinecraft().getTextureManager().bindTexture(QUESTION_MARK); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(((width - 208) / 2f), ((height + 60) / 2f - 105), 16, 16, GL11.GL_NEAREST); + GlStateManager.bindTexture(0); + + tooltipToDisplay = Lists.newArrayList( + EnumChatFormatting.RED + "Warning", + EnumChatFormatting.GREEN + "You need to open /equipment", + EnumChatFormatting.GREEN + "To cache your armour" + ); + 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, "/equipment") == + 0) { + NotEnoughUpdates.INSTANCE.sendChatMessage("/equipment"); + } + } + } + } + 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); + } + 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, "/equipment") == + 0) { + NotEnoughUpdates.INSTANCE.sendChatMessage("/equipment"); + } + } + } + } + //top slot + int tooltipXModifier = -175; + if (mouseY >= ((height + 60) / 2f - 105) && mouseY <= ((height + 60) / 2f - 105) + 16) { + tooltipToDisplay = slot1.getTooltip(Minecraft.getMinecraft().thePlayer, false); + if (shouldShowEquipmentTooltip(tooltipToDisplay)) { + Utils.drawHoveringText(tooltipToDisplay, mouseX + tooltipXModifier, mouseY, width, height, -1, fr); + } + } + if (mouseY >= ((height + 60) / 2f - 105) + 18 && mouseY <= ((height + 60) / 2f - 105) + 34) { + tooltipToDisplay = slot2.getTooltip(Minecraft.getMinecraft().thePlayer, false); + if (shouldShowEquipmentTooltip(tooltipToDisplay)) { + Utils.drawHoveringText(tooltipToDisplay, mouseX + tooltipXModifier, mouseY, width, height, -1, fr); + } + } + if (mouseY >= ((height + 60) / 2f - 105) + 36 && mouseY <= ((height + 60) / 2f - 105) + 52) { + tooltipToDisplay = slot3.getTooltip(Minecraft.getMinecraft().thePlayer, false); + if (shouldShowEquipmentTooltip(tooltipToDisplay)) { + Utils.drawHoveringText(tooltipToDisplay, mouseX + tooltipXModifier, mouseY, width, height, -1, fr); + } + } + if (mouseY >= ((height + 60) / 2f - 105) + 54 && mouseY <= ((height + 60) / 2f - 105) + 70) { + tooltipToDisplay = slot4.getTooltip(Minecraft.getMinecraft().thePlayer, false); + if (shouldShowEquipmentTooltip(tooltipToDisplay)) { + Utils.drawHoveringText(tooltipToDisplay, mouseX + tooltipXModifier, mouseY, width, height, -1, fr); + } + } + } + GL11.glTranslatef(0, 0, -401); + } + } + } + if (PetInfoOverlay.getCurrentPet() != null) { + if (NotEnoughUpdates.INSTANCE.config.petOverlay.petInvDisplay + && (NotEnoughUpdates.INSTANCE.manager + .jsonToStack(NotEnoughUpdates.INSTANCE.manager + .getItemInformation() + .get(PetInfoOverlay.getCurrentPet().petType + ";" + PetInfoOverlay.getCurrentPet().rarity.petId)) + .hasDisplayName() + || NotEnoughUpdates.INSTANCE.manager + .jsonToStack(NotEnoughUpdates.INSTANCE.manager + .getItemInformation() + .get(PetInfoOverlay.getCurrentPet().petType + ";" + (PetInfoOverlay.getCurrentPet().rarity.petId - 1))) + .hasDisplayName()) + && NotEnoughUpdates.INSTANCE.config.misc.hidePotionEffect && + NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard()) { + if (!NotEnoughUpdates.INSTANCE.manager + .jsonToStack( + NotEnoughUpdates.INSTANCE.manager + .getItemInformation() + .get(PetInfoOverlay.getCurrentPet().petType + ";" + PetInfoOverlay.getCurrentPet().rarity.petId)) + .hasDisplayName()) { + petSlot = NotEnoughUpdates.INSTANCE.manager.jsonToStack( + NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( + PetInfoOverlay.getCurrentPet().petType + ";" + (PetInfoOverlay.getCurrentPet().rarity.petId - 1))); + } else { + petSlot = NotEnoughUpdates.INSTANCE.manager.jsonToStack( + NotEnoughUpdates.INSTANCE.manager.getItemInformation().get( + PetInfoOverlay.getCurrentPet().petType + ";" + PetInfoOverlay.getCurrentPet().rarity.petId)); + } + if (petSlot == null) { + return; + } + petSlot.getTagCompound().setBoolean( + "NEUHIDEPETTOOLTIP", + NotEnoughUpdates.INSTANCE.config.petOverlay.hidePetTooltip + ); + ItemStack petInfo = petSlot; + + if (guiScreen instanceof GuiInventory) { + GL11.glTranslatef(0, 0, 401); + if (!NotEnoughUpdates.INSTANCE.config.customArmour.enableArmourHud) { + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 0) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 1) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_GREY); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 2) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_DARK); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_TRANSPARENT); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 4) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_DISPLAY_FSR); + } + } else { + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 0) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 1) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_GREY); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 2) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_DARK); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 3) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_TRANSPARENT); + } + if (NotEnoughUpdates.INSTANCE.config.petOverlay.colourStyle == 4) { + Minecraft.getMinecraft().getTextureManager().bindTexture(PET_ARMOR_DISPLAY_FSR); + } + } + + GlStateManager.color(1, 1, 1, 1); + float yNumber = (float) (height - 23) / 2f; + Utils.drawTexturedRect((float) ((width - 224.1) / 2f), yNumber, 31, 32, GL11.GL_NEAREST); + GlStateManager.bindTexture(0); + + 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 - 200, mouseY, width, height, -1, fr); + GL11.glTranslatef(0, 0, -80); + } + } + + } + } + } + } + } + + private boolean shouldShowEquipmentTooltip(List<String> toolTip) { + return !toolTip.get(0).equals("§o§7Empty Equipment Slot§r"); + } + /** * Used in SettingsInfoPane to redraw the items when a setting changes. */ @@ -2825,7 +2779,7 @@ public class NEUOverlay extends Gui { return; } - Minecraft.getMinecraft().getTextureManager().bindTexture(item_mask); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.item_mask); if (getFavourites().contains(json.get("internalname").getAsString())) { if (NotEnoughUpdates.INSTANCE.config.itemlist.itemStyle == 0) { GlStateManager.color(fgFavourite2.getRed() / 255f, fgFavourite2.getGreen() / 255f, @@ -2907,7 +2861,7 @@ public class NEUOverlay extends Gui { GlStateManager.translate(0, 0, 50); if (searchedItemsSubgroup.containsKey(json.get("internalname").getAsString())) { - Minecraft.getMinecraft().getTextureManager().bindTexture(item_haschild); + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.item_haschild); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(x - 1, y - 1, ITEM_SIZE + 2, ITEM_SIZE + 2, GL11.GL_NEAREST); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java index f46c8334..cb2f06d6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -249,7 +249,7 @@ public class APIManager { if (lowestBins != null && lowestBins.has(internalname)) { JsonElement e = lowestBins.get(internalname); if (e.isJsonPrimitive() && e.getAsJsonPrimitive().isNumber()) { - return e.getAsInt(); + return e.getAsBigDecimal().intValue(); } } return -1; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java index 51a4654c..f3d038e9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/GuiElementTextField.java @@ -36,6 +36,7 @@ public class GuiElementTextField { private int y; private String prependText = ""; + private String masterStarUnicode = ""; private int customTextColour = 0xffffffff; private final GuiTextField textField = new GuiTextField(0, Minecraft.getMinecraft().fontRendererObj, @@ -395,6 +396,55 @@ public class GuiElementTextField { textField.setCursorPosition(pos + 1); } } + } else { + for (int i = 0; i < 10; i++) { + if (typedChar == Integer.toString(i + 1).charAt(0)) { + int pos = textField.getCursorPosition() - 2; + if (pos >= 0 && pos < textField.getText().length()) { + if (textField.getText().charAt(pos) == '*') { + switch (i) { + case 0: + masterStarUnicode = "\u278A"; + break; + case 1: + masterStarUnicode = "\u278B"; + break; + case 2: + masterStarUnicode = "\u278C"; + break; + case 3: + masterStarUnicode = "\u278D"; + break; + case 4: + masterStarUnicode = "\u278E"; + break; + case 5: + masterStarUnicode = "\u278F"; + break; + case 6: + masterStarUnicode = "\u2790"; + break; + case 7: + masterStarUnicode = "\u2791"; + break; + case 8: + masterStarUnicode = "\u2792"; + break; + case 9: + masterStarUnicode = "\u2793"; + break; + } + String before = textField.getText().substring(0, pos); + String after = ""; + if (pos + 2 < textField.getText().length()) { + after = textField.getText().substring(pos + 2); + } + textField.setText(before + masterStarUnicode + after); + textField.setCursorPosition(pos + 1); + } + } + } + } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java index d40a39f1..060dcb80 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ChatListener.java @@ -6,6 +6,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.CrystalMetalDetectorSol import io.github.moulberry.notenoughupdates.miscfeatures.StreamerMode; import io.github.moulberry.notenoughupdates.overlays.OverlayManager; import io.github.moulberry.notenoughupdates.overlays.SlayerOverlay; +import io.github.moulberry.notenoughupdates.overlays.TimersOverlay; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -122,6 +123,7 @@ public class ChatListener { public void onGuiChat(ClientChatReceivedEvent e) { if (e.type == 2) { CrystalMetalDetectorSolver.process(e.message); + TimersOverlay.processActionBar(e.message.getUnformattedText()); e.message = processChatComponent(e.message); return; } else if (e.type == 0) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java index cc2b11e8..ab4e9dca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ItemTooltipListener.java @@ -16,7 +16,6 @@ import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -36,10 +35,18 @@ import java.awt.*; import java.awt.datatransfer.StringSelection; import java.text.DecimalFormat; import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; import java.util.List; -import java.util.*; +import java.util.Locale; +import java.util.Map; +import java.util.Set; +import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; public class ItemTooltipListener { private static final String petToolTipRegex = @@ -81,18 +88,21 @@ public class ItemTooltipListener { String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); if (internalname == null) { - onItemToolTipInternalNameNull(event); return; } + petToolTipXPExtendPetMenu(event); boolean hasEnchantments = event.itemStack.getTagCompound().getCompoundTag("ExtraAttributes").hasKey( "enchantments", 10 ); + boolean hasAttributes = event.itemStack.getTagCompound().getCompoundTag("ExtraAttributes").hasKey( + "attributes", + 10 + ); Set<String> enchantIds = new HashSet<>(); - if (hasEnchantments) - enchantIds = - event.itemStack.getTagCompound().getCompoundTag("ExtraAttributes").getCompoundTag("enchantments").getKeySet(); + if (hasEnchantments) enchantIds = event.itemStack.getTagCompound().getCompoundTag("ExtraAttributes").getCompoundTag( + "enchantments").getKeySet(); JsonObject enchantsConst = Constants.ENCHANTS; JsonArray allItemEnchs = null; @@ -347,6 +357,8 @@ public class ItemTooltipListener { } } } + } + if (hasEnchantments || hasAttributes) { for (String op : NotEnoughUpdates.INSTANCE.config.hidden.enchantColours) { List<String> colourOps = GuiEnchantColour.splitter.splitToList(op); String enchantName = GuiEnchantColour.getColourOpIndex(colourOps, 0); @@ -387,11 +399,12 @@ public class ItemTooltipListener { //9([a-zA-Z ]+?) ([0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X))(,|$) Pattern pattern; try { - pattern = Pattern.compile("(\\u00A79|\\u00A7(9|l)\\u00A7d\\u00A7l)(?<enchantName>" + enchantName + ") " + - "(?<level>[0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X|XI|XII|XIII|XIV|XV|XVI|XVII|XVIII|XIX|XX))((\\u00A79)?,|( \\u00A78(?:,?[0-9]+)*)?$)"); + pattern = Pattern.compile( + "(\\u00A7b|\\u00A79|\\u00A7(b|9|l)\\u00A7d\\u00A7l)(?<enchantName>" + enchantName + ") " + + "(?<level>[0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X|XI|XII|XIII|XIV|XV|XVI|XVII|XVIII|XIX|XX))((\\u00A79)?,|( \\u00A78(?:,?[0-9]+)*)?$)"); } catch (Exception e) { continue; - } //malformed regex + } Matcher matcher = pattern.matcher(line); int matchCount = 0; while (matcher.find() && matchCount < 5) { @@ -400,73 +413,8 @@ public class ItemTooltipListener { matchCount++; int level = -1; String levelStr = matcher.group("level"); - if (levelStr == null) continue; - try { - level = Integer.parseInt(levelStr); - } catch (Exception e) { - switch (levelStr) { - case "I": - level = 1; - break; - case "II": - level = 2; - break; - case "III": - level = 3; - break; - case "IV": - level = 4; - break; - case "V": - level = 5; - break; - case "VI": - level = 6; - break; - case "VII": - level = 7; - break; - case "VIII": - level = 8; - break; - case "IX": - level = 9; - break; - case "X": - level = 10; - break; - case "XI": - level = 11; - break; - case "XII": - level = 12; - break; - case "XIII": - level = 13; - break; - case "XIV": - level = 14; - break; - case "XV": - level = 15; - break; - case "XVI": - level = 16; - break; - case "XVII": - level = 17; - break; - case "XVIII": - level = 18; - break; - case "XIX": - level = 19; - break; - case "XX": - level = 20; - break; - } - } + if (levelStr == null || levelStr.isEmpty()) continue; + level = Utils.parseIntOrRomanNumeral(levelStr); boolean matches = false; if (level > 0) { switch (comparator) { @@ -505,11 +453,16 @@ public class ItemTooltipListener { if (!colourCode.equals("z")) { line = line.replace("\u00A79" + enchantText, "\u00A7" + colourCode + extraMods + enchantText); + line = line.replace("\u00A7b" + enchantText, "\u00A7" + colourCode + extraMods + enchantText); line = line.replace( "\u00A79\u00A7d\u00A7l" + enchantText, "\u00A7" + colourCode + extraMods + enchantText ); line = line.replace( + "\u00A7b\u00A7d\u00A7l" + enchantText, + "\u00A7" + colourCode + extraMods + enchantText + ); + line = line.replace( "\u00A7l\u00A7d\u00A7l" + enchantText, "\u00A7" + colourCode + extraMods + enchantText ); @@ -741,10 +694,6 @@ public class ItemTooltipListener { } } - private void onItemToolTipInternalNameNull(ItemTooltipEvent event) { - petToolTipXPExtendPetMenu(event); - } - private List<String> petToolTipXPExtend(ItemTooltipEvent event) { List<String> tooltipText = new ArrayList<>(); if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.petExtendExp) { @@ -849,7 +798,6 @@ public class ItemTooltipListener { /** * This method does the following: - * Move the pet inventory display tooltip to the left to avoid conflicts * Remove reforge stats for Legendary items from Hypixel if enabled * Show NBT data when holding LCONTROL */ @@ -857,10 +805,6 @@ public class ItemTooltipListener { public void onItemTooltip(ItemTooltipEvent event) { if (!neu.isOnSkyblock()) return; if (event.toolTip == null) return; - //Render the pet inventory display tooltip to the left to avoid things from other mods rendering over the tooltip - if (event.itemStack.getTagCompound() != null && event.itemStack.getTagCompound().getBoolean("NEUPETINVDISPLAY")) { - GlStateManager.translate(-200, 0, 0); - } if (event.toolTip.size() > 2 && NotEnoughUpdates.INSTANCE.config.tooltipTweaks.hideDefaultReforgeStats) { String secondLine = StringUtils.stripControlCodes(event.toolTip.get(1)); @@ -929,7 +873,9 @@ public class ItemTooltipListener { } else if (NotEnoughUpdates.INSTANCE.packDevEnabled) { event.toolTip.add(""); event.toolTip.add(EnumChatFormatting.AQUA + "NEU Pack Dev Info:"); - event.toolTip.add(EnumChatFormatting.GRAY + "Press " + EnumChatFormatting.GOLD + "[KEY]" + EnumChatFormatting.GRAY + " to copy line"); + event.toolTip.add( + EnumChatFormatting.GRAY + "Press " + EnumChatFormatting.GOLD + "[KEY]" + EnumChatFormatting.GRAY + + " to copy line"); String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/listener/ScoreboardLocationChangeListener.java b/src/main/java/io/github/moulberry/notenoughupdates/listener/ScoreboardLocationChangeListener.java new file mode 100644 index 00000000..2f4ec33c --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/listener/ScoreboardLocationChangeListener.java @@ -0,0 +1,30 @@ +package io.github.moulberry.notenoughupdates.listener; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.overlays.TimersOverlay; + +public class ScoreboardLocationChangeListener { + + public ScoreboardLocationChangeListener(String oldLocation, String newLocation) { + if (oldLocation.equals("Belly of the Beast") && newLocation.equals("Matriarchs Lair")) { + //Check inventory pearl count for AFTER they complete to see if it is the same as before + (amount available on actionbar) + Thread thread = new Thread(() -> { + try { + Thread.sleep(3000); + TimersOverlay.afterPearls = TimersOverlay.heavyPearlCount(); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW+"You exited the beast with ["+EnumChatFormatting.AQUA+(TimersOverlay.afterPearls-TimersOverlay.beforePearls)+EnumChatFormatting.YELLOW+"/"+EnumChatFormatting.AQUA+TimersOverlay.availablePearls+EnumChatFormatting.YELLOW+"] Heavy Pearls!")); + if (TimersOverlay.afterPearls - TimersOverlay.beforePearls == TimersOverlay.availablePearls) { + NotEnoughUpdates.INSTANCE.config.getProfileSpecific().dailyHeavyPearlCompleted = System.currentTimeMillis(); + //Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.GREEN+"Daily "+EnumChatFormatting.DARK_AQUA+"Heavy Pearls"+EnumChatFormatting.GREEN+" Complete!")); + } + } catch (InterruptedException e) { + e.printStackTrace(); + } + }); + thread.start(); + } else if (oldLocation.equals("Matriarchs Lair") && newLocation.equals("Belly of the Beast")) { + //Check inventory pearl count BEFORE they complete so we can later check if it is complete. + TimersOverlay.beforePearls = TimersOverlay.heavyPearlCount(); + } + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java index 977ef818..9686e97a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalWishingCompassSolver.java @@ -757,7 +757,7 @@ public class CrystalWishingCompassSolver { String targetNameForSkytils = solutionPossibleTargets.size() == 1 ? getNameForCompassTarget(solutionPossibleTargets.iterator().next()) : "WishingTarget"; - String skytilsCommand = String.format("/sthw add %s %s", targetNameForSkytils, getSolutionCoordsText()); + String skytilsCommand = String.format("/sthw add %s %s", getSolutionCoordsText(), targetNameForSkytils); if (NotEnoughUpdates.INSTANCE.config.mining.wishingCompassAutocreateKnownWaypoints && solutionPossibleTargets.size() == 1) { mc.thePlayer.addChatMessage(new ChatComponentText(destinationMessage)); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java index 34e849d0..b88eca99 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FishingHelper.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.util.SpecialColour; import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.ISound; import net.minecraft.client.audio.PositionedSound; @@ -11,8 +12,10 @@ import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; +import net.minecraft.util.BlockPos; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; import net.minecraftforge.event.entity.player.PlayerInteractEvent; @@ -21,7 +24,13 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.lwjgl.opengl.GL11; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; public class FishingHelper { private static final FishingHelper INSTANCE = new FishingHelper(); @@ -257,7 +266,17 @@ public class FishingHelper { double angle2 ) { double dY = particleY - hook.posY; - if (Math.abs(dY) > 0.5f) { + double tolerance = 0.5F; + if (hook.worldObj != null) { + for (int i = -2; i < 2; i++) { + IBlockState state = hook.worldObj.getBlockState(new BlockPos(particleX, particleY + i, particleZ)); + if (state != null && (state.getBlock() == Blocks.flowing_lava + || state.getBlock() == Blocks.flowing_water + || state.getBlock() == Blocks.lava)) + tolerance = 2.0F; + } + } + if (Math.abs(dY) > tolerance) { return HookPossibleRet.NOT_POSSIBLE; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index 281830c3..6203a36d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -812,7 +812,7 @@ public class PetInfoOverlay extends TextOverlay { if (currentTime - lastPetSelect > 500) { boolean foundDespawn = false; for (String line : lore) { - if (line.equals("\u00a77\u00a7cClick to despawn.")) { + if (line.startsWith("\u00a77\u00a7cClick to despawn")) { config.selectedPet = petIndex; foundDespawn = true; break; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java index a9cf44c4..06cf28e1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/CalendarOverlay.java @@ -659,6 +659,8 @@ public class CalendarOverlay { } } } + } else { + Minecraft.getMinecraft().dispatchKeypresses(); } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java index bd4bd680..4e865b28 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java @@ -66,7 +66,9 @@ public class GuiEnchantColour extends GuiScreen { private static final Pattern settingPattern = Pattern.compile(".*:[>=<]:[0-9]+:[a-zA-Z0-9]+(:[a-zA-Z0-9]+)?"); private ItemStack maxedBook; + private ItemStack maxedAttBook; private int maxedBookFound = 0; + private int maxedAttBookFound = 0; private List<String> getEnchantColours() { return NotEnoughUpdates.INSTANCE.config.hidden.enchantColours; @@ -227,13 +229,37 @@ public class GuiEnchantColour extends GuiScreen { if (maxedBookFound == 1) { Utils.drawItemStack(maxedBook, guiLeft + xSize + 3, guiTopSidebar - 34); } + if (maxedAttBookFound == 0) { + try { + if (NotEnoughUpdates.INSTANCE.manager.jsonToStack( + NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("MAXED_ATTRIBUTE_SHARD")).hasDisplayName()) { + maxedAttBook = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager + .getItemInformation() + .get("MAXED_ATTRIBUTE_SHARD")); + maxedAttBookFound = 1; + } else { + maxedAttBookFound = 2; + } - if (mouseX >= guiLeft + xSize + 3 && mouseX < guiLeft + xSize + 19) { + } catch (Exception ignored) { + maxedAttBookFound = 2; + } + } + if (maxedAttBookFound == 1) { + Utils.drawItemStack(maxedAttBook, guiLeft + xSize + 3, guiTopSidebar - 52); + } + + if (mouseX >= guiLeft + xSize + 3 && mouseX < guiLeft + xSize + 39) { if (mouseY >= guiTopSidebar - 34 && mouseY <= guiTopSidebar - 18 && maxedBookFound == 1) { tooltipToDisplay = maxedBook.getTooltip(Minecraft.getMinecraft().thePlayer, false); Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); tooltipToDisplay = null; } + if (mouseY >= guiTopSidebar - 52 && mouseY <= guiTopSidebar - 34 && maxedAttBookFound == 1) { + tooltipToDisplay = maxedAttBook.getTooltip(Minecraft.getMinecraft().thePlayer, false); + Utils.drawHoveringText(tooltipToDisplay, mouseX, mouseY, width, height, -1, fr); + tooltipToDisplay = null; + } if (mouseY >= guiTopSidebar - 18 && mouseY <= guiTopSidebar - 2) { tooltipToDisplay = Lists.newArrayList( EnumChatFormatting.AQUA + "NEUEC Colouring Guide", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java index 222a0f88..12d48991 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java @@ -199,6 +199,7 @@ public class GuiItemCustomize extends GuiScreen { EnumChatFormatting.GREEN + "", EnumChatFormatting.GREEN + "Type \"&&\" to use colour codes", EnumChatFormatting.GREEN + "Type \"**\" for \u272A", + EnumChatFormatting.GREEN + "Type \"*1-9\" for \u278A-\u2792", EnumChatFormatting.GREEN + "", EnumChatFormatting.GREEN + "Available colour codes:", Utils.chromaString("\u00B6z = Chroma"), diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java index 66014b1f..e2381503 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiPriceGraph.java @@ -36,7 +36,7 @@ public class GuiPriceGraph extends GuiScreen { private final ResourceLocation TEXTURE; private static final int X_SIZE = 364; private static final int Y_SIZE = 215; - private Data dataPoints; + private ItemData itemData; private float highestValue; private long firstTime; private long lastTime; @@ -117,7 +117,8 @@ public class GuiPriceGraph extends GuiScreen { Utils.drawStringCentered("Loading...", Minecraft.getMinecraft().fontRendererObj, guiLeft + 166, guiTop + 116, false, 0xffffff00 ); - else if (dataPoints == null || dataPoints.get() == null || dataPoints.get().size() <= 1 || lowestValue == null) + else if ( + itemData == null || itemData.get() == null || itemData.get().size() <= 1 || lowestValue == null) Utils.drawStringCentered("No data found.", Minecraft.getMinecraft().fontRendererObj, guiLeft + 166, guiTop + 116, false, 0xffff0000 ); @@ -127,16 +128,16 @@ public class GuiPriceGraph extends GuiScreen { Integer lowestDist = null; Long lowestDistTime = null; HashMap<Integer, Integer> secondLineData = new HashMap<>(); - for (int i = (dataPoints.isBz() ? 1 : 0); i >= 0; i--) { + for (int i = (itemData.isBz() ? 1 : 0); i >= 0; i--) { Utils.drawGradientRect(0, guiLeft + 17, guiTop + 35, guiLeft + 315, guiTop + 198, changeAlpha(i == 0 ? graphColor : graphColor2, 120), changeAlpha(i == 0 ? graphColor : graphColor2, 10) ); Integer prevX = null; Integer prevY = null; - for (Long time : dataPoints.get().keySet()) { - float price = dataPoints.isBz() - ? i == 0 ? dataPoints.bz.get(time).b : dataPoints.bz.get(time).s - : dataPoints.ah.get(time); + for (Long time : itemData.get().keySet()) { + float price = itemData.isBz() + ? i == 0 ? itemData.bz.get(time).b : itemData.bz.get(time).s + : itemData.ah.get(time); int xPos = (int) map(time, firstTime, lastTime, guiLeft + 17, guiLeft + 315); int yPos = (int) map(price, highestValue + 10d, lowestValue - 10d, guiTop + 35, guiTop + 198); if (prevX != null) { @@ -159,7 +160,7 @@ public class GuiPriceGraph extends GuiScreen { ); if (i == 0) { Utils.drawLine(prevX, prevY + 0.5f, xPos, yPos + 0.5f, 2, graphColor); - if (dataPoints.isBz()) + if (itemData.isBz()) Utils.drawLine( prevX, secondLineData.get(prevX) + 0.5f, @@ -218,8 +219,8 @@ public class GuiPriceGraph extends GuiScreen { Utils.drawDottedLine(customStart, guiTop + 197, customEnd, guiTop + 197, 2, 10, 0xFFc6c6c6); } if (lowestDist != null && !customSelecting) { - float price = dataPoints.isBz() ? dataPoints.bz.get(lowestDistTime).b : dataPoints.ah.get(lowestDistTime); - Float price2 = dataPoints.isBz() ? dataPoints.bz.get(lowestDistTime).s : null; + float price = itemData.isBz() ? itemData.bz.get(lowestDistTime).b : itemData.ah.get(lowestDistTime); + Float price2 = itemData.isBz() ? itemData.bz.get(lowestDistTime).s : null; int xPos = (int) map(lowestDistTime, firstTime, lastTime, guiLeft + 17, guiLeft + 315); int yPos = (int) map(price, highestValue + 10d, lowestValue - 10d, guiTop + 35, guiTop + 198); int yPos2 = price2 != null @@ -243,7 +244,7 @@ public class GuiPriceGraph extends GuiScreen { NumberFormat nf = NumberFormat.getInstance(); ArrayList<String> text = new ArrayList<>(); text.add(displayFormat.format(date)); - if (dataPoints.isBz()) { + if (itemData.isBz()) { text.add(EnumChatFormatting.YELLOW + "" + EnumChatFormatting.BOLD + "Bazaar Insta-Buy: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + nf.format(price)); text.add(EnumChatFormatting.YELLOW + "" + EnumChatFormatting.BOLD + "Bazaar Insta-Sell: " + @@ -320,7 +321,7 @@ public class GuiPriceGraph extends GuiScreen { } private void loadData() { - dataPoints = null; + itemData = null; loaded = false; new Thread(() -> { File dir = new File("config/notenoughupdates/prices"); @@ -329,46 +330,46 @@ public class GuiPriceGraph extends GuiScreen { return; } File[] files = dir.listFiles(); - Data data = new Data(); + ItemData itemData = new ItemData(); if (files == null) return; for (File file : files) { if (!file.getName().endsWith(".gz")) continue; - HashMap<String, Data> data2 = load(file); + HashMap<String, ItemData> data2 = load(file); if (data2 == null || !data2.containsKey(itemId)) continue; if (data2.get(itemId).isBz()) { - if (data.bz == null) data.bz = data2.get(itemId).bz; - else data.bz.putAll(data2.get(itemId).bz); - } else if (data.ah == null) data.ah = data2.get(itemId).ah; - else data.ah.putAll(data2.get(itemId).ah); + if (itemData.bz == null) itemData.bz = data2.get(itemId).bz; + else itemData.bz.putAll(data2.get(itemId).bz); + } else if (itemData.ah == null) itemData.ah = data2.get(itemId).ah; + else itemData.ah.putAll(data2.get(itemId).ah); } - if (data.get() != null && !data.get().isEmpty()) { + if (itemData.get() != null && !itemData.get().isEmpty()) { if (mode < 3) - data = new Data( - new TreeMap<>(data.get().entrySet().stream() - .filter(e -> e.getKey() > System.currentTimeMillis() / 1000 - + itemData = new ItemData( + new TreeMap<>(itemData.get().entrySet().stream() + .filter(e -> e.getKey() > System.currentTimeMillis() / 1000 - (mode == 0 ? 3600 : mode == 1 ? 86400 : 604800)) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))), - data.isBz() + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))), + itemData.isBz() ); else if (mode == 4) - data = new Data( - new TreeMap<>(data.get().entrySet().stream() - .filter(e -> e.getKey() >= customStart && e.getKey() <= customEnd) - .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))), - data.isBz() + itemData = new ItemData( + new TreeMap<>(itemData.get().entrySet().stream() + .filter(e -> e.getKey() >= customStart && e.getKey() <= customEnd) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue))), + itemData.isBz() ); - if (data.get() == null || data.get().isEmpty()) { + if (itemData.get() == null || itemData.get().isEmpty()) { loaded = true; return; } - dataPoints = trimData(data); - firstTime = dataPoints.get().firstKey(); - lastTime = dataPoints.get().lastKey(); + this.itemData = trimData(itemData); + firstTime = this.itemData.get().firstKey(); + lastTime = this.itemData.get().lastKey(); highestValue = 0; lowestValue = null; - for (long key : dataPoints.get().keySet()) { - float value1 = dataPoints.isBz() ? dataPoints.bz.get(key).b : dataPoints.ah.get(key); - Float value2 = dataPoints.isBz() ? dataPoints.bz.get(key).s : null; + for (long key : this.itemData.get().keySet()) { + float value1 = this.itemData.isBz() ? this.itemData.bz.get(key).b : this.itemData.ah.get(key); + Float value2 = this.itemData.isBz() ? this.itemData.bz.get(key).s : null; if (value1 > highestValue) { highestValue = value1; } @@ -404,33 +405,13 @@ public class GuiPriceGraph extends GuiScreen { Date date = new Date(); Long epochSecond = date.toInstant().getEpochSecond(); File file = new File(dir, "prices_" + format.format(date) + ".gz"); - HashMap<String, Data> prices = new HashMap<>(); + HashMap<String, ItemData> prices = new HashMap<>(); if (file.exists()) { - HashMap<String, Data> tempPrices = load(file); + HashMap<String, ItemData> tempPrices = load(file); if (tempPrices != null) prices = tempPrices; } for (Map.Entry<String, JsonElement> item : items.entrySet()) { - if (prices.containsKey(item.getKey())) { - if (bazaar && item.getValue().getAsJsonObject().has("curr_buy") && item.getValue().getAsJsonObject().has( - "curr_sell")) - prices.get(item.getKey()).bz.put(epochSecond, new BzData( - item.getValue().getAsJsonObject().get("curr_buy").getAsFloat(), - item.getValue().getAsJsonObject().get("curr_sell").getAsFloat() - )); - else if (!bazaar) - prices.get(item.getKey()).ah.put(epochSecond, item.getValue().getAsBigDecimal().intValue()); - } else { - TreeMap<Long, Object> mapData = new TreeMap<>(); - if (bazaar && item.getValue().getAsJsonObject().has("curr_buy") && item.getValue().getAsJsonObject().has( - "curr_sell")) - mapData.put(epochSecond, new BzData( - item.getValue().getAsJsonObject().get("curr_buy").getAsFloat(), - item.getValue().getAsJsonObject().get("curr_sell").getAsFloat() - )); - else if (!bazaar) - mapData.put(epochSecond, item.getValue().getAsLong()); - prices.put(item.getKey(), new Data(mapData, bazaar)); - } + addOrUpdateItemPriceInfo(item, prices, epochSecond, bazaar); } //noinspection ResultOfMethodCallIgnored file.createNewFile(); @@ -447,16 +428,64 @@ public class GuiPriceGraph extends GuiScreen { } } - private Data trimData(Data data) { - long first = data.get().firstKey(); - long last = data.get().lastKey(); - Data trimmed = new Data(); - if (data.isBz()) + private static void addOrUpdateItemPriceInfo(Map.Entry<String, JsonElement> item, HashMap<String, ItemData> prices, long timestamp, boolean bazaar) { + String itemName = item.getKey(); + ItemData existingItemData = null; + if (prices.containsKey(itemName)) { + existingItemData = prices.get(itemName); + } + + // Handle transitions from ah to bz (the other direction typically doesn't happen) + if (existingItemData != null) { + if (existingItemData.isBz() && !bazaar) { + return; + } + + if (!existingItemData.isBz() && bazaar) { + prices.remove(itemName); + existingItemData = null; + } + } + + if (bazaar) { + if (!item.getValue().getAsJsonObject().has("curr_buy") || + !item.getValue().getAsJsonObject().has("curr_sell") + ) { + return; + } + + BzData bzData = new BzData( + item.getValue().getAsJsonObject().get("curr_buy").getAsFloat(), + item.getValue().getAsJsonObject().get("curr_sell").getAsFloat()); + + if (existingItemData != null) { + existingItemData.bz.put(timestamp, bzData); + } else { + TreeMap<Long, Object> mapData = new TreeMap<>(); + mapData.put(timestamp, bzData); + prices.put(item.getKey(), new ItemData(mapData, true)); + } + } else { + if (existingItemData != null) { + prices.get(item.getKey()).ah.put(timestamp, item.getValue().getAsBigDecimal().intValue()); + } else { + TreeMap<Long, Object> mapData = new TreeMap<>(); + mapData.put(timestamp, item.getValue().getAsLong()); + prices.put(item.getKey(), new ItemData(mapData, false)); + } + } + } + + private ItemData trimData(ItemData itemData) { + long first = itemData.get().firstKey(); + long last = itemData.get().lastKey(); + ItemData trimmed = new ItemData(); + if (itemData.isBz()) trimmed.bz = new TreeMap<>(); else trimmed.ah = new TreeMap<>(); int zones = NotEnoughUpdates.INSTANCE.config.ahGraph.graphZones; - Long[] dataArray = !data.isBz() ? data.ah.keySet().toArray(new Long[0]) : data.bz.keySet().toArray(new Long[0]); + Long[] dataArray = !itemData.isBz() ? itemData.ah.keySet().toArray(new Long[0]) : itemData.bz.keySet().toArray(new Long[0]); int prev = 0; for (int i = 0; i < zones; i++) { long lowest = (long) map(i, 0, zones, first, last); @@ -467,14 +496,14 @@ public class GuiPriceGraph extends GuiScreen { for (int l = prev; l < dataArray.length; l++) { if (dataArray[l] >= lowest && dataArray[l] <= highest) { amount++; - sumBuy += data.isBz() ? data.bz.get(dataArray[l]).b : data.ah.get(dataArray[l]); - if (data.isBz()) sumSell += data.bz.get(dataArray[l]).s; + sumBuy += itemData.isBz() ? itemData.bz.get(dataArray[l]).b : itemData.ah.get(dataArray[l]); + if (itemData.isBz()) sumSell += itemData.bz.get(dataArray[l]).s; prev = l + 1; } else if (dataArray[l] > highest) break; } if (amount > 0) { - if (data.isBz()) + if (itemData.isBz()) trimmed.bz.put(lowest, new BzData((float) (sumBuy / amount), (float) (sumSell / amount))); else trimmed.ah.put(lowest, (int) (sumBuy / amount)); @@ -483,8 +512,8 @@ public class GuiPriceGraph extends GuiScreen { return trimmed; } - private static HashMap<String, Data> load(File file) { - Type type = new TypeToken<HashMap<String, Data>>() { + private static HashMap<String, ItemData> load(File file) { + Type type = new TypeToken<HashMap<String, ItemData>>() { }.getType(); if (file.exists()) { try ( @@ -525,14 +554,14 @@ public class GuiPriceGraph extends GuiScreen { } } -class Data { +class ItemData { public TreeMap<Long, Integer> ah = null; public TreeMap<Long, BzData> bz = null; - public Data() { + public ItemData() { } - public Data(TreeMap<Long, ?> map, boolean bz) { + public ItemData(TreeMap<Long, ?> map, boolean bz) { if (bz) this.bz = (TreeMap<Long, BzData>) map; else diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index 71f7b0ab..2e31fbf3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -513,9 +513,10 @@ public class NEUConfig extends Config { public long dailyGemstonePowderCompleted = 0L; @Expose public long dailyMithrilPowerCompleted = 0L; - @Expose public HashMap<String, Boolean> unlockedWarpScrolls = new HashMap<>(); + @Expose + public long dailyHeavyPearlCompleted = 0L; } public HiddenLocationSpecific getLocationSpecific() { 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 f1b2338f..edfd2276 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,8 +17,8 @@ public class CustomArmour { @Expose @ConfigOption( - name = "Click To Open Wardrobe", - desc = "Click on the hud to open /wardrobe" + name = "Click To Open equipment menu", + desc = "Click on the hud to open /equipment" ) @ConfigEditorBoolean public boolean sendWardrobeCommand = true; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java index d69eca82..03465db7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/DungeonMapConfig.java @@ -136,7 +136,7 @@ public class DungeonMapConfig { @Expose @ConfigOption( name = "Position", - desc = "The position of the map" + desc = "Change the position of the map" ) public Position dmPosition = new Position(10, 10); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java index 2fedf559..9298623b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java @@ -242,7 +242,7 @@ public class ItemOverlays { @Expose @ConfigOption( name = "Bonemerang Overlay Position", - desc = "The position of the Bonemerang overlay." + desc = "Change the position of the Bonemerang overlay." ) @ConfigEditorButton( runnableId = 9, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/LocationEdit.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/LocationEdit.java index 385a3cc1..462fbd92 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/LocationEdit.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/LocationEdit.java @@ -20,7 +20,7 @@ public class LocationEdit { @Expose @ConfigOption( name = "Edit Pet Info Position", - desc = "The position of the pet info overlay." + desc = "Change the position of the pet info overlay" ) @ConfigEditorButton( runnableId = 4, @@ -37,13 +37,12 @@ public class LocationEdit { runnableId = 5, buttonText = "Edit" ) - @ConfigAccordionId(id = 0) public Position todoPosition = new Position(100, 0); @Expose @ConfigOption( name = "Edit Bonemerang Overlay Position", - desc = "The position of the Bonemerang overlay." + desc = "Change the position of the Bonemerang overlay" ) @ConfigEditorButton( runnableId = 9, @@ -72,7 +71,7 @@ public class LocationEdit { @Expose @ConfigOption( name = "Edit Toolbar Positions", - desc = "Edit the position of the QuickCommands / Search Bar" + desc = "Change the position of the QuickCommands / Search Bar" ) @ConfigAccordionId(id = 1) @ConfigEditorButton(runnableId = 6, buttonText = "Edit") @@ -109,7 +108,7 @@ public class LocationEdit { @Expose @ConfigOption( name = "Edit Crystal Overlay Position", - desc = "Change the position of the Crystal Hollows Overlay." + desc = "Change the position of the Crystal Hollows Overlay" ) @ConfigEditorButton( runnableId = 10, @@ -121,7 +120,7 @@ public class LocationEdit { @Expose @ConfigOption( name = "Edit Fuel Bar Position", - desc = "Set the position of the drill fuel bar" + desc = "Change the position of the drill fuel bar" ) @ConfigEditorButton( runnableId = 2, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index 9ff88089..697cabf3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -84,7 +84,7 @@ public class Mining { @Expose @ConfigOption( name = "Edit Fuel Bar Position", - desc = "Set the position of the drill fuel bar" + desc = "Change the position of the drill fuel bar" ) @ConfigEditorButton( runnableId = 2, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java index 849f5823..616e8188 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/MiscOverlays.java @@ -42,10 +42,11 @@ public class MiscOverlays { "\u00a73Experiments: \u00a7e3h38m", "\u00a73Daily Mithril Powder: \u00a7e3h38m", "\u00a73Daily Gemstone Powder: \u00a7e3h38m", + "\u00a73Daily Heavy Pearls: \u00a7e3h38m", } ) @ConfigAccordionId(id = 0) - public List<Integer> todoText2 = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8)); + public List<Integer> todoText2 = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)); @ConfigOption( name = "Show Only If Soon", @@ -163,6 +164,19 @@ public class MiscOverlays { ) public int dailyGemstonePowderDisplay = 0; + @Expose + @ConfigOption( + name = "Daily Heavy Pearl Display", + desc = "Change the way the daily heavy pearl displays\n" + + "Only when ready, When very Soon, When soon, When kinda soon or always." + ) + @ConfigAccordionId(id = 1) + @ConfigEditorDropdown( + values = {"Only when ready", "When very Soon", "When soon", "When Kinda Soon", "Always"} + ) + + public int dailyHeavyPearlDisplay = 0; + @ConfigOption( name = "Colours", desc = "" 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 6f96e972..9cba8202 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 @@ -20,7 +20,7 @@ public class PetOverlay { @Expose @ConfigOption( name = "Edit Pet Info Position", - desc = "The position of the pet info." + desc = "Change the position of the pet info overlay" ) @ConfigEditorButton( runnableId = 4, diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java index ff1b94c5..741b57e5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java @@ -7,7 +7,7 @@ public class Toolbar { @Expose @ConfigOption( name = "Edit Toolbar Positions", - desc = "Edit the position of the QuickCommands / Search Bar" + desc = "Change the position of the QuickCommands / Search Bar" ) @ConfigEditorButton(runnableId = 6, buttonText = "Edit") public boolean positionButton = true; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java index 7281eecf..36b37766 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AuctionSearchOverlay.java @@ -35,6 +35,7 @@ public class AuctionSearchOverlay { private static final ResourceLocation SEARCH_OVERLAY_TEXTURE_TAB_COMPLETED = new ResourceLocation( "notenoughupdates:auc_search/ah_search_overlay_tab_completed.png"); private static final ResourceLocation STAR = new ResourceLocation("notenoughupdates:auc_search/star.png"); + private static final ResourceLocation MASTER_STAR = new ResourceLocation("notenoughupdates:auc_search/master_star.png"); private static final ResourceLocation STAR_BOARD = new ResourceLocation("notenoughupdates:auc_search/star_board.png"); private static final GuiElementTextField textField = new GuiElementTextField("", 200, 20, 0); @@ -114,22 +115,26 @@ public class AuctionSearchOverlay { Utils.drawTexturedRect(width / 2 - 100, topY - 1, 203, h, 0, 203 / 512f, 0, h / 256f, GL11.GL_NEAREST); Minecraft.getMinecraft().getTextureManager().bindTexture(STAR_BOARD); - Utils.drawTexturedRect(width / 2 + 105, topY + 27, 55, 13, GL11.GL_NEAREST); + Utils.drawTexturedRect(width / 2 + 105, topY + 27, 105, 13, GL11.GL_NEAREST); Minecraft.getMinecraft().getTextureManager().bindTexture(STAR); GlStateManager.color(1, 1, 1, 1); - int stars = atLeast && selectedStars > 0 ? 5 : selectedStars; + int stars = atLeast && selectedStars > 0 ? 10 : selectedStars; for (int i = 0; i < stars; i++) { + if (i >= 5) { + Minecraft.getMinecraft().getTextureManager().bindTexture(MASTER_STAR); + GlStateManager.color(1, 1, 1, 1); + } if (i >= selectedStars) { GlStateManager.color(1, 1, 1, 0.3f); } Utils.drawTexturedRect(width / 2 + 108 + 10 * i, topY + 29, 9, 10, GL11.GL_NEAREST); } - Gui.drawRect(width / 2 + 106, topY + 42, width / 2 + 115, topY + 51, 0xffffffff); - Gui.drawRect(width / 2 + 107, topY + 43, width / 2 + 114, topY + 50, 0xff000000); - if (atLeast) Gui.drawRect(width / 2 + 108, topY + 44, width / 2 + 113, topY + 49, 0xffffffff); - Minecraft.getMinecraft().fontRendererObj.drawString("At Least?", width / 2 + 117, topY + 43, 0xffffff); + if (selectedStars < 6) Gui.drawRect(width / 2 + 106, topY + 42, width / 2 + 115, topY + 51, 0xffffffff); + if (selectedStars < 6) Gui.drawRect(width / 2 + 107, topY + 43, width / 2 + 114, topY + 50, 0xff000000); + if (atLeast && selectedStars < 6) Gui.drawRect(width / 2 + 108, topY + 44, width / 2 + 113, topY + 49, 0xffffffff); + if (selectedStars < 6) Minecraft.getMinecraft().fontRendererObj.drawString("At Least?", width / 2 + 117, topY + 43, 0xffffff); Minecraft.getMinecraft().fontRendererObj.drawString("Enter Query:", width / 2 - 100, topY - 10, 0xdddddd, true); @@ -507,10 +512,10 @@ public class AuctionSearchOverlay { topY = height / 2 - h / 2 + 5; } - if (Mouse.getEventButtonState() && mouseX > width / 2 + 105 && mouseX < width / 2 + 105 + 55 && + if (Mouse.getEventButtonState() && mouseX > width / 2 + 105 && mouseX < width / 2 + 105 + 105 && mouseY > topY + 27 && mouseY < topY + 40) { - int starClicked = 5; - for (int i = 1; i <= 5; i++) { + int starClicked = 10; + for (int i = 1; i <= 10; i++) { if (mouseX < width / 2 + 108 + 10 * i) { starClicked = i; break; @@ -584,9 +589,27 @@ public class AuctionSearchOverlay { searchStringExtra = ""; if (essenceCosts != null && essenceCosts.has(str) && selectedStars > 0) { for (int i = 0; i < selectedStars; i++) { + if (i > 4) break; searchStringExtra += "\u272A"; } - if (selectedStars < 5 && !atLeast) { + switch (selectedStars) { + case 6: + searchStringExtra += "\u278A"; + break; + case 7: + searchStringExtra += "\u278B"; + break; + case 8: + searchStringExtra += "\u278C"; + break; + case 9: + searchStringExtra += "\u278D"; + break; + case 10: + searchStringExtra += "\u278E"; + break; + } + if (selectedStars < 6 && !atLeast) { searchStringExtra += " "; searchStringExtra += stack.getItem().getItemStackDisplayName(stack).substring(0, 1); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java index ede30448..d3f17fbf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -13,6 +13,7 @@ import net.minecraft.init.Items; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; @@ -186,6 +187,11 @@ public class TimersOverlay extends TextOverlay { .getItemInformation() .get("PERFECT_AMETHYST_GEM")); break; + case "Daily Heavy Pearls": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager + .getItemInformation() + .get("HEAVY_PEARL")); + break; } if (icon != null) { @@ -529,6 +535,7 @@ public class TimersOverlay extends TextOverlay { } long midnightReset = (currentTime - 18000000) / 86400000 * 86400000 + 18000000; // 12am est + long pearlsReset = midnightReset - 14400000; //8pm est long catacombsReset = currentTime / 86400000 * 86400000; // 7pm est long timeDiffMidnightNow = midnightReset + 86400000 - currentTime; long catacombsDiffNow = catacombsReset + 86400000 - currentTime; @@ -743,6 +750,49 @@ public class TimersOverlay extends TextOverlay { ); } + //Daily Heavy Pearl Display + if (hidden.dailyHeavyPearlCompleted < pearlsReset) { + map.put( + 9, + DARK_AQUA + "Daily Heavy Pearls: " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.readyColour] + "Ready!" + ); + } else if ( + NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyHeavyPearlDisplay >= DISPLAYTYPE.VERYSOON.ordinal() && + (hidden.dailyHeavyPearlCompleted < (pearlsReset - TimeEnums.HALFANHOUR.time))) { + map.put( + 9, + DARK_AQUA + "Daily Heavy Pearls: " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.verySoonColour] + + Utils.prettyTime(pearlsReset + 86400000 - currentTime) + ); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyHeavyPearlDisplay >= DISPLAYTYPE.SOON.ordinal() && + (hidden.dailyHeavyPearlCompleted < (pearlsReset - TimeEnums.HOUR.time))) { + map.put( + 9, + DARK_AQUA + "Daily Heavy Pearls: " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.soonColour] + + Utils.prettyTime(pearlsReset + 86400000 - currentTime) + ); + } else if ( + NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyHeavyPearlDisplay >= DISPLAYTYPE.KINDASOON.ordinal() && + (hidden.dailyHeavyPearlCompleted < (pearlsReset - (TimeEnums.HOUR.time * 3)))) { + map.put( + 9, + DARK_AQUA + "Daily Heavy Pearls: " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour] + + Utils.prettyTime(pearlsReset + 86400000 - currentTime) + ); + } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.dailyHeavyPearlDisplay >= + DISPLAYTYPE.ALWAYS.ordinal()) { + map.put( + 9, + DARK_AQUA + "Daily Heavy Pearls: " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour] + + Utils.prettyTime(pearlsReset + 86400000 - currentTime) + ); + } + overlayStrings = new ArrayList<>(); for (int index : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText2) { if (map.containsKey(index)) { @@ -752,8 +802,40 @@ public class TimersOverlay extends TextOverlay { if (overlayStrings.isEmpty()) overlayStrings = null; } - public String compactRemaining(int amount) { - return (5 - amount) + " remaining"; + public static int beforePearls = -1; + public static int afterPearls = -1; + public static int availablePearls = -1; + public static int heavyPearlCount() { + int heavyPearls = 0; + + List<ItemStack> inventory = Minecraft.getMinecraft().thePlayer.inventoryContainer.getInventory(); + for (ItemStack item : inventory) { + if (item == null) { + continue; + } else if (!item.hasTagCompound()) { + continue; + } + NBTTagCompound itemData = item.getSubCompound("ExtraAttributes", false); + if (itemData == null) { + continue; + } + if (itemData.getString("id").equals("HEAVY_PEARL")) { + heavyPearls += item.stackSize; + } + } + return heavyPearls; + } + + public static void processActionBar(String msg) { + if(SBInfo.getInstance().location.equals("Belly of the Beast")) { + try { + msg = Utils.cleanColour(msg); + msg = msg.substring(msg.indexOf("Pearls Collected: ")+18); + availablePearls = Integer.parseInt(msg.substring(msg.indexOf("/")+1)); + } catch(Exception e) { + e.printStackTrace(); + } + } } private enum TimeEnums { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java index 95a293df..1729cfa7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -7,6 +7,7 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonPrimitive; import com.mojang.authlib.GameProfile; +import io.github.moulberry.notenoughupdates.NEUOverlay; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager; import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; @@ -477,7 +478,7 @@ public class GuiProfileViewer extends GuiScreen { this.guiTop = (this.height - this.sizeY) / 2; boolean bingo = false; - JsonObject currProfileInfo = profile.getProfileInformation(profileId); + JsonObject currProfileInfo = profile != null ? profile.getProfileInformation(profileId) : null; if (NotEnoughUpdates.INSTANCE.config.profileViewer.alwaysShowBingoTab) { showBingoPage = true; } else { @@ -3325,6 +3326,10 @@ public class GuiProfileViewer extends GuiScreen { Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.enderman.boss_kills_tier_2"), 0); float enderman_boss_kills_tier_3 = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.enderman.boss_kills_tier_3"), 0); + float blaze_boss_kills_tier_2 = + Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.blaze.boss_kills_tier_2"), 0); + float blaze_boss_kills_tier_3 = + Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.blaze.boss_kills_tier_3"), 0); Utils.renderAlignedString( EnumChatFormatting.DARK_AQUA + "Revenant T3", @@ -3390,6 +3395,20 @@ public class GuiProfileViewer extends GuiScreen { guiTop + yStartBottom + yOffset * 3, 76 ); + Utils.renderAlignedString( + EnumChatFormatting.DARK_AQUA + "Inferno T3", + EnumChatFormatting.WHITE.toString() + (int) blaze_boss_kills_tier_2, + guiLeft + xStart + xOffset * 2, + guiTop + yStartBottom + yOffset * 4, + 76 + ); + Utils.renderAlignedString( + EnumChatFormatting.DARK_AQUA + "Inferno T4", + EnumChatFormatting.WHITE.toString() + (int) blaze_boss_kills_tier_3, + guiLeft + xStart + xOffset * 2, + guiTop + yStartBottom + yOffset * 5, + 76 + ); float pet_milestone_ores_mined = Utils.getElementAsFloat(Utils.getElement(profileInfo, "stats.pet_milestone_ores_mined"), 0); @@ -4967,7 +4986,7 @@ public class GuiProfileViewer extends GuiScreen { Splitter splitter = Splitter.on(" ").omitEmptyStrings().limit(2); for (int i = 0; i < PlayerStats.defaultStatNames.length; i++) { String statName = PlayerStats.defaultStatNames[i]; - if (statName.equals("mining_fortune") || statName.equals("mining_speed")) continue; + //if (statName.equals("mining_fortune") || statName.equals("mining_speed")) continue; String statNamePretty = PlayerStats.defaultStatNamesPretty[i]; int val = Math.round(stats.get(statName)); @@ -4984,12 +5003,12 @@ public class GuiProfileViewer extends GuiScreen { statNamePretty, EnumChatFormatting.WHITE.toString() + val, guiLeft + 132, - guiTop + 27 + 11f * i, + guiTop + 21 + 11f * i, 80 ); if (mouseX > guiLeft + 132 && mouseX < guiLeft + 212) { - if (mouseY > guiTop + 27 + 11f * i && mouseY < guiTop + 37 + 11f * i) { + if (mouseY > guiTop + 21 + 11f * i && mouseY < guiTop + 37 + 11f * i) { List<String> split = splitter.splitToList(statNamePretty); PlayerStats.Stats baseStats = PlayerStats.getBaseStats(); tooltipToDisplay = new ArrayList<>(); @@ -5033,8 +5052,8 @@ public class GuiProfileViewer extends GuiScreen { continue; } - int yPosition = position % 7; - int xPosition = position / 7; + int yPosition = position % 8; + int xPosition = position / 8; String skillName = entry.getValue().getDisplayName(); @@ -5042,7 +5061,7 @@ public class GuiProfileViewer extends GuiScreen { int levelFloored = (int) Math.floor(level); int x = guiLeft + 237 + 86 * xPosition; - int y = guiTop + 31 + 21 * yPosition; + int y = guiTop + 24 + 21 * yPosition; Utils.renderAlignedString(skillName, EnumChatFormatting.WHITE.toString() + levelFloored, x + 14, y - 4, 60); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java index 4a915111..6535a99a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java @@ -33,6 +33,8 @@ public class PlayerStats { public static final String SEA_CREATURE_CHANCE = "sea_creature_chance"; public static final String MAGIC_FIND = "magic_find"; public static final String PET_LUCK = "pet_luck"; + public static final String MINING_FORTUNE = "mining_fortune"; + public static final String MINING_SPEED = "mining_speed"; public static final String[] defaultStatNames = new String[]{ "health", @@ -245,6 +247,23 @@ public class PlayerStats { return 0; } } + private static float hotmFortune(JsonObject profile, JsonObject skillInfo) { + int miningLevelFortune = + (int) (4 * (float) Math.floor(Utils.getElementAsFloat(Utils.getElement(skillInfo, "level_skill_mining"), 0))); + int miningFortuneStat = + ((Utils.getElementAsInt(Utils.getElement(profile, "mining_core.nodes.mining_fortune"), 0)) * 5); + int miningFortune2Stat = + ((Utils.getElementAsInt(Utils.getElement(profile, "mining_core.nodes.mining_fortune_2"), 0)) * 5); + return miningFortuneStat + miningFortune2Stat + miningLevelFortune; + } + + private static float hotmSpeed(JsonObject profile) { + int miningSpeedStat = + ((Utils.getElementAsInt(Utils.getElement(profile, "mining_core.nodes.mining_speed"), 0)) * 20); + int miningSpeed2Stat = + ((Utils.getElementAsInt(Utils.getElement(profile, "mining_core.nodes.mining_speed_2"), 0)) * 40); + return miningSpeedStat + miningSpeed2Stat; + } public static Stats getPassiveBonuses(JsonObject skillInfo, JsonObject profile) { Stats passiveBonuses = new Stats(); @@ -265,6 +284,15 @@ public class PlayerStats { return passiveBonuses; } + public static Stats getHOTMBonuses(JsonObject skillInfo, JsonObject profile) { + Stats hotmBonuses = new Stats(); + + hotmBonuses.addStat(MINING_FORTUNE, hotmFortune(profile, skillInfo)); + hotmBonuses.addStat(MINING_SPEED, hotmSpeed(profile)); + + return hotmBonuses; + } + private static String getFullset(JsonArray armor, int ignore) { String fullset = null; for (int i = 0; i < armor.size(); i++) { @@ -637,6 +665,7 @@ public class PlayerStats { JsonArray talisman_bag = Utils.getElement(inventoryInfo, "talisman_bag").getAsJsonArray(); Stats passiveBonuses = getPassiveBonuses(skillInfo, profile); + Stats hotmBonuses = getHOTMBonuses(skillInfo, profile); Stats armorBonuses = getItemBonuses(false, armor); Stats talismanBonuses = getItemBonuses(true, inventory, talisman_bag); @@ -651,7 +680,7 @@ public class PlayerStats { Stats petBonus = getPetStatBonuses(petsInfo); - stats = stats.add(passiveBonuses).add(armorBonuses).add(talismanBonuses).add(petBonus); + stats = stats.add(passiveBonuses).add(armorBonuses).add(talismanBonuses).add(petBonus).add(hotmBonuses); stats.add(getSetBonuses(stats, inventoryInfo, collectionInfo, skillInfo, profile)); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java index 22656b1a..28cdf721 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -70,6 +70,7 @@ public class ProfileViewer { put("slayer_spider", Utils.createItemStack(Items.spider_eye, EnumChatFormatting.GOLD + "Tara Slayer")); put("slayer_wolf", Utils.createItemStack(Items.bone, EnumChatFormatting.GOLD + "Sven Slayer")); put("slayer_enderman", Utils.createItemStack(Items.ender_pearl, EnumChatFormatting.GOLD + "Ender Slayer")); + put("slayer_blaze", Utils.createItemStack(Items.blaze_rod, EnumChatFormatting.GOLD + "Blaze Slayer")); }}; private static final ItemStack CAT_FARMING = Utils.createItemStack(Items.golden_hoe, EnumChatFormatting.YELLOW + "Farming"); @@ -96,7 +97,7 @@ public class ProfileViewer { )); put(CAT_FORAGING, Utils.createList("LOG", "LOG:1", "LOG:2", "LOG_2:1", "LOG_2", "LOG:3", null)); put(CAT_FISHING, Utils.createList("RAW_FISH", "RAW_FISH:1", "RAW_FISH:2", "RAW_FISH:3", "PRISMARINE_SHARD", - "PRISMARINE_CRYSTALS", "CLAY_BALL", "WATER_LILY", "INK_SACK", "SPONGE" + "PRISMARINE_CRYSTALS", "CLAY_BALL", "WATER_LILY", "INK_SACK", "SPONGE", "MAGMA_FISH" )); }}; @@ -110,7 +111,7 @@ public class ProfileViewer { "MITHRIL", "HARD_STONE", null )); put(CAT_COMBAT, Utils.createList("ZOMBIE", "SKELETON", "SPIDER", "CAVESPIDER", "CREEPER", "ENDERMAN", - "GHAST", "SLIME", "BLAZE", "MAGMA_CUBE", "REVENANT", "TARANTULA", "VOIDLING" + "GHAST", "SLIME", "BLAZE", "MAGMA_CUBE", "REVENANT", "TARANTULA", "VOIDLING", "INFERNO" )); put(CAT_FORAGING, Utils.createList("OAK", "SPRUCE", "BIRCH", "DARK_OAK", "ACACIA", "JUNGLE", "FLOWER")); put(CAT_FISHING, Utils.createList("FISHING", null, null, null, null, null, "CLAY", null, null, null)); @@ -238,6 +239,11 @@ public class ProfileViewer { ); put("INK_SACK", Utils.createItemStack(Items.dye, EnumChatFormatting.AQUA + "Ink Sack")); put("SPONGE", Utils.createItemStack(Item.getItemFromBlock(Blocks.sponge), EnumChatFormatting.AQUA + "Sponge")); + put("MAGMA_FISH", + Utils.createSkull(EnumChatFormatting.AQUA + "Magmafish", + "5c53195c-5b98-3476-9731-c32647b22723", + "ewogICJ0aW1lc3RhbXAiIDogMTY0MjQ4ODA3MDY2NiwKICAicHJvZmlsZUlkIiA6ICIzNDkxZjJiOTdjMDE0MWE2OTM2YjFjMjJhMmEwMGZiNyIsCiAgInByb2ZpbGVOYW1lIiA6ICJKZXNzc3N1aGgiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjU2YjU5NTViMjk1NTIyYzk2ODk0ODE5NjBjMDFhOTkyY2ExYzc3NTRjZjRlZTMxM2M4ZGQwYzM1NmQzMzVmIgogICAgfQogIH0KfQ") + ); }}; private static final AtomicBoolean updatingResourceCollection = new AtomicBoolean(false); private static JsonObject resourceCollection = null; @@ -867,6 +873,8 @@ public class ProfileViewer { float experience_slayer_wolf = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.wolf.xp"), 0); float experience_slayer_enderman = Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.enderman.xp"), 0); + float experience_slayer_blaze = + Utils.getElementAsFloat(Utils.getElement(profileInfo, "slayer_bosses.blaze.xp"), 0); float totalSkillXP = experience_skill_taming + experience_skill_mining + experience_skill_foraging + experience_skill_enchanting + experience_skill_carpentry + experience_skill_farming @@ -897,6 +905,7 @@ public class ProfileViewer { skillInfo.addProperty("experience_slayer_spider", experience_slayer_spider); skillInfo.addProperty("experience_slayer_wolf", experience_slayer_wolf); skillInfo.addProperty("experience_slayer_enderman", experience_slayer_enderman); + skillInfo.addProperty("experience_slayer_blaze", experience_slayer_blaze); JsonArray levelingArray = Utils.getElement(leveling, "leveling_xp").getAsJsonArray(); int farmingCap = getCap(leveling, "farming") + (int) Utils.getElementAsFloat( @@ -933,6 +942,9 @@ public class ProfileViewer { Level level_slayer_enderman = getLevel(Utils.getElement(leveling, "slayer_xp.enderman").getAsJsonArray(), experience_slayer_enderman, 9, true ); + Level level_slayer_blaze = getLevel(Utils.getElement(leveling, "slayer_xp.blaze").getAsJsonArray(), + experience_slayer_blaze, 9, true + ); skillInfo.addProperty("level_skill_taming", level_skill_taming.level); skillInfo.addProperty("level_skill_mining", level_skill_mining.level); @@ -951,6 +963,7 @@ public class ProfileViewer { skillInfo.addProperty("level_slayer_spider", level_slayer_spider.level); skillInfo.addProperty("level_slayer_wolf", level_slayer_wolf.level); skillInfo.addProperty("level_slayer_enderman", level_slayer_enderman.level); + skillInfo.addProperty("level_slayer_blaze", level_slayer_blaze.level); skillInfo.addProperty("maxed_skill_taming", level_skill_taming.maxed); skillInfo.addProperty("maxed_skill_mining", level_skill_mining.maxed); @@ -969,6 +982,7 @@ public class ProfileViewer { skillInfo.addProperty("maxed_slayer_spider", level_slayer_spider.maxed); skillInfo.addProperty("maxed_slayer_wolf", level_slayer_wolf.maxed); skillInfo.addProperty("maxed_slayer_enderman", level_slayer_enderman.maxed); + skillInfo.addProperty("maxed_slayer_blaze", level_slayer_blaze.maxed); skillInfo.addProperty("maxxp_skill_taming", level_skill_taming.maxXpForLevel); skillInfo.addProperty("maxxp_skill_mining", level_skill_mining.maxXpForLevel); @@ -987,6 +1001,7 @@ public class ProfileViewer { skillInfo.addProperty("maxxp_slayer_spider", level_slayer_spider.maxXpForLevel); skillInfo.addProperty("maxxp_slayer_wolf", level_slayer_wolf.maxXpForLevel); skillInfo.addProperty("maxxp_slayer_enderman", level_slayer_enderman.maxXpForLevel); + skillInfo.addProperty("maxxp_slayer_blaze", level_slayer_blaze.maxXpForLevel); return skillInfo; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java index f1e40671..6519d547 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.util; import com.google.common.reflect.TypeToken; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.listener.ScoreboardLocationChangeListener; import io.github.moulberry.notenoughupdates.miscfeatures.customblockzones.LocationChangeEvent; import io.github.moulberry.notenoughupdates.overlays.SlayerOverlay; import net.minecraft.client.Minecraft; @@ -367,7 +368,9 @@ public class SBInfo { //Replaced with for loop because in crystal hollows with events the line it's on can shift. for (String line : lines) { if (line.contains("⏣")) { - location = Utils.cleanColour(line).replaceAll("[^A-Za-z0-9() ]", "").trim(); + String l = Utils.cleanColour(line).replaceAll("[^A-Za-z0-9() ]", "").trim(); + if(!l.equals(location)) { new ScoreboardLocationChangeListener(location, l); } + location = l; break; } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java index 25e4ac82..e572a391 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -653,6 +653,41 @@ public class Utils { return (float) Math.round(value * scale) / scale; } + // Parses Roman numerals, allowing for single character irregular subtractive notation (e.g. IL is 49, IIL is invalid) + public static int parseRomanNumeral(String input) { + int prevVal = 0; + int total = 0; + for (int i = input.length()-1; i >= 0; i--) { + int val; + char ch = input.charAt(i); + switch (ch) { + case 'I' : val = 1; break; + case 'V' : val = 5; break; + case 'X' : val = 10; break; + case 'L' : val = 50; break; + case 'C' : val = 100; break; + case 'D' : val = 500; break; + case 'M' : val = 1000; break; + default: throw new IllegalArgumentException("Invalid Roman Numeral Character: " + ch); + } + if (val < prevVal) val = -val; + total += val; + prevVal = val; + } + + return total; + } + + public static int parseIntOrRomanNumeral(String input) { + // 0 through 9, '-', and '+' come before 'A' in ANSI, UTF8, and UTF16 character sets + // + if (input.charAt(0) < 'A') { + return Integer.parseInt(input); + } + + return parseRomanNumeral(input); + } + public static void playPressSound() { playSound(new ResourceLocation("gui.button.press"), true); } diff --git a/src/main/resources/assets/notenoughupdates/auc_search/master_star.png b/src/main/resources/assets/notenoughupdates/auc_search/master_star.png Binary files differnew file mode 100644 index 00000000..210ecf49 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/auc_search/master_star.png diff --git a/src/main/resources/assets/notenoughupdates/auc_search/star_board.png b/src/main/resources/assets/notenoughupdates/auc_search/star_board.png Binary files differindex 8251731f..0a42884d 100644 --- a/src/main/resources/assets/notenoughupdates/auc_search/star_board.png +++ b/src/main/resources/assets/notenoughupdates/auc_search/star_board.png diff --git a/src/main/resources/assets/notenoughupdates/pv_basic.png b/src/main/resources/assets/notenoughupdates/pv_basic.png Binary files differindex 227bad5a..4d5236f5 100644 --- a/src/main/resources/assets/notenoughupdates/pv_basic.png +++ b/src/main/resources/assets/notenoughupdates/pv_basic.png |