From be483e502d1db2ea4a552169034c7b4546197444 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 25 Jul 2021 19:42:08 +0200 Subject: Add toggle for etherwarp overlay text --- .../notenoughupdates/miscfeatures/CustomItemEffects.java | 2 +- .../notenoughupdates/options/seperateSections/ItemOverlays.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java index 83ad8a0d..cc13f59a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -301,7 +301,7 @@ public class CustomItemEffects { ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); - if(usingEtherwarp) { + if(usingEtherwarp && NotEnoughUpdates.INSTANCE.config.itemOverlays.enableEtherwarpHelperOverlay) { String denyTpReason = null; if(etherwarpRaycast == null) { denyTpReason = "Too far!"; 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 f6cc91ec..501bc8ae 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 @@ -173,6 +173,15 @@ public class ItemOverlays { @ConfigAccordionId(id = 7) public boolean etherwarpZoom = true; + @Expose + @ConfigOption( + name = "Enable etherwarp helper overlay", + desc = "Display an overlay which tells you if the etherwarp will fail." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 7) + public boolean enableEtherwarpHelperOverlay = true; + @Expose @ConfigOption( name = "Highlight Colour", -- cgit From 224edc9b020e40f5a6de5b3e055542f1302ce26d Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 25 Jul 2021 20:45:38 +0200 Subject: Add toggle for Settings and help button Also made the search bar toggle no longer toggle off the other two buttons Might improve at a later date --- .../moulberry/notenoughupdates/NEUOverlay.java | 45 +++++++++++++--------- .../options/seperateSections/Toolbar.java | 40 ++++++++++++++++--- 2 files changed, 62 insertions(+), 23 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index bf85a6a6..4859e5a6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -180,6 +180,9 @@ public class NEUOverlay extends Gui { @Override public void mouseClick(float x, float y, int mouseX, int mouseY) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { + return; + } if(Mouse.getEventButtonState()) { setSearchBarFocus(true); if(Mouse.getEventButton() == 1) { //Right mouse button down @@ -202,6 +205,9 @@ public class NEUOverlay extends Gui { @Override public void render(float x, float y) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { + return; + } FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; int paddingUnscaled = getPaddingUnscaled(); @@ -282,6 +288,7 @@ public class NEUOverlay extends Gui { (int)x + 5 + textBeforeSelectionWidth, (int)y-4 + getHeight()/2, Color.BLACK.getRGB()); } + } @Override @@ -308,6 +315,9 @@ public class NEUOverlay extends Gui { @Override public void mouseClick(float x, float y, int mouseX, int mouseY) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableSettingsButton) { + return; + } if(Mouse.getEventButtonState()) { NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config)); } @@ -322,15 +332,20 @@ public class NEUOverlay extends Gui { int paddingUnscaled = getPaddingUnscaled(); int searchYSize = getSearchBarYSize(); + + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableSettingsButton) { + return; + } Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(x, y, - searchYSize + paddingUnscaled*2, searchYSize + paddingUnscaled*2, GL11.GL_NEAREST); + searchYSize + paddingUnscaled * 2, searchYSize + paddingUnscaled * 2, GL11.GL_NEAREST); Minecraft.getMinecraft().getTextureManager().bindTexture(settings); GlStateManager.color(1f, 1f, 1f, 1f); - Utils.drawTexturedRect((int)x + paddingUnscaled, (int)y + paddingUnscaled, + Utils.drawTexturedRect((int) x + paddingUnscaled, (int) y + paddingUnscaled, searchYSize, searchYSize); + GlStateManager.bindTexture(0); } }; @@ -354,6 +369,9 @@ public class NEUOverlay extends Gui { @Override public void mouseClick(float x, float y, int mouseX, int mouseY) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableHelpButton){ + return; + } if(Mouse.getEventButtonState()) { //displayInformationPane(HTMLInfoPane.createFromWikiUrl(overlay, manager, "Help", // "https://moulberry.github.io/files/neu_help.html")); @@ -371,16 +389,21 @@ public class NEUOverlay extends Gui { int paddingUnscaled = getPaddingUnscaled(); int searchYSize = getSearchBarYSize(); + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableHelpButton) { + return; + } + Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(x, y, - searchYSize + paddingUnscaled*2, searchYSize + paddingUnscaled*2, GL11.GL_NEAREST); + searchYSize + paddingUnscaled * 2, searchYSize + paddingUnscaled * 2, GL11.GL_NEAREST); Minecraft.getMinecraft().getTextureManager().bindTexture(help); GlStateManager.color(1f, 1f, 1f, 1f); - Utils.drawTexturedRect((int)x + paddingUnscaled, (int)y + paddingUnscaled, + Utils.drawTexturedRect((int) x + paddingUnscaled, (int) y + paddingUnscaled, getSearchBarYSize(), getSearchBarYSize()); GlStateManager.bindTexture(0); + } }; } @@ -517,20 +540,6 @@ public class NEUOverlay extends Gui { public int getPadding() { return getPaddingUnscaled()*4; } - - @Override - public void mouseClick(float x, float y, int mouseX, int mouseY) { - if(NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { - super.mouseClick(x, y, mouseX, mouseY); - } - } - - @Override - public void render(float x, float y) { - if(NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { - super.render(x, y); - } - } }; } 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 3719e120..15262aeb 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 @@ -12,13 +12,14 @@ public class Toolbar { @ConfigEditorButton(runnableId = 6, buttonText = "Edit") public boolean positionButton = true; - @Expose + + @ConfigOption( - name = "Show Quick Commands", - desc = "Show QuickCommands\u2122 in the NEU toolbar" + name = "Search Bar", + desc = "" ) - @ConfigEditorBoolean - public boolean quickCommands = false; + @ConfigEditorAccordion(id = 0) + public boolean todoAccordion = false; @Expose @ConfigOption( @@ -26,8 +27,27 @@ public class Toolbar { desc = "Show Itemlist search bar in the NEU toolbar" ) @ConfigEditorBoolean + @ConfigAccordionId(id = 0) public boolean searchBar = true; + @Expose + @ConfigOption( + name = "Show a quick settings button", + desc = "Show quick settings button in the NEU toolbar" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean enableSettingsButton = true; + + @Expose + @ConfigOption( + name = "Show a help settings button", + desc = "Show quick settings button in the NEU toolbar" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean enableHelpButton = false; + @Expose @ConfigOption( name = "Search Bar Width", @@ -38,6 +58,7 @@ public class Toolbar { maxValue = 300f, minStep = 10f ) + @ConfigAccordionId(id = 0) public int searchBarWidth = 200; @Expose @@ -50,8 +71,17 @@ public class Toolbar { maxValue = 50f, minStep = 1f ) + @ConfigAccordionId(id = 0) public int searchBarHeight = 40; + @Expose + @ConfigOption( + name = "Show Quick Commands", + desc = "Show QuickCommands\u2122 in the NEU toolbar" + ) + @ConfigEditorBoolean + public boolean quickCommands = false; + @Expose @ConfigOption( name = "Quick Commands Click Type", -- cgit From e9b2aa9b40150ad3e602d9f6e2674a7383f41c60 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 25 Jul 2021 21:08:51 +0200 Subject: Add a toggle for showing reforge stats on a reforge stone --- .../io/github/moulberry/notenoughupdates/NEUEventListener.java | 3 ++- .../notenoughupdates/options/seperateSections/TooltipTweaks.java | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index b849c890..3240de03 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1721,9 +1721,10 @@ public class NEUEventListener { int index = 0; List newTooltip = new ArrayList<>(); for(String line : event.toolTip) { - if(line.endsWith(EnumChatFormatting.DARK_GRAY+"Reforge Stone")) { + if(line.endsWith(EnumChatFormatting.DARK_GRAY+"Reforge Stone") && NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showReforgeStats) { JsonObject reforgeStones = Constants.REFORGESTONES; + if(reforgeStones != null && reforgeStones.has(internalname)) { boolean shift = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); if(!pressedShiftLast && shift) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java index e1b9780a..b7fb3433 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java @@ -60,6 +60,14 @@ public class TooltipTweaks { @ConfigEditorBoolean public boolean showPriceInfoAucItem = true; + @Expose + @ConfigOption( + name = "Show reforge stats", + desc = "Show statistics a reforge stone will apply." + ) + @ConfigEditorBoolean + public boolean showReforgeStats = true; + @Expose @ConfigOption( name = "Missing Enchant List", -- cgit From 97f5000da36de994c9c36597a7b57e9f962705f5 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 25 Jul 2021 22:36:37 +0200 Subject: Fix spelling mistake in timersoverlay --- .../io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java') 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 e9338f94..39bc0b60 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -349,7 +349,7 @@ public class TimersOverlay extends TextOverlay { hidden.godPotionDuration < TimeEnums.DAY.time) { map.put(2, DARK_AQUA + "Godpot: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.kindaSoonColour] + Utils.prettyTime(hidden.godPotionDuration)); } else if (NotEnoughUpdates.INSTANCE.config.miscOverlays.godpotDisplay >= DISPLAYTYPE.ALWAYS.ordinal()) { - map.put(2, DARK_AQUA + "Godpotf: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour] + Utils.prettyTime(hidden.godPotionDuration)); + map.put(2, DARK_AQUA + "Godpot: " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.miscOverlays.defaultColour] + Utils.prettyTime(hidden.godPotionDuration)); } } -- cgit From 99f63f20b40b22b54ab0b3dba44e3424c1a8d9c8 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 26 Jul 2021 10:00:36 +0200 Subject: Fix reforge's without stats not showing tooltips --- .../notenoughupdates/NEUEventListener.java | 92 +++++++++++----------- 1 file changed, 48 insertions(+), 44 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 3240de03..7a169017 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1778,85 +1778,89 @@ public class NEUEventListener { pressedArrowLast = left || right; JsonElement statsE = reforgeInfo.get("reforgeStats"); - if(statsE != null && statsE.isJsonObject()) { - JsonObject stats = statsE.getAsJsonObject(); - String rarityFormatted = rarityArrMap.getOrDefault(rarity, rarity); - JsonElement reforgeAbilityE = reforgeInfo.get("reforgeAbility"); - String reforgeAbility = null; - if(reforgeAbilityE != null) { - if(reforgeAbilityE.isJsonPrimitive() && reforgeAbilityE.getAsJsonPrimitive().isString()) { - reforgeAbility = Utils.getElementAsString(reforgeInfo.get("reforgeAbility"), ""); + String rarityFormatted = rarityArrMap.getOrDefault(rarity, rarity); - } else if(reforgeAbilityE.isJsonObject()) { - if(reforgeAbilityE.getAsJsonObject().has(rarity)) { - reforgeAbility = reforgeAbilityE.getAsJsonObject().get(rarity).getAsString(); - } + JsonElement reforgeAbilityE = reforgeInfo.get("reforgeAbility"); + String reforgeAbility = null; + if (reforgeAbilityE != null) { + if (reforgeAbilityE.isJsonPrimitive() && reforgeAbilityE.getAsJsonPrimitive().isString()) { + reforgeAbility = Utils.getElementAsString(reforgeInfo.get("reforgeAbility"), ""); + + } else if (reforgeAbilityE.isJsonObject()) { + if (reforgeAbilityE.getAsJsonObject().has(rarity)) { + reforgeAbility = reforgeAbilityE.getAsJsonObject().get(rarity).getAsString(); } } + } - if(reforgeAbility != null && !reforgeAbility.isEmpty()) { - String text = EnumChatFormatting.BLUE + (reforgeName.isEmpty() ? "Bonus: " : reforgeName + " Bonus: ") + - EnumChatFormatting.GRAY+reforgeAbility; - boolean first = true; - for(String s : Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(text, 150)) { - newTooltip.add((first ? "" : " ") + s); - first = false; - } - newTooltip.add(""); + if (reforgeAbility != null && !reforgeAbility.isEmpty()) { + String text = EnumChatFormatting.BLUE + (reforgeName.isEmpty() ? "Bonus: " : reforgeName + " Bonus: ") + + EnumChatFormatting.GRAY + reforgeAbility; + boolean first = true; + for (String s : Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(text, 150)) { + newTooltip.add((first ? "" : " ") + s); + first = false; } + newTooltip.add(""); + } - newTooltip.add(EnumChatFormatting.BLUE+"Stats for "+rarityFormatted+"\u00a79: [\u00a7l\u00a7m< \u00a79Switch\u00a7l\u27a1\u00a79]"); + newTooltip.add(EnumChatFormatting.BLUE + "Stats for " + rarityFormatted + "\u00a79: [\u00a7l\u00a7m< \u00a79Switch\u00a7l\u27a1\u00a79]"); + + if(statsE != null && statsE.isJsonObject()) { + JsonObject stats = statsE.getAsJsonObject(); JsonElement statsRarE = stats.get(rarity); - if(statsRarE != null && statsRarE.isJsonObject()) { + if (statsRarE != null && statsRarE.isJsonObject()) { + JsonObject statsRar = statsRarE.getAsJsonObject(); TreeSet> sorted = new TreeSet<>(Map.Entry.comparingByKey()); sorted.addAll(statsRar.entrySet()); - for(Map.Entry entry : sorted) { - if(entry.getValue().isJsonPrimitive() && ((JsonPrimitive)entry.getValue()).isNumber()) { + for (Map.Entry entry : sorted) { + if (entry.getValue().isJsonPrimitive() && ((JsonPrimitive) entry.getValue()).isNumber()) { float statNumF = entry.getValue().getAsFloat(); String statNumS; - if(statNumF % 1 == 0) { + if (statNumF % 1 == 0) { statNumS = String.valueOf(Math.round(statNumF)); } else { statNumS = Utils.floatToString(statNumF, 1); } String reforgeNamePretty = WordUtils.capitalizeFully(entry.getKey().replace("_", " ")); - String text = EnumChatFormatting.GRAY + reforgeNamePretty + ": " + EnumChatFormatting.GREEN+"+"+statNumS; - if(percentStats.contains(entry.getKey())) { + String text = EnumChatFormatting.GRAY + reforgeNamePretty + ": " + EnumChatFormatting.GREEN + "+" + statNumS; + if (percentStats.contains(entry.getKey())) { text += "%"; } - newTooltip.add(" "+text); + newTooltip.add(" " + text); } } } + } - JsonElement reforgeCostsE = reforgeInfo.get("reforgeCosts"); - int reforgeCost = -1; - if(reforgeCostsE != null) { - if(reforgeCostsE.isJsonPrimitive() && reforgeCostsE.getAsJsonPrimitive().isNumber()) { - reforgeCost = (int)Utils.getElementAsFloat(reforgeInfo.get("reforgeAbility"), -1); + JsonElement reforgeCostsE = reforgeInfo.get("reforgeCosts"); + int reforgeCost = -1; + if (reforgeCostsE != null) { + if (reforgeCostsE.isJsonPrimitive() && reforgeCostsE.getAsJsonPrimitive().isNumber()) { + reforgeCost = (int) Utils.getElementAsFloat(reforgeInfo.get("reforgeAbility"), -1); - } else if(reforgeCostsE.isJsonObject()) { - if(reforgeCostsE.getAsJsonObject().has(rarity)) { - reforgeCost = (int)Utils.getElementAsFloat(reforgeCostsE.getAsJsonObject().get(rarity), -1); - } + } else if (reforgeCostsE.isJsonObject()) { + if (reforgeCostsE.getAsJsonObject().has(rarity)) { + reforgeCost = (int) Utils.getElementAsFloat(reforgeCostsE.getAsJsonObject().get(rarity), -1); } } + } - if(reforgeCost >= 0) { - String text = EnumChatFormatting.BLUE + "Apply Cost: " + EnumChatFormatting.GOLD+NumberFormat.getNumberInstance().format(reforgeCost) +" coins"; - newTooltip.add(""); - newTooltip.add(text); - } - + if (reforgeCost >= 0) { + String text = EnumChatFormatting.BLUE + "Apply Cost: " + EnumChatFormatting.GOLD + NumberFormat.getNumberInstance().format(reforgeCost) + " coins"; + newTooltip.add(""); + newTooltip.add(text); } + } + continue; } -- cgit From 26f5ccc2ab64cd4ac9deb21fd53b134eb818871e Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 26 Jul 2021 11:43:18 +0200 Subject: Fix drill fuel text not being removed --- .../java/io/github/moulberry/notenoughupdates/NEUEventListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 7a169017..43b43277 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -756,7 +756,7 @@ public class NEUEventListener { private String processText(String text) { if(SBInfo.getInstance().getLocation() == null) return text; - if(!SBInfo.getInstance().getLocation().startsWith("mining_")) return text; + if(!SBInfo.getInstance().getLocation().startsWith("mining_")&&!SBInfo.getInstance().getLocation().equals("crystal_hollows")) return text; if(Minecraft.getMinecraft().thePlayer == null) return text; if(!NotEnoughUpdates.INSTANCE.config.mining.drillFuelBar) return text; -- cgit From 5ae8bdffbcd6dc38fee24c21f4a3f5717f94510c Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 26 Jul 2021 20:49:40 +0200 Subject: Fix merge error from ironm00n's pr Thanks for noticing Jani :) --- .../moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/main/java') 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 449b642b..735f4ba2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -2203,10 +2203,7 @@ public class GuiProfileViewer extends GuiScreen { Utils.renderAlignedString(EnumChatFormatting.RED+"AVG Slayer Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSlayerLVL*10)/10, guiLeft+xStart, guiTop+yStartBottom+yOffset*3, 76); - - Utils.renderAlignedString(EnumChatFormatting.RED+"AVG Slayer Level", EnumChatFormatting.WHITE.toString()+Math.floor(avgSlayerLVL*10)/10, - guiLeft+xStart, guiTop+yStartBottom+yOffset*2, 76); - + Utils.renderAlignedString(EnumChatFormatting.RED + "Total Slayer XP", EnumChatFormatting.WHITE.toString() + Math.floor(totalSlayerXP * 10) / 10, guiLeft + xStart, guiTop + yStartBottom + yOffset * 4, 76); } -- cgit From 6e94888aa5c45783a5f35ac03e53deaecafb3be5 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 27 Jul 2021 09:41:52 +0200 Subject: Add a hotfix setting to disable the negative cape/disable all capes --- .../notenoughupdates/cosmetics/CapeManager.java | 13 +++-- .../notenoughupdates/cosmetics/NEUCape.java | 60 +++++++++++++--------- .../notenoughupdates/options/NEUConfig.java | 3 ++ 3 files changed, 50 insertions(+), 26 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index 893a1109..9ed24d9a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -137,6 +137,7 @@ public class CapeManager { } private void updateCapes() { + NotEnoughUpdates.INSTANCE.manager.hypixelApi.getMyApiAsync("activecapes.json", (jsonObject) -> { if(jsonObject.get("success").getAsBoolean()) { lastJsonSync = jsonObject; @@ -203,7 +204,9 @@ public class CapeManager { if(none) { localCape = null; } else { - localCape = new MutablePair<>(new NEUCape(capename), capename); + if (!NotEnoughUpdates.INSTANCE.config.hidden.disableAllCapes) { + localCape = new MutablePair<>(new NEUCape(capename), capename); + } } } else if(capeMap.containsKey(playerUUID)) { if(none) { @@ -213,7 +216,9 @@ public class CapeManager { capePair.setValue(capename); } } else if(!none) { - capeMap.put(playerUUID, new MutablePair<>(new NEUCape(capename), capename)); + if (!NotEnoughUpdates.INSTANCE.config.hidden.disableAllCapes){ + capeMap.put(playerUUID, new MutablePair<>(new NEUCape(capename), capename)); + } } } @@ -287,7 +292,9 @@ public class CapeManager { String selCape = NotEnoughUpdates.INSTANCE.config.hidden.selectedCape; if(selCape != null && !selCape.isEmpty()) { if(localCape == null) { - localCape = new MutablePair<>(new NEUCape(selCape), selCape); + if (!NotEnoughUpdates.INSTANCE.config.hidden.disableAllCapes) { + localCape = new MutablePair<>(new NEUCape(selCape), selCape); + } } else { localCape.setValue(selCape); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java index c1d36e8f..77dee6e5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.cosmetics; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils; import io.github.moulberry.notenoughupdates.util.ReverseWorldRenderer; import io.github.moulberry.notenoughupdates.util.TexLoc; @@ -79,32 +80,45 @@ public class NEUCape { public void setCapeTexture(String capeName) { if(this.capeName != null && this.capeName.equalsIgnoreCase(capeName)) return; - this.capeName = capeName; startTime = System.currentTimeMillis(); + boolean defaultBehaviour = true; - if(capeName.equalsIgnoreCase("fade")) { - shaderName = "fade_cape"; - } else if(capeName.equalsIgnoreCase("space")) { - shaderName = "space_cape"; - } else if(capeName.equalsIgnoreCase("mcworld") || capeName.equalsIgnoreCase("skyclient")) { - shaderName = "mcworld_cape"; - } else if(capeName.equalsIgnoreCase("lava")) { - shaderName = "lava_cape"; - } else if(capeName.equalsIgnoreCase("lightning")) { - shaderName = "lightning_cape"; - } else if(capeName.equalsIgnoreCase("thebakery")) { - shaderName = "biscuit_cape"; - } else if(capeName.equalsIgnoreCase("negative")) { - shaderName = "negative"; - } else if(capeName.equalsIgnoreCase("void")) { - shaderName = "void"; - } else if(capeName.equalsIgnoreCase("tunnel")) { - shaderName = "tunnel"; - } else if(capeName.equalsIgnoreCase("planets")) { - shaderName = "planets"; - } else { - shaderName = "shiny_cape"; + if(NotEnoughUpdates.INSTANCE.config.hidden.disableBrokenCapes){ + if(capeName.equals("negative")){ + defaultBehaviour = false; + this.capeName = "fade"; + this.shaderName = "fade_cape"; + } + } + if(defaultBehaviour){ + this.capeName = capeName; + + + + if (capeName.equalsIgnoreCase("fade")) { + shaderName = "fade_cape"; + } else if (capeName.equalsIgnoreCase("space")) { + shaderName = "space_cape"; + } else if (capeName.equalsIgnoreCase("mcworld") || capeName.equalsIgnoreCase("skyclient")) { + shaderName = "mcworld_cape"; + } else if (capeName.equalsIgnoreCase("lava")) { + shaderName = "lava_cape"; + } else if (capeName.equalsIgnoreCase("lightning")) { + shaderName = "lightning_cape"; + } else if (capeName.equalsIgnoreCase("thebakery")) { + shaderName = "biscuit_cape"; + } else if (capeName.equalsIgnoreCase("negative")) { + shaderName = "negative"; + } else if (capeName.equalsIgnoreCase("void")) { + shaderName = "void"; + } else if (capeName.equalsIgnoreCase("tunnel")) { + shaderName = "tunnel"; + } else if (capeName.equalsIgnoreCase("planets")) { + shaderName = "planets"; + } else { + shaderName = "shiny_cape"; + } } ResourceLocation staticCapeTex = new ResourceLocation("notenoughupdates:capes/" + capeName + ".png"); 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 22d5e32f..48b7ff46 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -286,6 +286,9 @@ public class NEUConfig extends Config { "Looting:\u003e:3:5:0"); @Expose public String repoURL = "https://github.com/Moulberry/NotEnoughUpdates-REPO/archive/master.zip"; @Expose public String repoCommitsURL = "https://api.github.com/repos/Moulberry/NotEnoughUpdates-REPO/commits/master"; + //These config options were added due to a graphical bug that caused the player to be unable to see the screen + @Expose public boolean disableBrokenCapes = false; + @Expose public boolean disableAllCapes = false; } private static ArrayList createDefaultQuickCommands() { -- cgit From f55ee05b748e8ca13c27f42705ead21bbe3df707 Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 29 Jul 2021 19:44:40 +0200 Subject: Add a open in Skycrypt (sky.shiiyu.moe) button also added a generic playSound util --- .../profileviewer/GuiProfileViewer.java | 28 ++++++++++++++++++++++ .../moulberry/notenoughupdates/util/Utils.java | 9 ++++--- 2 files changed, 34 insertions(+), 3 deletions(-) (limited to 'src/main/java') 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 735f4ba2..a6152340 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -42,6 +42,8 @@ import org.lwjgl.opengl.GL20; import java.awt.*; import java.io.IOException; +import java.net.URI; +import java.net.URISyntaxException; import java.text.NumberFormat; import java.util.*; import java.util.List; @@ -175,12 +177,23 @@ public class GuiProfileViewer extends GuiScreen { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); if(profile != null) { + //Render Profile chooser button renderBlurredBackground(width, height, guiLeft+2, guiTop+sizeY+3+2, 100-4, 20-4); Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown); Utils.drawTexturedRect(guiLeft, guiTop+sizeY+3, 100, 20, 0, 100/200f, 0, 20/185f, GL11.GL_NEAREST); Utils.drawStringCenteredScaledMaxWidth(profileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50, guiTop+sizeY+3+10, true, 90, new Color(63, 224, 208, 255).getRGB()); + //Render Open In Skycrypt button + renderBlurredBackground(width, height, guiLeft+100+6+2, guiTop+sizeY+3+2, 100-4, 20-4); + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown); + Utils.drawTexturedRect(guiLeft+100+6, guiTop+sizeY+3, 100, 20, + 0, 100/200f, 0, 20/185f, GL11.GL_NEAREST); + Utils.drawStringCenteredScaledMaxWidth("Open in Skycrypt", Minecraft.getMinecraft().fontRendererObj, guiLeft+50+100+6, + guiTop+sizeY+3+10, true, 90, new Color(63, 224, 208, 255).getRGB()); + + + if(profileDropdownSelected && !profile.getProfileIds().isEmpty() && scaledResolution.getScaleFactor() != 4) { int dropdownOptionSize = scaledResolution.getScaleFactor()==3?10:20; @@ -382,6 +395,21 @@ public class GuiProfileViewer extends GuiScreen { return; } } + if(mouseX > guiLeft+106 && mouseX < guiLeft+106+100 && profile != null && !profile.getProfileIds().isEmpty() && profileId != null) { + if(mouseY > guiTop+sizeY+3 && mouseY < guiTop+sizeY+23) { + try{ + Desktop desk = Desktop.getDesktop(); + desk.browse(new URI("https://sky.shiiyu.moe/stats/"+profile.getHypixelProfile().get("displayname").getAsString()+"/"+profileId)); + Utils.playPressSound(); + return; + } catch (IOException | URISyntaxException ignored) { + //no idea how this sounds, but ya know just in case + Utils.playSound(new ResourceLocation("game.player.hurt"), true); + return; + } + } + } + if(mouseX > guiLeft && mouseX < guiLeft+100 && profile != null && !profile.getProfileIds().isEmpty()) { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); if(mouseY > guiTop+sizeY+3 && mouseY < guiTop+sizeY+23) { 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 37e9c600..c40101ca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -492,9 +492,12 @@ public class Utils { } public static void playPressSound() { - if(NotEnoughUpdates.INSTANCE.config.misc.guiButtonClicks) { - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create( - new ResourceLocation("gui.button.press"), 1.0F)); + playSound(new ResourceLocation("gui.button.press"), true); + } + + public static void playSound(ResourceLocation sound, boolean gui) { + if(NotEnoughUpdates.INSTANCE.config.misc.guiButtonClicks || !gui) { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(sound, 1.0F)); } } -- cgit From 41502159b073a736c598b6dcfd631342f319a508 Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 29 Jul 2021 21:54:21 +0200 Subject: Add SBP Cape --- .../java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java | 1 + 1 file changed, 1 insertion(+) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java index 9ed24d9a..44958889 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -103,6 +103,7 @@ public class CapeManager { new CapeData("subreddit_light", true, false), new CapeData("packshq", true, false), new CapeData("skytils", true, false), + new CapeData("sbp", true, false), //Special Other new CapeData("contrib", true, false), -- cgit From e32e28313e78c074c52ec125eadd5597b8337e85 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 30 Jul 2021 13:15:31 +0200 Subject: Fix dungeon win overlay --- .../moulberry/notenoughupdates/dungeons/DungeonWin.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java index ab4d1b7b..95ca32c9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonWin.java @@ -139,18 +139,23 @@ public class DungeonWin { } } + public static void onChatMessage(ClientChatReceivedEvent e) { if(e.type == 2) return; if(NotEnoughUpdates.INSTANCE.config.dungeons.dungeonWinMillis < 100 || !NotEnoughUpdates.INSTANCE.config.dungeons.enableDungeonWin) return; + long currentTime = System.currentTimeMillis(); String unformatted = Utils.cleanColour(e.message.getUnformattedText()); - if(e.message.getFormattedText().startsWith(EnumChatFormatting.RESET+" ")) { + + //Added two more Resets, cant do Reset+Reset+Reset cause idk? + //hypixel please dont randomly add more + + if(e.message.getFormattedText().startsWith(EnumChatFormatting.RESET+""+EnumChatFormatting.RESET+""+EnumChatFormatting.RESET+" ")){ if(currentTime - lastDungeonFinish > 30000) { Matcher matcher = TEAM_SCORE_REGEX.matcher(unformatted); if(matcher.find()) { lastDungeonFinish = currentTime; - String score = matcher.group(1); switch (score.toUpperCase()) { case "S+": @@ -183,7 +188,7 @@ public class DungeonWin { displayWin(); } else { if(unformatted.trim().length() > 0) { - text.add(e.message.getFormattedText().substring(2).trim()); + text.add(e.message.getFormattedText().substring(6).trim()); } } } else { -- cgit From 1352ae87fbd4bc520fbe084c2a5055804c4d255f Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 30 Jul 2021 14:10:08 +0200 Subject: Add notice to fairysouls waypoint for dungeons --- .../io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java index 5fe5938b..d45ca9ba 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.commands.SimpleCommand; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.Constants; @@ -356,6 +357,9 @@ public class FairySouls { print(EnumChatFormatting.DARK_PURPLE.toString()+EnumChatFormatting.BOLD+" NEU Fairy Soul Waypoint Guide"); print(EnumChatFormatting.LIGHT_PURPLE+"Shows waypoints for every fairy soul in your world"); print(EnumChatFormatting.LIGHT_PURPLE+"Clicking a fairy soul automatically removes it from the list"); + if(!NotEnoughUpdates.INSTANCE.config.hidden.dev) { + print(EnumChatFormatting.DARK_RED + "" + EnumChatFormatting.OBFUSCATED + "Ab" + EnumChatFormatting.RESET + EnumChatFormatting.DARK_RED + "!" + EnumChatFormatting.RESET + EnumChatFormatting.RED + " This feature cannot and will not work in Dungeons. " + EnumChatFormatting.DARK_RED + "!" + EnumChatFormatting.OBFUSCATED + "Ab"); + } print(EnumChatFormatting.GOLD.toString()+EnumChatFormatting.BOLD+" Commands:"); print(EnumChatFormatting.YELLOW+"/neusouls help - Display this message"); print(EnumChatFormatting.YELLOW+"/neusouls on/off - Enable/disable the waypoint markers"); -- cgit From efeee424817abfd50f79a0cdc0445fe02c9b912a Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 30 Jul 2021 17:54:11 +0200 Subject: Add ironman indicator in pv --- .../notenoughupdates/profileviewer/GuiProfileViewer.java | 13 +++++++++++++ .../notenoughupdates/profileviewer/ProfileViewer.java | 4 ++++ 2 files changed, 17 insertions(+) (limited to 'src/main/java') 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 a6152340..d59bb5d8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -65,6 +65,7 @@ public class GuiProfileViewer extends GuiScreen { public static final ResourceLocation pv_dropdown = new ResourceLocation("notenoughupdates:pv_dropdown.png"); public static final ResourceLocation pv_bg = new ResourceLocation("notenoughupdates:pv_bg.png"); public static final ResourceLocation pv_elements = new ResourceLocation("notenoughupdates:pv_elements.png"); + public static final ResourceLocation pv_ironman = new ResourceLocation("notenoughupdates:pv_ironman.png"); public static final ResourceLocation resource_packs = new ResourceLocation("minecraft:textures/gui/resource_packs.png"); public static final ResourceLocation icons = new ResourceLocation("textures/gui/icons.png"); @@ -177,6 +178,7 @@ public class GuiProfileViewer extends GuiScreen { ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); if(profile != null) { + JsonObject currProfileInfo = profile.getProfileInformation(profileId); //Render Profile chooser button renderBlurredBackground(width, height, guiLeft+2, guiTop+sizeY+3+2, 100-4, 20-4); Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown); @@ -184,6 +186,11 @@ public class GuiProfileViewer extends GuiScreen { 0, 100/200f, 0, 20/185f, GL11.GL_NEAREST); Utils.drawStringCenteredScaledMaxWidth(profileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50, guiTop+sizeY+3+10, true, 90, new Color(63, 224, 208, 255).getRGB()); + if(currProfileInfo != null && currProfileInfo.has("game_mode") && currProfileInfo.get("game_mode").getAsString().equals("ironman")) { + GlStateManager.color(1, 1, 1, 1); + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_ironman); + Utils.drawTexturedRect(guiLeft-16-5, guiTop+sizeY+5, 16, 16, GL11.GL_NEAREST); + } //Render Open In Skycrypt button renderBlurredBackground(width, height, guiLeft+100+6+2, guiTop+sizeY+3+2, 100-4, 20-4); Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dropdown); @@ -213,6 +220,12 @@ public class GuiProfileViewer extends GuiScreen { String otherProfileId = profile.getProfileIds().get(yIndex); Utils.drawStringCenteredScaledMaxWidth(otherProfileId, Minecraft.getMinecraft().fontRendererObj, guiLeft+50, guiTop+sizeY+23+dropdownOptionSize/2f+dropdownOptionSize*yIndex, true, 90, new Color(33, 112, 104, 255).getRGB()); + currProfileInfo = profile.getProfileInformation(otherProfileId); + if(currProfileInfo != null && currProfileInfo.has("game_mode") && currProfileInfo.get("game_mode").getAsString().equals("ironman")) { + GlStateManager.color(1, 1, 1, 1); + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_ironman); + Utils.drawTexturedRect(guiLeft-16-5, guiTop+sizeY+2+23+dropdownOptionSize*yIndex, 16, 16, GL11.GL_NEAREST); + } } } 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 23c91dd0..9553659d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -354,6 +354,7 @@ public class ProfileViewer { return null; } + public long getNetWorth(String profileId) { if(profileId == null) profileId = latestProfile; if(networth.get(profileId) != null) return networth.get(profileId); @@ -570,6 +571,9 @@ public class ProfileViewer { if(profile.has("banking")) { profileInfo.add("banking", profile.get("banking").getAsJsonObject()); } + if(profile.has("game_mode")){ + profileInfo.add("game_mode", profile.get("game_mode")); + } profileMap.put(profileId, profileInfo); return profileInfo; } -- cgit From d81917266f02e43837ac98e99c867c9766b897d4 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 31 Jul 2021 16:17:55 +0200 Subject: Add Join date, Last saved and guild to pv --- .../profileviewer/GuiProfileViewer.java | 66 ++++++++++++++++++++++ .../profileviewer/ProfileViewer.java | 35 ++++++++++++ 2 files changed, 101 insertions(+) (limited to 'src/main/java') 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 d59bb5d8..4eb1858a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -45,6 +45,10 @@ import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.text.NumberFormat; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.List; import java.util.concurrent.ExecutorService; @@ -141,6 +145,10 @@ public class GuiProfileViewer extends GuiScreen { if(profileId == null && profile != null && profile.getLatestProfile() != null) { profileId = profile.getLatestProfile(); } + { + //this is just to cache the guild info + JsonObject guildinfo = profile.getGuildInfo(null); + } this.sizeX = 431; this.sizeY = 202; @@ -2198,6 +2206,37 @@ public class GuiProfileViewer extends GuiScreen { Utils.renderAlignedString(EnumChatFormatting.GOLD+"Purse", EnumChatFormatting.WHITE.toString()+shortNumberFormat(purseBalance, 0), guiLeft+xStart, guiTop+yStartTop+yOffset, 76); + { + String lastSaveText = this.getTimeSinceString(profileInfo, "last_save"); + if(lastSaveText != null) { + Utils.renderAlignedString(EnumChatFormatting.AQUA + "Last Saved", EnumChatFormatting.WHITE.toString() + lastSaveText, + guiLeft + xStart, guiTop + yStartTop + yOffset * 2, 76); + } + + } + { + String first_join = this.getTimeSinceString(profileInfo, "first_join"); + if(first_join != null) { + Utils.renderAlignedString(EnumChatFormatting.AQUA + "Joined", EnumChatFormatting.WHITE.toString() + first_join, + guiLeft + xStart, guiTop + yStartTop + yOffset * 3, 76); + } + + } + { + String first_join = this.getTimeSinceString(profileInfo, "first_join"); + if(first_join != null) { + Utils.renderAlignedString(EnumChatFormatting.AQUA + "Joined", EnumChatFormatting.WHITE.toString() + first_join, + guiLeft + xStart, guiTop + yStartTop + yOffset * 3, 76); + } + + } + { + JsonObject guildInfo = profile.getGuildInfo(null); + if(guildInfo != null && guildInfo.has("name")){ + Utils.renderAlignedString(EnumChatFormatting.AQUA + "Guild", EnumChatFormatting.WHITE.toString() + guildInfo.get("name").getAsString(), + guiLeft + xStart, guiTop + yStartTop + yOffset * 4, 76); + } + } float fairySouls = Utils.getElementAsFloat(Utils.getElement(profileInfo, "fairy_souls_collected"), 0); @@ -2379,6 +2418,33 @@ public class GuiProfileViewer extends GuiScreen { } } + private String getTimeSinceString(JsonObject profileInfo, String path){ + JsonElement lastSaveElement = Utils.getElement(profileInfo, path); + + if (lastSaveElement.isJsonPrimitive()) { + + Instant lastSave = Instant.ofEpochMilli(lastSaveElement.getAsLong()); + LocalDateTime lastSaveTime = LocalDateTime.ofInstant(lastSave,TimeZone.getDefault().toZoneId()); + long timeDiff = System.currentTimeMillis() - lastSave.toEpochMilli(); + LocalDateTime sinceOnline= LocalDateTime.ofInstant(Instant.ofEpochMilli(timeDiff), ZoneId.of("UTC")); + String renderText; + + if(timeDiff < 60000L){ + renderText = sinceOnline.getSecond()+" seconds ago."; + } else if(timeDiff < 3600000L){ + renderText = sinceOnline.getMinute()+" minutes ago."; + } else if(timeDiff < 86400000L){ + renderText = sinceOnline.getHour()+" hours ago."; + } else if(timeDiff < 31556952000L){ + renderText = sinceOnline.getDayOfYear()+" days ago."; + } else { + renderText = lastSaveTime.format(DateTimeFormatter.ofPattern("dd-MM-yyyy")); + } + return renderText; + } + return null; + } + private int backgroundClickedX = -1; private static char[] c = new char[]{'k', 'm', 'b', 't'}; 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 9553659d..371e9ef3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/ProfileViewer.java @@ -310,6 +310,7 @@ public class ProfileViewer { private String latestProfile = null; private JsonArray playerInformation = null; + private JsonObject guildInformation = null; private JsonObject basicInfo = null; private final HashMap profileMap = new HashMap<>(); @@ -331,6 +332,9 @@ public class ProfileViewer { private AtomicBoolean updatingPlayerInfoState = new AtomicBoolean(false); private long lastPlayerInfoState = 0; private AtomicBoolean updatingPlayerStatusState = new AtomicBoolean(false); + private AtomicBoolean updatingGuildInfoState = new AtomicBoolean(false); + private long lastGuildInfoState = 0; + private AtomicBoolean updatingGuildStatusState = new AtomicBoolean(false); public JsonObject getPlayerStatus() { if(playerStatus != null) return playerStatus; @@ -523,6 +527,7 @@ public class ProfileViewer { } } + String cute_name = profile.get("cute_name").getAsString(); if (backup == null) backup = cute_name; profileIds.add(cute_name); @@ -544,6 +549,35 @@ public class ProfileViewer { } ); + return null; + } + public JsonObject getGuildInfo(Runnable runnable) { + if (guildInformation != null) return guildInformation; + + long currentTime = System.currentTimeMillis(); + + if (currentTime - lastGuildInfoState < 15*1000 && updatingGuildInfoState.get()) return null; + + lastGuildInfoState = currentTime; + updatingGuildInfoState.set(true); + + HashMap args = new HashMap<>(); + args.put("player", "" + uuid); + manager.hypixelApi.getHypixelApiAsync(NotEnoughUpdates.INSTANCE.config.apiKey.apiKey, "guild", + args, jsonObject -> { + updatingGuildInfoState.set(false); + + if (jsonObject == null) return; + if (jsonObject.has("success") && jsonObject.get("success").getAsBoolean()) { + guildInformation = jsonObject.get("guild").getAsJsonObject(); + if (guildInformation == null) return; + if (runnable != null) runnable.run(); + } + }, () -> { + updatingGuildInfoState.set(false); + } + ); + return null; } @@ -615,6 +649,7 @@ public class ProfileViewer { public void resetCache() { playerInformation = null; + guildInformation = null; basicInfo = null; playerStatus = null; stats.clear(); -- cgit From 733dd2d84b022a758fd0de68103c1c15f2f653d4 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 31 Jul 2021 16:20:49 +0200 Subject: Enable custom enchant gui for dev mode --- .../io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java index 381c8944..1b07ebdc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java @@ -199,7 +199,8 @@ public class GuiCustomEnchant extends Gui { } public boolean shouldOverride(String containerName) { - if(true) { + + if(!NotEnoughUpdates.INSTANCE.config.hidden.dev) { shouldOverrideFast = false; return false; } -- cgit From 841f23740c6e23a030a64286c5c3c4ee337700cf Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 31 Jul 2021 22:16:37 +0200 Subject: Remove description and tooltip from Backpack/personalvault in pv --- .../notenoughupdates/ItemPriceInformation.java | 3 +++ .../profileviewer/GuiProfileViewer.java | 5 +++-- .../moulberry/notenoughupdates/util/Utils.java | 23 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java index ff618f10..9c2c1ef9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java @@ -20,6 +20,9 @@ public class ItemPriceInformation { } public static boolean addToTooltip(List tooltip, String internalname, ItemStack stack, boolean useStackSize) { + if(stack.getTagCompound().hasKey("disableNeuTooltip") && stack.getTagCompound().getBoolean("disableNeuTooltip")){ + return false; + } JsonObject auctionInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAuctionInfo(internalname); JsonObject bazaarInfo = NotEnoughUpdates.INSTANCE.manager.auctionManager.getBazaarInfo(internalname); float lowestBinAvg = NotEnoughUpdates.INSTANCE.manager.auctionManager.getItemAvgBin(internalname); 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 4eb1858a..0e3a1836 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1651,14 +1651,15 @@ public class GuiProfileViewer extends GuiScreen { invNameToDisplayMap.put("inv_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.chest), EnumChatFormatting.GRAY+"Inventory")); invNameToDisplayMap.put("ender_chest_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.ender_chest), EnumChatFormatting.GRAY+"Ender Chest")); //invNameToDisplayMap.put("backpack_contents", Utils.createItemStack(Item.getItemFromBlock(Blocks.dropper), EnumChatFormatting.GRAY+"Backpacks")); - invNameToDisplayMap.put("backpack_contents", NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("JUMBO_BACKPACK")).setStackDisplayName(EnumChatFormatting.GRAY+"Backpacks")); - invNameToDisplayMap.put("personal_vault_contents", NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("IRON_CHEST")).setStackDisplayName(EnumChatFormatting.GRAY+"Personal vault")); + invNameToDisplayMap.put("backpack_contents", Utils.editItemStackInfo(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("JUMBO_BACKPACK")),EnumChatFormatting.GRAY+"Backpacks", true)); + invNameToDisplayMap.put("personal_vault_contents", Utils.editItemStackInfo(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("IRON_CHEST")),EnumChatFormatting.GRAY+"Personal vault", true)); invNameToDisplayMap.put("talisman_bag", Utils.createItemStack(Items.golden_apple, EnumChatFormatting.GRAY+"Accessory Bag")); invNameToDisplayMap.put("wardrobe_contents", Utils.createItemStack(Items.leather_chestplate, EnumChatFormatting.GRAY+"Wardrobe")); invNameToDisplayMap.put("fishing_bag", Utils.createItemStack(Items.fish, EnumChatFormatting.GRAY+"Fishing Bag")); invNameToDisplayMap.put("potion_bag", Utils.createItemStack(Items.potionitem, EnumChatFormatting.GRAY+"Potion Bag")); } + public int countItemsInInventory(String internalname, JsonObject inventoryInfo, String... invsToSearch) { int count = 0; for(String inv : invsToSearch) { 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 c40101ca..a4af51ca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -610,6 +610,29 @@ public class Utils { return stack; } + public static ItemStack editItemStackInfo(ItemStack itemStack, String displayName, boolean disableNeuToolTips, String... lore){ + NBTTagCompound tag = itemStack.getTagCompound(); + NBTTagCompound display = tag.getCompoundTag("display"); + NBTTagList Lore = new NBTTagList(