diff options
Diffstat (limited to 'src')
23 files changed, 424 insertions, 115 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java index ff618f10..1bca2a84 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.auction.APIManager; +import io.github.moulberry.notenoughupdates.core.config.KeybindHelper; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.item.ItemStack; @@ -20,6 +21,12 @@ public class ItemPriceInformation { } public static boolean addToTooltip(List<String> tooltip, String internalname, ItemStack stack, boolean useStackSize) { + if(stack.getTagCompound().hasKey("disableNeuTooltip") && stack.getTagCompound().getBoolean("disableNeuTooltip")){ + return false; + } + if(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKey && !KeybindHelper.isKeyDown(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.disablePriceKeyKeybind)){ + 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/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index b849c890..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; @@ -1721,9 +1721,10 @@ public class NEUEventListener { int index = 0; List<String> 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) { @@ -1777,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<Map.Entry<String, JsonElement>> sorted = new TreeSet<>(Map.Entry.comparingByKey()); sorted.addAll(statsRar.entrySet()); - for(Map.Entry<String, JsonElement> entry : sorted) { - if(entry.getValue().isJsonPrimitive() && ((JsonPrimitive)entry.getValue()).isNumber()) { + for (Map.Entry<String, JsonElement> 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; } 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/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index c638eca6..3b78c2c9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -1288,6 +1288,7 @@ public class NotEnoughUpdates { public void displayLinks(JsonObject update) { String discord_link = update.get("discord_link").getAsString(); String youtube_link = update.get("youtube_link").getAsString(); + String twitch_link = update.get("twitch_link").getAsString(); String update_link = update.get("update_link").getAsString(); String github_link = update.get("github_link").getAsString(); String other_text = update.get("other_text").getAsString(); @@ -1300,11 +1301,13 @@ public class NotEnoughUpdates { } ChatComponentText links = new ChatComponentText(""); ChatComponentText separator = new ChatComponentText( - EnumChatFormatting.GRAY+EnumChatFormatting.BOLD.toString()+EnumChatFormatting.STRIKETHROUGH+(other==null?"---":"--")); + EnumChatFormatting.GRAY+EnumChatFormatting.BOLD.toString()+EnumChatFormatting.STRIKETHROUGH+(other==null?"--":"-")); ChatComponentText discord = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.BLUE+"Discord"+EnumChatFormatting.GRAY+"]"); discord.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, discord_link)); ChatComponentText youtube = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.RED+"YouTube"+EnumChatFormatting.GRAY+"]"); youtube.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, youtube_link)); + ChatComponentText twitch = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.DARK_PURPLE+"Twitch"+EnumChatFormatting.GRAY+"]"); + twitch.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, twitch_link)); ChatComponentText release = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.GREEN+"Release"+EnumChatFormatting.GRAY+"]"); release.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, update_link)); ChatComponentText github = new ChatComponentText(EnumChatFormatting.GRAY+"["+EnumChatFormatting.DARK_PURPLE+"GitHub"+EnumChatFormatting.GRAY+"]"); @@ -1315,6 +1318,8 @@ public class NotEnoughUpdates { links.appendSibling(separator); links.appendSibling(youtube); links.appendSibling(separator); + links.appendSibling(twitch); + links.appendSibling(separator); links.appendSibling(release); links.appendSibling(separator); links.appendSibling(github); 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..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), @@ -137,6 +138,7 @@ public class CapeManager { } private void updateCapes() { + NotEnoughUpdates.INSTANCE.manager.hypixelApi.getMyApiAsync("activecapes.json", (jsonObject) -> { if(jsonObject.get("success").getAsBoolean()) { lastJsonSync = jsonObject; @@ -203,7 +205,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 +217,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 +293,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 e976fb76..6011f0ac 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,46 @@ 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")) { - shaderName = "mcworld_cape"; - } else if(capeName.equalsIgnoreCase("lava") || capeName.equalsIgnoreCase("skyclient")) { - 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")) { + shaderName = "mcworld_cape"; + } else if(capeName.equalsIgnoreCase("lava") || capeName.equalsIgnoreCase("skyclient")) { + 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/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 { 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/miscfeatures/CustomSkulls.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java index 8e2874d3..ed4c8919 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomSkulls.java @@ -220,6 +220,9 @@ public class CustomSkulls implements IResourceManagerReloadListener { public boolean renderSkull(float xOffset, float yOffset, float zOffset, EnumFacing placedDirection, float rotationDeg, int skullType, GameProfile skullOwner, int damage) { + if(NotEnoughUpdates.INSTANCE.config.misc.disableSkullRetexturing) { + return false; + } if(placedDirection != EnumFacing.UP || skullType != 3) { return false; } 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"); 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; } 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<String> createDefaultQuickCommands() { 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 @@ -175,6 +175,15 @@ public class ItemOverlays { @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",
desc = "Change the colour of the etherwarp target block outline"
)
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java index 37c75d28..6a083cae 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Misc.java @@ -67,4 +67,15 @@ public class Misc { minStep = 10
)
public int chromaSpeed = 100;
+
+ @Expose
+ @ConfigOption(
+ name = "Disable Skull retexturing",
+ desc = "Disables the skull retexturing."
+ )
+ @ConfigEditorBoolean
+ public boolean disableSkullRetexturing = false;
+
+
+
}
\ No newline at end of file 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,10 +27,29 @@ 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",
desc = "Change the width of the search bar"
)
@@ -38,6 +58,7 @@ public class Toolbar { maxValue = 300f,
minStep = 10f
)
+ @ConfigAccordionId(id = 0)
public int searchBarWidth = 200;
@Expose
@@ -50,10 +71,19 @@ 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",
desc = "Change the click type needed to trigger quick commands"
)
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..71508144 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 @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.options.seperateSections; import com.google.gson.annotations.Expose;
import io.github.moulberry.notenoughupdates.core.config.annotations.*;
+import org.lwjgl.input.Keyboard;
import java.util.ArrayList;
import java.util.Arrays;
@@ -62,6 +63,32 @@ public class TooltipTweaks { @Expose
@ConfigOption(
+ name = "Price info keybind",
+ desc = "Only show price info if holding a key."
+ )
+ @ConfigEditorBoolean
+ public boolean disablePriceKey = false;
+
+ @Expose
+ @ConfigOption(
+ name = "Show Price info Keybind",
+ desc = "Hold this key to show a price info tooltip"
+ )
+ @ConfigEditorKeybind(defaultKey = Keyboard.KEY_NONE)
+ public int disablePriceKeyKeybind = Keyboard.KEY_NONE;
+
+
+
+ @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",
desc = "Show which enchants are missing on an item when pressing LSHIFT"
)
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)); } } 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..56ed9502 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -42,7 +42,13 @@ 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.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; @@ -63,6 +69,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"); @@ -138,6 +145,12 @@ public class GuiProfileViewer extends GuiScreen { if(profileId == null && profile != null && profile.getLatestProfile() != null) { profileId = profile.getLatestProfile(); } + { + //this is just to cache the guild info + if(profile != null) { + JsonObject guildinfo = profile.getGuildInfo(null); + } + } this.sizeX = 431; this.sizeY = 202; @@ -175,12 +188,29 @@ 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); 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()); + 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); + 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; @@ -200,6 +230,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); + } } } @@ -382,6 +418,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) { @@ -1602,14 +1653,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) { @@ -2157,6 +2209,29 @@ 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 Seen", 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); + } + + } + { + 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); @@ -2203,11 +2278,8 @@ 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, + + Utils.renderAlignedString(EnumChatFormatting.RED + "Total Slayer XP", EnumChatFormatting.WHITE.toString() + shortNumberFormat(totalSlayerXP, 0), guiLeft + xStart, guiTop + yStartBottom + yOffset * 4, 76); } @@ -2341,6 +2413,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 23c91dd0..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<String, JsonObject> 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; @@ -354,6 +358,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); @@ -522,6 +527,7 @@ public class ProfileViewer { } } + String cute_name = profile.get("cute_name").getAsString(); if (backup == null) backup = cute_name; profileIds.add(cute_name); @@ -543,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<String, String> 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; } @@ -570,6 +605,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; } @@ -611,6 +649,7 @@ public class ProfileViewer { public void resetCache() { playerInformation = null; + guildInformation = null; basicInfo = null; playerStatus = null; stats.clear(); 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 1a5e168d..243ee151 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -125,7 +125,7 @@ public class SBInfo { private static final Pattern SKILL_LEVEL_PATTERN = Pattern.compile("([^0-9:]+) (\\d{1,2})"); public void tick() { - isInDungeon = false; + Boolean tempIsInDungeon = false; long currentTime = System.currentTimeMillis(); @@ -171,13 +171,16 @@ public class SBInfo { ScorePlayerTeam scoreplayerteam1 = scoreboard.getPlayersTeam(score.getPlayerName()); String line = ScorePlayerTeam.formatPlayerName(scoreplayerteam1, score.getPlayerName()); line = Utils.cleanDuplicateColourCodes(line); + + String cleanLine = Utils.cleanColour(line); - if(Utils.cleanColour(line).contains("Dungeon Cleared: ")) { - isInDungeon = true; + if(cleanLine.contains("Dungeon") && cleanLine.contains("Cleared:") && cleanLine.contains("%")) { + tempIsInDungeon = true; } lines.add(line); } + isInDungeon= tempIsInDungeon; if(lines.size() >= 5) { date = Utils.cleanColour(lines.get(1)).trim(); 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..a4af51ca 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)); } } @@ -607,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(); + + for(String line : lore) { + Lore.appendTag(new NBTTagString(line)); + } + + display.setString("Name", displayName); + display.setTag("Lore", Lore); + + tag.setTag("display", display); + tag.setInteger("HideFlags", 254); + if(disableNeuToolTips){ + tag.setBoolean("disableNeuTooltip", true); + } + + itemStack.setTagCompound(tag); + + return itemStack; + } + public static void drawStringF(String str, FontRenderer fr, float x, float y, boolean shadow, int colour) { fr.drawString(str, x, y, colour, shadow); } diff --git a/src/main/resources/assets/notenoughupdates/invbuttons/expanded_inventory.png b/src/main/resources/assets/notenoughupdates/invbuttons/expanded_inventory.png Binary files differdeleted file mode 100644 index d941fa6e..00000000 --- a/src/main/resources/assets/notenoughupdates/invbuttons/expanded_inventory.png +++ /dev/null diff --git a/src/main/resources/assets/notenoughupdates/pv_ironman.png b/src/main/resources/assets/notenoughupdates/pv_ironman.png Binary files differnew file mode 100644 index 00000000..78802d29 --- /dev/null +++ b/src/main/resources/assets/notenoughupdates/pv_ironman.png |