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(-) 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(-) 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(-) 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(-) 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 0787228a06db08c80fa8bc10d179bb4fbc705ab6 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 25 Jul 2021 23:06:23 +0200 Subject: Added Patch notes So moul doesnt have to ask before release. --- Update Notes/2.0-Pre30.md | 0 Update Notes/2.0-Pre31.md | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 Update Notes/2.0-Pre30.md create mode 100644 Update Notes/2.0-Pre31.md diff --git a/Update Notes/2.0-Pre30.md b/Update Notes/2.0-Pre30.md new file mode 100644 index 00000000..e69de29b diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md new file mode 100644 index 00000000..e69de29b -- cgit From 098872300dcea12b56fbec64f587159e51ff8b56 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 25 Jul 2021 23:07:02 +0200 Subject: Added patch notes (reasoning on previous commit) --- Update Notes/2.0-Pre30.md | 28 ++++++++++++++++++++++++++++ Update Notes/2.0-Pre31.md | 31 +++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) diff --git a/Update Notes/2.0-Pre30.md b/Update Notes/2.0-Pre30.md index e69de29b..e036627b 100644 --- a/Update Notes/2.0-Pre30.md +++ b/Update Notes/2.0-Pre30.md @@ -0,0 +1,28 @@ +# These are the change notes for PRE30 + +### **New Features:** + +- More options for the Todo list +- Added the voidgloom slayer stats to the /pv +- Added Dungeon accesories to the accesory bag upgrade view +- Added Dungeon items to the itemlist categories (for example armors now include dungeon armors and weapons include dungeon weapons) +- Added check to see if titanium that spawned atleast touches 1 air block (toggleable) +- Added check so titanium alert doesnt happen if titanium commision is set to "DONE" +- Added Storage to PV (with correct sizes) +- Added Personal Vault to PV +- Added scroll lock to storage overlay +### **Fixed Features:** + +- Todo list + - Fixed fetchur display + - Fixed godpot timer +- PV's wardrobe view not showing second page bottom row (not fully fixed could be better by dividing on every 4 and drawing per column instead of row but right now its always a full page) +- Made dwarven overlay work in crystal hollows (nopo) +- Added Gemstone powder to dwarven overlay (nopo) +- Made smooth aote work with aotv (thanks to 8k for letting me test his aotv) (nopo) + +### **Bug Fixes** + +- Arrow Key backpack option under storage gui not doing anything +- Fixed pets gui going away if you open /pets (nopo) +- Fixed PV cit models dieing (nopo) \ No newline at end of file diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index e69de29b..421c17c9 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -0,0 +1,31 @@ +# These are the change notes for PRE31 + +### **Major new features** + +- None yet + +### **New Features:** +- Added Ferocity, Magic find, Mining speed and mining fortune to Accessory bag (and ferocity and magic find to /pv). +- Update notifier for "Pre" version releases. (Ironm00n) +- Added toggle for etherwarp helper overlay text. +- Added toggle for settings and help icon at the search bar. +- Added toggle for showing the reforge stats of a reforge stone. + +### **Bug Fixes** +- Fishing helper not showing "!" when rod colours are disabled. +- Decimal point values not being counted in Accessory bag overlay. +- /pv not having the correct max minion tier. (Ironm00n) +- Other (not Transparent) storage ui themes not having edit button. +- Drill fuel bar support for crystal hollows and Divan's drill. +- Set Alexxoffi's cape's properties to the right value. +- Add an extra button texture so dark ui themes do not make the dungeon map editor unreadable. (located at "dungeon_map/editor/button.png") +- Fix a spelling mistake in todo timers "Godpotf". + +### **Other** +- code clean up by Ironm00n. +- rename variables to be more consistent. (Ironm00n) +- devpane changes. (? - DoKM) (Ironm00n) +- remove an unused button from ItemEditor. (Ironm00n) +- Moved repoUrl and Repo commits Url to config.hidden. (Ironm00n) +- A lot more. (Ironm00n) +- Change Default todo overlay colours. -- 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(-) 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 --- Update Notes/2.0-Pre31.md | 1 + .../java/io/github/moulberry/notenoughupdates/NEUEventListener.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 421c17c9..53bad2c6 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -20,6 +20,7 @@ - Set Alexxoffi's cape's properties to the right value. - Add an extra button texture so dark ui themes do not make the dungeon map editor unreadable. (located at "dungeon_map/editor/button.png") - Fix a spelling mistake in todo timers "Godpotf". +- Fix Reforge stones with reforges that have no stats not showing the tooltip (hot stuff/heated example) (heated can now have its stats hotfix reverted @repo guys) ### **Other** - code clean up by Ironm00n. 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(-) 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(-) 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(-) 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(+) 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(-) 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(+) 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 ++++ src/main/resources/assets/notenoughupdates/pv_ironman.png | Bin 0 -> 430 bytes 3 files changed, 17 insertions(+) create mode 100644 src/main/resources/assets/notenoughupdates/pv_ironman.png 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; } diff --git a/src/main/resources/assets/notenoughupdates/pv_ironman.png b/src/main/resources/assets/notenoughupdates/pv_ironman.png new file mode 100644 index 00000000..3b40b228 Binary files /dev/null and b/src/main/resources/assets/notenoughupdates/pv_ironman.png differ -- cgit From 14d33a24f4ec1aeec9adbdcc7d4271f4ecbc5cc3 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 30 Jul 2021 19:41:12 +0200 Subject: improve ironman indicator symbol (thanks ery) --- .../resources/assets/notenoughupdates/pv_ironman.png | Bin 430 -> 235 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/main/resources/assets/notenoughupdates/pv_ironman.png b/src/main/resources/assets/notenoughupdates/pv_ironman.png index 3b40b228..78802d29 100644 Binary files a/src/main/resources/assets/notenoughupdates/pv_ironman.png and b/src/main/resources/assets/notenoughupdates/pv_ironman.png differ -- cgit From 04dc3e711727c2624246ffd71a9f7a51da8557df Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 30 Jul 2021 20:21:21 +0200 Subject: Update patch notes --- Update Notes/2.0-Pre31.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 53bad2c6..9ceb36c9 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -10,6 +10,10 @@ - Added toggle for etherwarp helper overlay text. - Added toggle for settings and help icon at the search bar. - Added toggle for showing the reforge stats of a reforge stone. +- Added open in skycrypt button to pv +- Added SBP Cape. +- Added ironman indicator (thanks for the icon ery) + ### **Bug Fixes** - Fishing helper not showing "!" when rod colours are disabled. @@ -21,6 +25,9 @@ - Add an extra button texture so dark ui themes do not make the dungeon map editor unreadable. (located at "dungeon_map/editor/button.png") - Fix a spelling mistake in todo timers "Godpotf". - Fix Reforge stones with reforges that have no stats not showing the tooltip (hot stuff/heated example) (heated can now have its stats hotfix reverted @repo guys) +- Fix dungeon win overlay + +- Added a hidden toggle to disable the negative cape (replaced with null cape (cause i thought it looked nice)) as a user was not able to play due to a graphical bug that caused their screen to turn full green. ### **Other** - code clean up by Ironm00n. @@ -30,3 +37,4 @@ - Moved repoUrl and Repo commits Url to config.hidden. (Ironm00n) - A lot more. (Ironm00n) - Change Default todo overlay colours. +- Added a notice to /neusouls help to inform the user that it does not work in dungeons. -- cgit From 804b6cfd14c85014a8e233b570fe4e758a7d260d Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 31 Jul 2021 16:16:21 +0200 Subject: Remove unused texture --- .../notenoughupdates/invbuttons/expanded_inventory.png | Bin 2494 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/main/resources/assets/notenoughupdates/invbuttons/expanded_inventory.png diff --git a/src/main/resources/assets/notenoughupdates/invbuttons/expanded_inventory.png b/src/main/resources/assets/notenoughupdates/invbuttons/expanded_inventory.png deleted file mode 100644 index d941fa6e..00000000 Binary files a/src/main/resources/assets/notenoughupdates/invbuttons/expanded_inventory.png and /dev/null differ -- 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(+) 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(-) 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(-) 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(); + + 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); } -- cgit From 2735c97fa792df8bb029c032fee671a64f707acb Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 31 Jul 2021 22:18:04 +0200 Subject: Change last saved to last seen in pv --- .../moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0e3a1836..d61f874f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -2210,7 +2210,7 @@ public class GuiProfileViewer extends GuiScreen { { String lastSaveText = this.getTimeSinceString(profileInfo, "last_save"); if(lastSaveText != null) { - Utils.renderAlignedString(EnumChatFormatting.AQUA + "Last Saved", EnumChatFormatting.WHITE.toString() + lastSaveText, + Utils.renderAlignedString(EnumChatFormatting.AQUA + "Last Seen", EnumChatFormatting.WHITE.toString() + lastSaveText, guiLeft + xStart, guiTop + yStartTop + yOffset * 2, 76); } -- cgit From 835b9a239b2578b465251e1d83ddc516e3a74fcc Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 31 Jul 2021 22:24:19 +0200 Subject: Update change log --- Update Notes/2.0-Pre31.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 9ceb36c9..70470c94 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -13,19 +13,21 @@ - Added open in skycrypt button to pv - Added SBP Cape. - Added ironman indicator (thanks for the icon ery) +- Added join date, Last seen and guild to pv (Last seen is based on last saved so this value is not when a player is online) ### **Bug Fixes** - Fishing helper not showing "!" when rod colours are disabled. - Decimal point values not being counted in Accessory bag overlay. - /pv not having the correct max minion tier. (Ironm00n) -- Other (not Transparent) storage ui themes not having edit button. +- Other (not Transparent) storage ui themes not having edit button. (please update your textures artists) - Drill fuel bar support for crystal hollows and Divan's drill. - Set Alexxoffi's cape's properties to the right value. - Add an extra button texture so dark ui themes do not make the dungeon map editor unreadable. (located at "dungeon_map/editor/button.png") - Fix a spelling mistake in todo timers "Godpotf". - Fix Reforge stones with reforges that have no stats not showing the tooltip (hot stuff/heated example) (heated can now have its stats hotfix reverted @repo guys) - Fix dungeon win overlay +- Remove description and price tooltip from backpack/personalvault icon in /pv - Added a hidden toggle to disable the negative cape (replaced with null cape (cause i thought it looked nice)) as a user was not able to play due to a graphical bug that caused their screen to turn full green. @@ -38,3 +40,4 @@ - A lot more. (Ironm00n) - Change Default todo overlay colours. - Added a notice to /neusouls help to inform the user that it does not work in dungeons. +- Removed unused texture -- cgit From b6195af57bc6b6661bd1a2e429387d72aafc81f1 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 1 Aug 2021 10:01:42 +0200 Subject: reformat slayer xp in pv and changelog update --- Update Notes/2.0-Pre31.md | 21 +++++++++++---------- .../profileviewer/GuiProfileViewer.java | 2 +- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 70470c94..2dd2f1c0 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -10,10 +10,10 @@ - Added toggle for etherwarp helper overlay text. - Added toggle for settings and help icon at the search bar. - Added toggle for showing the reforge stats of a reforge stone. -- Added open in skycrypt button to pv +- Added open in skycrypt button to pv. - Added SBP Cape. -- Added ironman indicator (thanks for the icon ery) -- Added join date, Last seen and guild to pv (Last seen is based on last saved so this value is not when a player is online) +- Added ironman indicator. (thanks for the icon ery) +- Added join date, Last seen and guild to pv. (Last seen is based on last saved so this value is not when a player is online) ### **Bug Fixes** @@ -26,18 +26,19 @@ - Add an extra button texture so dark ui themes do not make the dungeon map editor unreadable. (located at "dungeon_map/editor/button.png") - Fix a spelling mistake in todo timers "Godpotf". - Fix Reforge stones with reforges that have no stats not showing the tooltip (hot stuff/heated example) (heated can now have its stats hotfix reverted @repo guys) -- Fix dungeon win overlay -- Remove description and price tooltip from backpack/personalvault icon in /pv +- Fix dungeon win overlay. +- Remove description and price tooltip from backpack/personalvault icon in /pv. - Added a hidden toggle to disable the negative cape (replaced with null cape (cause i thought it looked nice)) as a user was not able to play due to a graphical bug that caused their screen to turn full green. ### **Other** -- code clean up by Ironm00n. -- rename variables to be more consistent. (Ironm00n) -- devpane changes. (? - DoKM) (Ironm00n) -- remove an unused button from ItemEditor. (Ironm00n) +- Code clean up by Ironm00n. +- Rename variables to be more consistent. (Ironm00n) +- Devpane changes. (? - DoKM) (Ironm00n) +- Remove an unused button from ItemEditor. (Ironm00n) - Moved repoUrl and Repo commits Url to config.hidden. (Ironm00n) - A lot more. (Ironm00n) - Change Default todo overlay colours. - Added a notice to /neusouls help to inform the user that it does not work in dungeons. -- Removed unused texture +- Removed unused texture. +- Reformatted Total Slayer XP number. 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 d61f874f..fdff55f3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -2285,7 +2285,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 + "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); } -- cgit From 58aece3b67b0acca9466a83f53574489391de0ed Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 1 Aug 2021 15:05:27 +0200 Subject: Removed unnessary duplicate code --- .../notenoughupdates/profileviewer/GuiProfileViewer.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) 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 fdff55f3..56ed9502 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -147,7 +147,9 @@ public class GuiProfileViewer extends GuiScreen { } { //this is just to cache the guild info - JsonObject guildinfo = profile.getGuildInfo(null); + if(profile != null) { + JsonObject guildinfo = profile.getGuildInfo(null); + } } this.sizeX = 431; @@ -2222,14 +2224,6 @@ public class GuiProfileViewer extends GuiScreen { 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); -- cgit From f9a9854ce9f60e8bedf02c7eb9810c3b0f2798ec Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 1 Aug 2021 17:42:32 +0200 Subject: Add option to only show tooltips when holding keybind --- .../notenoughupdates/ItemPriceInformation.java | 4 ++++ .../options/seperateSections/TooltipTweaks.java | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java index 9c2c1ef9..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; @@ -23,6 +24,9 @@ public class ItemPriceInformation { 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/options/seperateSections/TooltipTweaks.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java index b7fb3433..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; @@ -60,6 +61,24 @@ public class TooltipTweaks { @ConfigEditorBoolean public boolean showPriceInfoAucItem = true; + @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", -- cgit From 7cac988d908f6f97db33362190ea49e4e2a7f14d Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 1 Aug 2021 17:43:07 +0200 Subject: Add ability to disable neu's custom skulls idk why you would want this but its here --- .../moulberry/notenoughupdates/miscfeatures/CustomSkulls.java | 3 +++ .../notenoughupdates/options/seperateSections/Misc.java | 11 +++++++++++ 2 files changed, 14 insertions(+) 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/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 -- cgit From 09b230ab11159e6e367e0f7145040baf49199410 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 1 Aug 2021 19:38:05 +0200 Subject: Hopefully fix slotlocking in dungeons Cant confirm due to the nature of this bug, but with a larger amount of testers this can be confirmed --- .../java/io/github/moulberry/notenoughupdates/util/SBInfo.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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(); -- cgit From cbbeb9a4251cde939f68b34ebcb06b3d5702eb00 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 1 Aug 2021 20:29:22 +0200 Subject: Add moul's twitch link to neulinks --- .../io/github/moulberry/notenoughupdates/NotEnoughUpdates.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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); -- cgit From 16b2b2e71ee289b51548c165e8c6f0475c6cc470 Mon Sep 17 00:00:00 2001 From: nacrt <37629791+nacrt@users.noreply.github.com> Date: Mon, 2 Aug 2021 12:31:43 +0200 Subject: change shader for skyclient cape --- .../java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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..e976fb76 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/NEUCape.java @@ -87,9 +87,9 @@ public class NEUCape { shaderName = "fade_cape"; } else if(capeName.equalsIgnoreCase("space")) { shaderName = "space_cape"; - } else if(capeName.equalsIgnoreCase("mcworld") || capeName.equalsIgnoreCase("skyclient")) { + } else if(capeName.equalsIgnoreCase("mcworld")) { shaderName = "mcworld_cape"; - } else if(capeName.equalsIgnoreCase("lava")) { + } else if(capeName.equalsIgnoreCase("lava") || capeName.equalsIgnoreCase("skyclient")) { shaderName = "lava_cape"; } else if(capeName.equalsIgnoreCase("lightning")) { shaderName = "lightning_cape"; -- cgit From b1de14337c4481eb922ecbe5a5c008b308fdfa68 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 2 Aug 2021 18:21:33 +0200 Subject: Add explanation to search highlight feature --- .../notenoughupdates/NEUEventListener.java | 25 ++++++++++++++++++---- .../moulberry/notenoughupdates/NEUOverlay.java | 12 +++++++++++ .../notenoughupdates/options/NEUConfig.java | 3 +++ .../options/seperateSections/Toolbar.java | 2 +- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 43b43277..856dcfc6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -174,6 +174,7 @@ public class NEUEventListener { private static long notificationDisplayMillis = 0; private static List notificationLines = null; + private static boolean showNotificationOverInv = false; private static final Pattern BAD_ITEM_REGEX = Pattern.compile("x[0-9]{1,2}$"); @@ -192,14 +193,18 @@ public class NEUEventListener { private int inventoryLoadedTicks = 0; private String loadedInvName = ""; public static boolean inventoryLoaded = false; - public static void displayNotification(List lines, boolean showForever) { + displayNotification(lines, showForever, false); + } + + public static void displayNotification(List lines, boolean showForever, boolean overInventory) { if(showForever) { notificationDisplayMillis = -420; } else { notificationDisplayMillis = System.currentTimeMillis(); } notificationLines = lines; + showNotificationOverInv = overInventory; } @SubscribeEvent @@ -501,13 +506,20 @@ public class NEUEventListener { if(Keyboard.isKeyDown(Keyboard.KEY_X)) { notificationDisplayMillis = 0; } + + if(event.type == RenderGameOverlayEvent.ElementType.ALL){ + renderNotification(); + } + + } + private static void renderNotification(){ + long timeRemaining = 15000 - (System.currentTimeMillis() - notificationDisplayMillis); boolean display = timeRemaining > 0 || notificationDisplayMillis == -420; - if(event.type == RenderGameOverlayEvent.ElementType.ALL && - display && notificationLines != null && notificationLines.size() > 0) { + if(display && notificationLines != null && notificationLines.size() > 0) { int width = 0; int height = notificationLines.size()*10+10; - + for(String line : notificationLines) { int len = Minecraft.getMinecraft().fontRendererObj.getStringWidth(line) + 8; if(len > width) { @@ -836,6 +848,11 @@ public class NEUEventListener { */ @SubscribeEvent public void onGuiBackgroundDraw(GuiScreenEvent.BackgroundDrawnEvent event) { + if(showNotificationOverInv){ + + renderNotification(); + + } if((shouldRenderOverlay(event.gui) || event.gui instanceof CustomAHGui) && neu.isOnSkyblock()) { ScaledResolution scaledresolution = new ScaledResolution(Minecraft.getMinecraft()); int width = scaledresolution.getScaledWidth(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 4859e5a6..9872e70e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -191,6 +191,18 @@ public class NEUOverlay extends Gui { } else { if(System.currentTimeMillis() - millisLastLeftClick < 300) { searchMode = !searchMode; + if (searchMode && NotEnoughUpdates.INSTANCE.config.hidden.firstTimeSearchFocus) { + NEUEventListener.displayNotification(Lists.newArrayList( + "\u00a7eSearch Highlight", + "\u00a77In this mode NEU will gray out non matching items in", + "\u00a77your inventory or chests.", + "\u00a77This allows you easily find items as the item will stand out.", + "\u00a77To toggle this please double click on the search bar in your inventory.", + "\u00a77", + "\u00a77Press X on your keyboard to close this notifcation"), true, true); + NotEnoughUpdates.INSTANCE.config.hidden.firstTimeSearchFocus = false; + + } } textField.setCursorPosition(getClickedIndex(mouseX, mouseY)); millisLastLeftClick = System.currentTimeMillis(); 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 48b7ff46..0266772c 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"; + + @Expose public boolean firstTimeSearchFocus = true; + //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; 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 15262aeb..d45f6406 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 @@ -19,7 +19,7 @@ public class Toolbar { desc = "" ) @ConfigEditorAccordion(id = 0) - public boolean todoAccordion = false; + public boolean searchBarAccordion = false; @Expose @ConfigOption( -- cgit From 49961d732e3032487b9a5dd6b5d0421f99723bf1 Mon Sep 17 00:00:00 2001 From: jani270 Date: Tue, 3 Aug 2021 13:48:57 +0200 Subject: Updated dungeon presets --- Update Notes/2.0-Pre31.md | 2 + .../notenoughupdates/invbuttons/presets.json | 890 +++++++++++---------- 2 files changed, 450 insertions(+), 442 deletions(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 2dd2f1c0..15b27cbb 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -30,6 +30,7 @@ - Remove description and price tooltip from backpack/personalvault icon in /pv. - Added a hidden toggle to disable the negative cape (replaced with null cape (cause i thought it looked nice)) as a user was not able to play due to a graphical bug that caused their screen to turn full green. +- Fixed Typo in NEUButtons Dungeon preset catacombs floor 7 (jani270) ### **Other** - Code clean up by Ironm00n. @@ -42,3 +43,4 @@ - Added a notice to /neusouls help to inform the user that it does not work in dungeons. - Removed unused texture. - Reformatted Total Slayer XP number. +- Added Master Mode buttons to NEUButtons dungeon preset (jani270) diff --git a/src/main/resources/assets/notenoughupdates/invbuttons/presets.json b/src/main/resources/assets/notenoughupdates/invbuttons/presets.json index 7692fc07..b6d56e90 100644 --- a/src/main/resources/assets/notenoughupdates/invbuttons/presets.json +++ b/src/main/resources/assets/notenoughupdates/invbuttons/presets.json @@ -2278,452 +2278,458 @@ "anchorRight":false, "anchorBottom":false, "backgroundIndex":0, - "command":"warp dungeon_hub", - "icon":"skull:9b56895b9659896ad647f58599238af532d46db9c1b0389b8bbeb70999dab33d" - }, - { - "x":108, - "y":63, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"reparty", - "icon":"COMMAND" - }, - { - "x":129, - "y":63, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"/p FragRunBot azael_mew azael_mewh", - "icon":"GIANT_FRAGMENT_DIAMOND" - }, - { - "x":150, - "y":63, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"pets", - "icon":"extra:pet_gold" - }, - { - "x":87, - "y":5, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":108, - "y":5, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":129, - "y":5, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":150, - "y":5, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":87, - "y":25, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":105, - "y":25, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":87, - "y":43, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":105, - "y":43, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":143, - "y":35, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":60, - "y":8, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":2, - "command":"/wardrobe", - "icon":"extra:baubles_gold" - }, - { - "x":60, - "y":60, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":26, - "y":8, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":26, - "y":60, - "playerInvOnly":true, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":2, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":22, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":42, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":62, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":-84, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":-64, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":true, - "backgroundIndex":0, "command":"", "icon":"" }, { - "x":2, - "y":-44, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":2, - "y":-24, - "playerInvOnly":false, - "anchorRight":true, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":4, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":25, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":46, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":67, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":88, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":109, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":130, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":151, - "y":-19, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"" - }, - { - "x":-19, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"joindungeon catacombs 1", - "icon":"GOLD_BONZO_HEAD" - }, - { - "x":-19, - "y":22, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"joindungeon catacombs 2", - "icon":"GOLD_SCARF_HEAD" - }, - { - "x":-19, - "y":42, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"joindungeon catacombs 3", - "icon":"GOLD_PROFESSOR_HEAD" - }, - { - "x":-19, - "y":62, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":false, - "backgroundIndex":0, - "command":"joindungeon catacombs 4", - "icon":"GOLD_THORN_HEAD" - }, - { - "x":-19, - "y":-84, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"joindungeon catacombs 5", - "icon":"GOLD_LIVID_HEAD" - }, - { - "x":-19, - "y":-64, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"/joindungeon catacombs 6", - "icon":"GOLD_SADAN_HEAD" - }, - { - "x":-19, - "y":-44, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"joindungeons catacombs 7", - "icon":"GOLD_NECRON_HEAD" - }, - { - "x":-19, - "y":-24, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":4, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":25, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":46, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":67, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":88, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":109, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":130, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" - }, - { - "x":151, - "y":2, - "playerInvOnly":false, - "anchorRight":false, - "anchorBottom":true, - "backgroundIndex":0, - "command":"" + "x": 108, + "y": 63, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "warp dungeon_hub", + "icon": "skull:9b56895b9659896ad647f58599238af532d46db9c1b0389b8bbeb70999dab33d" + }, + { + "x": 129, + "y": 63, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "reparty", + "icon": "COMMAND" + }, + { + "x": 150, + "y": 63, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "pets", + "icon": "extra:pet_gold" + }, + { + "x": 87, + "y": 5, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 108, + "y": 5, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 129, + "y": 5, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 150, + "y": 5, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 87, + "y": 25, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 105, + "y": 25, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 87, + "y": 43, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 105, + "y": 43, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 143, + "y": 35, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 60, + "y": 8, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 2, + "command": "/wardrobe", + "icon": "extra:baubles_gold" + }, + { + "x": 60, + "y": 60, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 26, + "y": 8, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 26, + "y": 60, + "playerInvOnly": true, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": 2, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": 22, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": 42, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": 62, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": -84, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": -64, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "", + "icon": "" + }, + { + "x": 2, + "y": -44, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 2, + "y": -24, + "playerInvOnly": false, + "anchorRight": true, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 4, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 1", + "icon": "DIAMOND_BONZO_HEAD" + }, + { + "x": 25, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 2", + "icon": "DIAMOND_SCARF_HEAD" + }, + { + "x": 46, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 1", + "icon": "DIAMOND_PROFESSOR_HEAD" + }, + { + "x": 67, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 4", + "icon": "DIAMOND_THORN_HEAD" + }, + { + "x": 88, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 5", + "icon": "DIAMOND_LIVID_HEAD" + }, + { + "x": 109, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon master_catacombs 6", + "icon": "DIAMOND_SADAN_HEAD" + }, + { + "x": 130, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 151, + "y": -19, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "" + }, + { + "x": -19, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon catacombs 1", + "icon": "GOLD_BONZO_HEAD" + }, + { + "x": -19, + "y": 22, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon catacombs 2", + "icon": "GOLD_SCARF_HEAD" + }, + { + "x": -19, + "y": 42, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon catacombs 3", + "icon": "GOLD_PROFESSOR_HEAD" + }, + { + "x": -19, + "y": 62, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": false, + "backgroundIndex": 0, + "command": "joindungeon catacombs 4", + "icon": "GOLD_THORN_HEAD" + }, + { + "x": -19, + "y": -84, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "joindungeon catacombs 5", + "icon": "GOLD_LIVID_HEAD" + }, + { + "x": -19, + "y": -64, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "/joindungeon catacombs 6", + "icon": "GOLD_SADAN_HEAD" + }, + { + "x": -19, + "y": -44, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "joindungeon catacombs 7", + "icon": "GOLD_NECRON_HEAD" + }, + { + "x": -19, + "y": -24, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 4, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 25, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 46, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 67, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 88, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 109, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 130, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" + }, + { + "x": 151, + "y": 2, + "playerInvOnly": false, + "anchorRight": false, + "anchorBottom": true, + "backgroundIndex": 0, + "command": "" } ] } \ No newline at end of file -- cgit From 3ccbd6bb51f781d8c18d0389e5d8e79391b7c56c Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 3 Aug 2021 21:10:22 +0200 Subject: Fix chroma speed being chroma duration instead --- .../moulberry/notenoughupdates/options/seperateSections/Misc.java | 2 +- src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 6a083cae..c9ee8c9b 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 @@ -66,7 +66,7 @@ public class Misc { maxValue = 500, minStep = 10 ) - public int chromaSpeed = 100; + public int chromaSpeed2 = 400; @Expose @ConfigOption( 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 a4af51ca..fc8e2fa3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -234,7 +234,7 @@ public class Utils { long currentTimeMillis = System.currentTimeMillis(); if(startTime == 0) startTime = currentTimeMillis; - int chromaSpeed = NotEnoughUpdates.INSTANCE.config.misc.chromaSpeed; + int chromaSpeed = 510 - NotEnoughUpdates.INSTANCE.config.misc.chromaSpeed2; if(chromaSpeed < 10) chromaSpeed = 10; if(chromaSpeed > 5000) chromaSpeed = 5000; -- cgit From c4dc513754fa99c424a86768226fcbcdfa4bc8ce Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 4 Aug 2021 11:29:08 +0200 Subject: Fix fastrender check and add fast render warning to storage overlay --- .../notenoughupdates/NotEnoughUpdates.java | 38 +++++----------------- .../miscfeatures/StorageManager.java | 3 ++ .../notenoughupdates/miscgui/StorageOverlay.java | 26 +++++++++++++++ 3 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 3b78c2c9..7c807cf4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -609,21 +609,10 @@ public class NotEnoughUpdates { SimpleCommand.ProcessCommandRunnable viewProfileRunnable = new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - if(Loader.isModLoaded("optifine") && - new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt").exists()) { - try(InputStream in = new FileInputStream(new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt"))) { - BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); - - String line; - while((line = reader.readLine()) != null) { - if(line.contains("ofFastRender:true")) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Some parts of the profile viewer do not work with OF Fast Render. Go to Video > Performance to disable it.")); - break; - } - } - } catch(Exception e) { - } + if(!OpenGlHelper.isFramebufferEnabled()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "Some parts of the profile viewer do not work with OF Fast Render. Go to Video > Performance to disable it.")); + } if (config.apiKey.apiKey == null || config.apiKey.apiKey.trim().isEmpty()) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + @@ -1046,21 +1035,10 @@ public class NotEnoughUpdates { SimpleCommand cosmeticsCommand = new SimpleCommand("neucosmetics", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - if(Loader.isModLoaded("optifine") && - new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt").exists()) { - try(InputStream in = new FileInputStream(new File(Minecraft.getMinecraft().mcDataDir, "optionsof.txt"))) { - BufferedReader reader = new BufferedReader(new InputStreamReader(in, StandardCharsets.UTF_8)); - - String line; - while((line = reader.readLine()) != null) { - if(line.contains("ofFastRender:true")) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "NEU cosmetics do not work with OF Fast Render. Go to Video > Performance to disable it.")); - return; - } - } - } catch(Exception e) { - } + if(!OpenGlHelper.isFramebufferEnabled()) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + + "NEU cosmetics do not work with OF Fast Render. Go to Video > Performance to disable it.")); + } openGui = new GuiCosmetics(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index 3253f08a..03e6b98e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -444,7 +444,10 @@ public class StorageManager { } } else { StorageOverlay.getInstance().clearSearch(); + return; } + StorageOverlay.getInstance().fastRenderCheck(); + } public void closeWindowPacket(S2EPacketCloseWindow packet) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index 5d841885..352c000d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -1,6 +1,7 @@ package io.github.moulberry.notenoughupdates.miscgui; import com.google.common.collect.Lists; +import io.github.moulberry.notenoughupdates.NEUEventListener; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.*; import io.github.moulberry.notenoughupdates.core.config.KeybindHelper; @@ -28,6 +29,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; + import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; @@ -36,6 +38,7 @@ import org.lwjgl.util.vector.Vector2f; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.awt.*; + import java.util.*; import java.util.List; @@ -92,6 +95,8 @@ public class StorageOverlay extends GuiElement { private int guiLeft; private int guiTop; + private boolean fastRender = false; + private int loadCircleIndex = 0; private int rollIndex = 0; private int loadCircleRotation = 0; @@ -948,6 +953,10 @@ public class StorageOverlay extends GuiElement { } GlScissorStack.pop(scaledResolution); + if(fastRender){ + fontRendererObj.drawString("Fast render does not work with Storage overlay.", sizeX/2-fontRendererObj.getStringWidth("Fast render does not work with Storage overlay.")/2, -10, 0xFFFF0000); + } + //Inventory Text fontRendererObj.drawString("Inventory", 180, storageViewSize+6, textColour); searchBar.setCustomTextColour(searchTextColour); @@ -1957,4 +1966,21 @@ public class StorageOverlay extends GuiElement { GlStateManager.bindTexture(0); } + public void fastRenderCheck(){ + if(!OpenGlHelper.isFramebufferEnabled()) { + this.fastRender = true; + NEUEventListener.displayNotification(Lists.newArrayList( + "\u00a74Fast Render Warning", + "\u00a77Due to the way fast render works, it's not compatible with NEU.", + "\u00a77Please disable fast render in your options under", + "\u00a77Options -> Video settings -> Performance -> Fast render", + "\u00a77This can't be fixed.", + "\u00a77", + "\u00a77Press X on your keyboard to close this notifcation"), true, true); + return; + } + + this.fastRender = false; + } + } -- cgit From 7de7e1e997014a95c34ba92342eeee06261fcfde Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 4 Aug 2021 13:05:49 +0200 Subject: Add /join master mode support --- .../io/github/moulberry/notenoughupdates/NotEnoughUpdates.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 7c807cf4..eb40336c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -653,9 +653,13 @@ public class NotEnoughUpdates { } else { if(args.length != 1) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.RED+"Example Usage: /join f7 or /join 7")); + EnumChatFormatting.RED+"Example Usage: /join f7, /join m6 or /join 7")); } else { - String cmd = "/joindungeon catacombs " + args[0].charAt(args[0].length()-1); + String cataPrefix = "catacombs"; + if(args[0].startsWith("m")){ + cataPrefix = "master_catacombs"; + } + String cmd = "/joindungeon "+cataPrefix+" " + args[0].charAt(args[0].length()-1); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( EnumChatFormatting.YELLOW+"Running command: "+cmd)); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( -- cgit From 083895a52e6a5436efe9e2c4be672a6eb00b2259 Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 4 Aug 2021 13:15:19 +0200 Subject: Updated change log --- Update Notes/2.0-Pre31.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 15b27cbb..7475757e 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -14,7 +14,11 @@ - Added SBP Cape. - Added ironman indicator. (thanks for the icon ery) - Added join date, Last seen and guild to pv. (Last seen is based on last saved so this value is not when a player is online) - +- Added mastermode support for /join. +- Added option to only show price tooltip when holding key. +- Added option to disable neu's custom skulls. (idk why you would want it but its here) +- Added explenation to search highlight feature. +- Added fast render warning to storage gui. ### **Bug Fixes** - Fishing helper not showing "!" when rod colours are disabled. @@ -23,14 +27,18 @@ - Other (not Transparent) storage ui themes not having edit button. (please update your textures artists) - Drill fuel bar support for crystal hollows and Divan's drill. - Set Alexxoffi's cape's properties to the right value. -- Add an extra button texture so dark ui themes do not make the dungeon map editor unreadable. (located at "dungeon_map/editor/button.png") -- Fix a spelling mistake in todo timers "Godpotf". -- Fix Reforge stones with reforges that have no stats not showing the tooltip (hot stuff/heated example) (heated can now have its stats hotfix reverted @repo guys) -- Fix dungeon win overlay. +- Added an extra button texture so dark ui themes do not make the dungeon map editor unreadable. (located at "dungeon_map/editor/button.png") +- Fixed a spelling mistake in todo timers "Godpotf". +- Fixed Reforge stones with reforges that have no stats not showing the tooltip (hot stuff/heated example) (heated can now have its stats hotfix reverted @repo guys) +- Fixed dungeon win overlay. - Remove description and price tooltip from backpack/personalvault icon in /pv. - +- Fixed Typo in NEUButtons Dungeon preset catacombs floor 7. (jani270) +- Fixed chroma speed, should work as expected instead of the otherway around. +- Fixed fastrender check for cosmetics gui and profile viewer. + +- Change skyclient shader. (nacrt) - Added a hidden toggle to disable the negative cape (replaced with null cape (cause i thought it looked nice)) as a user was not able to play due to a graphical bug that caused their screen to turn full green. -- Fixed Typo in NEUButtons Dungeon preset catacombs floor 7 (jani270) +- Maybe fixed neu's slotlocking in dungeons. (limited testing) ### **Other** - Code clean up by Ironm00n. @@ -43,4 +51,6 @@ - Added a notice to /neusouls help to inform the user that it does not work in dungeons. - Removed unused texture. - Reformatted Total Slayer XP number. -- Added Master Mode buttons to NEUButtons dungeon preset (jani270) +- Added Master Mode buttons to NEUButtons dungeon preset. (jani270) +- Added Moul's twitch link to /neulinks. (GET THEM PRIMES) + -- cgit From c4fb9b642b7c5281c008cb25f82a9332a95eb775 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 3 Aug 2021 21:10:22 +0200 Subject: Revert "Fix chroma speed being chroma duration instead" This reverts commit 3ccbd6bb51f781d8c18d0389e5d8e79391b7c56c. --- .../moulberry/notenoughupdates/options/seperateSections/Misc.java | 2 +- src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 c9ee8c9b..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 @@ -66,7 +66,7 @@ public class Misc { maxValue = 500, minStep = 10 ) - public int chromaSpeed2 = 400; + public int chromaSpeed = 100; @Expose @ConfigOption( 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 fc8e2fa3..a4af51ca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -234,7 +234,7 @@ public class Utils { long currentTimeMillis = System.currentTimeMillis(); if(startTime == 0) startTime = currentTimeMillis; - int chromaSpeed = 510 - NotEnoughUpdates.INSTANCE.config.misc.chromaSpeed2; + int chromaSpeed = NotEnoughUpdates.INSTANCE.config.misc.chromaSpeed; if(chromaSpeed < 10) chromaSpeed = 10; if(chromaSpeed > 5000) chromaSpeed = 5000; -- cgit From 9370c7ce7b28ab766a3e4d6c97478456b251d9cf Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 4 Aug 2021 16:43:51 +0200 Subject: remove left overs from negative cape hotfix --- Update Notes/2.0-Pre31.md | 2 -- .../moulberry/notenoughupdates/cosmetics/CapeManager.java | 12 +++--------- .../github/moulberry/notenoughupdates/options/NEUConfig.java | 2 +- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 7475757e..e9a7db37 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -33,9 +33,7 @@ - Fixed dungeon win overlay. - Remove description and price tooltip from backpack/personalvault icon in /pv. - Fixed Typo in NEUButtons Dungeon preset catacombs floor 7. (jani270) -- Fixed chroma speed, should work as expected instead of the otherway around. - Fixed fastrender check for cosmetics gui and profile viewer. - - Change skyclient shader. (nacrt) - Added a hidden toggle to disable the negative cape (replaced with null cape (cause i thought it looked nice)) as a user was not able to play due to a graphical bug that caused their screen to turn full green. - Maybe fixed neu's slotlocking in dungeons. (limited testing) 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 44958889..583e3715 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -205,9 +205,7 @@ public class CapeManager { if(none) { localCape = null; } else { - if (!NotEnoughUpdates.INSTANCE.config.hidden.disableAllCapes) { - localCape = new MutablePair<>(new NEUCape(capename), capename); - } + localCape = new MutablePair<>(new NEUCape(capename), capename); } } else if(capeMap.containsKey(playerUUID)) { if(none) { @@ -217,9 +215,7 @@ public class CapeManager { capePair.setValue(capename); } } else if(!none) { - if (!NotEnoughUpdates.INSTANCE.config.hidden.disableAllCapes){ - capeMap.put(playerUUID, new MutablePair<>(new NEUCape(capename), capename)); - } + capeMap.put(playerUUID, new MutablePair<>(new NEUCape(capename), capename)); } } @@ -293,9 +289,7 @@ public class CapeManager { String selCape = NotEnoughUpdates.INSTANCE.config.hidden.selectedCape; if(selCape != null && !selCape.isEmpty()) { if(localCape == null) { - if (!NotEnoughUpdates.INSTANCE.config.hidden.disableAllCapes) { - localCape = new MutablePair<>(new NEUCape(selCape), selCape); - } + localCape = new MutablePair<>(new NEUCape(selCape), selCape); } else { localCape.setValue(selCape); } 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 0266772c..543d5bdd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -291,7 +291,7 @@ public class NEUConfig extends Config { //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 5179f39403adb90f73714837a54db69e840a47eb Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 4 Aug 2021 22:26:49 +0200 Subject: most likely fix the unintended autoclicker --- src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 856dcfc6..d5d89dd7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -209,6 +209,7 @@ public class NEUEventListener { @SubscribeEvent public void onTick(TickEvent.ClientTickEvent event) { + Keyboard.enableRepeatEvents(false); if(event.phase != TickEvent.Phase.START) return; if(Minecraft.getMinecraft().theWorld == null) return; if(Minecraft.getMinecraft().thePlayer == null) return; -- cgit From 4aab295d88364050ece76cd26d2a2fdf3bbed4ea Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 6 Aug 2021 18:12:02 +0200 Subject: Add how to get cosmetics Info to cosmetics Gui --- .../notenoughupdates/cosmetics/GuiCosmetics.java | 48 ++++++++++++++++++---- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java index 31eaccb1..978f3d6a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/GuiCosmetics.java @@ -1,7 +1,14 @@ package io.github.moulberry.notenoughupdates.cosmetics; +import com.google.common.collect.Lists; +import com.google.gson.Gson; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.reflect.TypeToken; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.GuiElementTextField; +import io.github.moulberry.notenoughupdates.util.Constants; +import io.github.moulberry.notenoughupdates.util.GuiTextures; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; @@ -41,7 +48,19 @@ public class GuiCosmetics extends GuiScreen { private String wantToEquipCape = null; private long lastCapeEquip = 0; - private List tooltipToDisplay = null; + private List cosmeticsInfoTooltip = null; + + + + public GuiCosmetics(){ + Gson gson = new Gson(); + + JsonElement cosmeticHelpTextElement = Utils.getElement(Constants.MISC, "cosmeticsinfo.lore"); + if(cosmeticHelpTextElement.isJsonArray()) { + cosmeticsInfoTooltip = gson.fromJson(cosmeticHelpTextElement, new TypeToken>(){}.getType()); + } + + } public enum CosmeticsPage { CAPES(new ItemStack(Items.chainmail_chestplate)); @@ -92,14 +111,16 @@ public class GuiCosmetics extends GuiScreen { drawCapesPage(mouseX, mouseY, partialTicks); break; } + int helpX = guiLeft+sizeX-20; + if(mouseX >= helpX && mouseX <= helpX+20 && mouseY >= guiTop-20 && mouseY <= guiTop) { + if(cosmeticsInfoTooltip != null) { + List grayTooltip = new ArrayList<>(cosmeticsInfoTooltip.size()); + for (String line : cosmeticsInfoTooltip) { + grayTooltip.add(EnumChatFormatting.GRAY + line); + } + Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj); - if(tooltipToDisplay != null) { - List grayTooltip = new ArrayList<>(tooltipToDisplay.size()); - for(String line : tooltipToDisplay) { - grayTooltip.add(EnumChatFormatting.GRAY + line); } - Utils.drawHoveringText(grayTooltip, mouseX, mouseY, width, height, -1, Minecraft.getMinecraft().fontRendererObj); - tooltipToDisplay = null; } StringBuilder statusMsg = new StringBuilder("Last Sync: "); @@ -116,7 +137,7 @@ public class GuiCosmetics extends GuiScreen { } Minecraft.getMinecraft().fontRendererObj.drawString(EnumChatFormatting.AQUA+statusMsg.toString(), - guiLeft+sizeX-Minecraft.getMinecraft().fontRendererObj.getStringWidth(statusMsg.toString()), guiTop-12, 0, true); + guiLeft+sizeX-Minecraft.getMinecraft().fontRendererObj.getStringWidth(statusMsg.toString())-20, guiTop-12, 0, true); if(currentPage == CosmeticsPage.CAPES) { GlStateManager.color(1, 1, 1, 1); @@ -148,6 +169,17 @@ public class GuiCosmetics extends GuiScreen { unlockTextField.setSize(80, 20); unlockTextField.render(guiLeft+sizeX-80, guiTop+sizeY+2); + + + + + Minecraft.getMinecraft().getTextureManager().bindTexture(GuiTextures.help); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(helpX, guiTop-20, 20, 20, GL11.GL_LINEAR); + + + + } private void renderTabs(boolean renderPressed) { -- cgit From 9ea25e893514550cb7bb587b31a2534787d98dd1 Mon Sep 17 00:00:00 2001 From: jani270 Date: Sat, 7 Aug 2021 00:43:43 +0200 Subject: Changed Fast Render MSG and added NEU Text to storage overlay --- .../moulberry/notenoughupdates/NotEnoughUpdates.java | 4 ++-- .../notenoughupdates/miscgui/StorageOverlay.java | 2 +- .../notenoughupdates/storage_gui/storage_gui_0.png | Bin 12354 -> 6939 bytes .../notenoughupdates/storage_gui/storage_gui_1.png | Bin 4726 -> 4859 bytes .../notenoughupdates/storage_gui/storage_gui_2.png | Bin 4341 -> 4380 bytes .../notenoughupdates/storage_gui/storage_gui_3.png | Bin 4417 -> 4469 bytes 6 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index eb40336c..205c0ce8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -611,7 +611,7 @@ public class NotEnoughUpdates { public void processCommand(ICommandSender sender, String[] args) { if(!OpenGlHelper.isFramebufferEnabled()) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "Some parts of the profile viewer do not work with OF Fast Render. Go to Video > Performance to disable it.")); + "Some parts of the profile viewer do not work with OF Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.")); } if (config.apiKey.apiKey == null || config.apiKey.apiKey.trim().isEmpty()) { @@ -1041,7 +1041,7 @@ public class NotEnoughUpdates { public void processCommand(ICommandSender sender, String[] args) { if(!OpenGlHelper.isFramebufferEnabled()) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + - "NEU cosmetics do not work with OF Fast Render. Go to Video > Performance to disable it.")); + "NEU cosmetics do not work with OF Fast Render. Go to ESC > Options > Video Settings > Performance > Fast Render to disable it.")); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index 352c000d..91ac5e6f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -1973,7 +1973,7 @@ public class StorageOverlay extends GuiElement { "\u00a74Fast Render Warning", "\u00a77Due to the way fast render works, it's not compatible with NEU.", "\u00a77Please disable fast render in your options under", - "\u00a77Options -> Video settings -> Performance -> Fast render", + "\u00a77ESC > Options > Video Settings > Performance > Fast Render", "\u00a77This can't be fixed.", "\u00a77", "\u00a77Press X on your keyboard to close this notifcation"), true, true); diff --git a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_0.png b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_0.png index 45e4bb3a..da1461be 100644 Binary files a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_0.png and b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_0.png differ diff --git a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_1.png b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_1.png index e8fdd727..3ff29ff1 100644 Binary files a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_1.png and b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_1.png differ diff --git a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_2.png b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_2.png index 9c1ff275..16150a20 100644 Binary files a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_2.png and b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_2.png differ diff --git a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png index fe03a5bd..755dc865 100644 Binary files a/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png and b/src/main/resources/assets/notenoughupdates/storage_gui/storage_gui_3.png differ -- cgit From 9f2ae5b34c08f8fab9c52c26f56df399229a2435 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 7 Aug 2021 21:01:12 +0200 Subject: Fix being able to drop slot locked items --- .../notenoughupdates/miscfeatures/SlotLocking.java | 32 ++++++++++++++++++++++ .../mixins/MixinEntityPlayerSP.java | 2 +- .../mixins/MixinInventoryPlayer.java | 12 +++++++- .../notenoughupdates/mixins/MixinMinecraft.java | 11 +++++++- .../options/seperateSections/SlotLocking.java | 13 +++++++++ src/main/resources/mixins.notenoughupdates.json | 1 + 6 files changed, 68 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index 1925811d..256cf03f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -26,6 +26,7 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; import org.apache.commons.lang3.tuple.Triple; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -87,6 +88,36 @@ public class SlotLocking { } } + public void changedSlot(int slotNumber){ + int pingModifier = NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockSwapDelay; + if(pingModifier == 0){ return; }; + long currentTimeMilis = System.currentTimeMillis(); + + for (int i = 0; i < slotChanges.length; i++) { + if(i != slotNumber && slotChanges[i] != 0 && slotChanges[i] < (currentTimeMilis+pingModifier)){ + slotChanges[i] = 0; + } + } + slotChanges[slotNumber] = currentTimeMilis; + } + + public boolean isSwapedSlotLocked(){ + int pingModifier = NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockSwapDelay; + if(pingModifier == 0){ return false; }; + long currentTimeMilis = System.currentTimeMillis(); + + for (int i = 0; i < slotChanges.length; i++) { + if(slotChanges[i] != 0 && slotChanges[i] < (currentTimeMilis+pingModifier)){ + if(isSlotIndexLocked(i)){ + return true; + } + } + } + return false; + } + + private long[] slotChanges = new long[9]; + public void saveConfig(File file) { try { file.createNewFile(); @@ -576,5 +607,6 @@ public class SlotLocking { return locked != null && (locked.locked || (NotEnoughUpdates.INSTANCE.config.slotLocking.bindingAlsoLocks && locked.boundTo != -1)); } + } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java index f82cc88f..35ee3a63 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinEntityPlayerSP.java @@ -22,7 +22,7 @@ public class MixinEntityPlayerSP { } int slot = Minecraft.getMinecraft().thePlayer.inventory.currentItem; - if(SlotLocking.getInstance().isSlotIndexLocked(slot)) { + if(SlotLocking.getInstance().isSlotIndexLocked(slot) || SlotLocking.getInstance().isSwapedSlotLocked()) { ci.cancel(); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED+ "NotEnoughUpdates has prevented you from dropping that locked item!")); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java index d31ab00a..f60a4839 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinInventoryPlayer.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.mixins; +import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.miscgui.InventoryStorageSelector; import net.minecraft.entity.player.InventoryPlayer; import org.spongepowered.asm.mixin.Mixin; @@ -11,10 +12,19 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; public class MixinInventoryPlayer { @Inject(method="changeCurrentItem", at=@At("RETURN")) - public void changeCurrentItem(int direction, CallbackInfo ci) { + public void changeCurrentItemReturn(int direction, CallbackInfo ci) { InventoryPlayer $this = (InventoryPlayer)(Object)this; $this.currentItem = InventoryStorageSelector.getInstance().onScroll(direction, $this.currentItem); + + + } + + @Inject(method="changeCurrentItem", at=@At("HEAD")) + public void changeCurrentItemHead(int direction, CallbackInfo ci) { + InventoryPlayer $this = (InventoryPlayer)(Object)this; + + SlotLocking.getInstance().changedSlot($this.currentItem); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java index 81ab8ec0..e2b4a156 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinMinecraft.java @@ -1,9 +1,12 @@ package io.github.moulberry.notenoughupdates.mixins; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; + import net.minecraft.client.Minecraft; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.EntityRenderer; +import org.spongepowered.asm.lib.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -14,7 +17,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(Minecraft.class) public class MixinMinecraft { - @Shadow public WorldClient theWorld; + //Commented as they were'nt being loaded before +/* @Shadow public WorldClient theWorld; @Shadow public EntityRenderer entityRenderer; @@ -33,6 +37,11 @@ public class MixinMinecraft { @Redirect(method="loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Ljava/lang/String;)V", at=@At(value = "INVOKE", target = "Ljava/lang/System;gc()V")) public void loadWorld_gc() { + }*/ + + @Inject(method = "runTick", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/player/InventoryPlayer;currentItem:I", opcode = Opcodes.PUTFIELD)) + public void currentItemMixin(CallbackInfo ci){ + SlotLocking.getInstance().changedSlot(Minecraft.getMinecraft().thePlayer.inventory.currentItem); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SlotLocking.java index 3da885a0..98358d83 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/SlotLocking.java @@ -49,6 +49,19 @@ public class SlotLocking { @ConfigEditorBoolean public boolean lockSlotsInTrade = true; + @Expose + @ConfigOption( + name = "Item Swap drop delay", + desc = "Set the delay between swapping to another item and being able to drop it.\n"+ + "This is to fix a bug that allowed you to drop slot locked items." + ) + @ConfigEditorSlider( + minValue = 0, + maxValue = 500, + minStep = 5 + ) + public int slotLockSwapDelay = 100; + @Expose @ConfigOption( name = "Slot Lock Sound", diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json index 0d415976..f82f6311 100644 --- a/src/main/resources/mixins.notenoughupdates.json +++ b/src/main/resources/mixins.notenoughupdates.json @@ -3,6 +3,7 @@ "refmap": "mixins.notenoughupdates.refmap.json", "compatibilityLevel": "JAVA_8", "mixins": [ + "MixinMinecraft", "MixinAbstractClientPlayer", "MixinContainer", "MixinEffectRenderer", -- cgit From 9b3b7163d0e2643e4dce82299315ec8bde8a0420 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 7 Aug 2021 21:50:10 +0200 Subject: Update change log --- Update Notes/2.0-Pre31.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index e9a7db37..33480a87 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -19,6 +19,7 @@ - Added option to disable neu's custom skulls. (idk why you would want it but its here) - Added explenation to search highlight feature. - Added fast render warning to storage gui. +- Added info about how to get neu capes to the cosmetics gui. ### **Bug Fixes** - Fishing helper not showing "!" when rod colours are disabled. @@ -37,6 +38,9 @@ - Change skyclient shader. (nacrt) - Added a hidden toggle to disable the negative cape (replaced with null cape (cause i thought it looked nice)) as a user was not able to play due to a graphical bug that caused their screen to turn full green. - Maybe fixed neu's slotlocking in dungeons. (limited testing) +- Fixed Key's being "autoclicked" when bound to a keyboard key. +- Fixed being able to drop slotlocked items by quickly swapping slots and spamming/holding Q. + ### **Other** - Code clean up by Ironm00n. -- cgit From 8f010423e71ff5017104762511ef08f67eb5a87a Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 9 Aug 2021 22:43:33 +0200 Subject: Fixed not being able to use keybinds while hovering over locked slots Took way longer than it could have cause i couldnt find out why something was null smh --- .../moulberry/notenoughupdates/miscfeatures/SlotLocking.java | 8 ++++++++ .../moulberry/notenoughupdates/mixins/MixinGuiContainer.java | 3 +++ .../java/io/github/moulberry/notenoughupdates/util/Utils.java | 7 ++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index 256cf03f..cd128ebe 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -79,6 +79,14 @@ public class SlotLocking { private boolean lockKeyHeld = false; private Slot pairingSlot = null; + private Slot realSlot = null; + + public void setRealSlot(Slot slot){ + realSlot = slot; + } + + public Slot getRealSlot(){ return realSlot;} + public void loadConfig(File file) { try(BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(file), StandardCharsets.UTF_8))) { config = GSON.fromJson(reader, SlotLockingConfig.class); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java index e527e18e..3ed16e76 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -101,7 +101,10 @@ public abstract class MixinGuiContainer extends GuiScreen { @Inject(method="drawScreen", at=@At("RETURN")) public void drawScreen(CallbackInfo ci) { if(theSlot != null && SlotLocking.getInstance().isSlotLocked(theSlot)) { + SlotLocking.getInstance().setRealSlot(theSlot); theSlot = null; + } else if( theSlot == null){ + SlotLocking.getInstance().setRealSlot(null); } } 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 a4af51ca..5ca9b316 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -8,6 +8,7 @@ import com.mojang.authlib.Agent; import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.miscfeatures.SlotLocking; import io.github.moulberry.notenoughupdates.util.TexLoc; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; @@ -433,7 +434,11 @@ public class Utils { } public static Slot getSlotUnderMouse(GuiContainer container) { - return (Slot) getField(GuiContainer.class, container, "theSlot", "field_147006_u"); + Slot slot = (Slot) getField(GuiContainer.class, container, "theSlot", "field_147006_u"); + if(slot == null){ + slot = SlotLocking.getInstance().getRealSlot(); + } + return slot; } public static void drawTexturedRect(float x, float y, float width, float height) { -- cgit From 9efa368ffdddd5292fb4a63eb3efd5b257d7c7e9 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 10 Aug 2021 11:21:04 +0200 Subject: Disable middle click search when searchbar is disabled --- .../java/io/github/moulberry/notenoughupdates/NEUOverlay.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 9872e70e..19bd0dfa 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -654,7 +654,7 @@ public class NEUOverlay extends Gui { public void mouseInputInv() { if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer) { - if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100) { + if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100 && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { Slot slot = Utils.getSlotUnderMouse((GuiContainer)Minecraft.getMinecraft().currentScreen); if(slot != null) { ItemStack hover = slot.getStack(); @@ -712,7 +712,7 @@ public class NEUOverlay extends Gui { manager.showRecipe(item); } else if(Mouse.getEventButton() == 1) { showInfo(item); - } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100) { + } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100 && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { textField.setText("id:"+item.get("internalname").getAsString()); updateSearch(); searchMode = true; @@ -745,7 +745,7 @@ public class NEUOverlay extends Gui { manager.showRecipe(item); } else if(Mouse.getEventButton() == 1) { showInfo(item); - } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100) { + } else if(Mouse.getEventButton() == manager.keybindItemSelect.getKeyCode()+100 && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { textField.setText("id:"+item.get("internalname").getAsString()); updateSearch(); searchMode = true; @@ -1037,7 +1037,7 @@ public class NEUOverlay extends Gui { Minecraft.getMinecraft().displayGuiScreen(new NEUItemEditor(manager, internalname.get(), item)); return true; - } else if(keyPressed == manager.keybindItemSelect.getKeyCode()) { + } else if(keyPressed == manager.keybindItemSelect.getKeyCode() && NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { textField.setText("id:"+internalname.get()); itemPaneOpen = true; updateSearch(); -- cgit From eb585a6d526b3d5e5e6dea74a203ef2122637792 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 10 Aug 2021 15:35:52 +0200 Subject: Redid bonemerang overlay --- .../miscfeatures/CustomItemEffects.java | 61 +---------- .../mixins/MixinRendererLivingEntity.java | 3 +- .../notenoughupdates/options/NEUConfig.java | 3 + .../options/seperateSections/ItemOverlays.java | 50 ++++++++- .../overlays/BonemerangOverlay.java | 112 +++++++++++++++++++++ .../notenoughupdates/overlays/OverlayManager.java | 15 +++ 6 files changed, 181 insertions(+), 63 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.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 cc13f59a..2f9d326e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -59,10 +59,7 @@ public class CustomItemEffects { public long lastUsedHyperion = 0; - private boolean heldBonemerang = false; - public final Set bonemeragedEntities = new HashSet<>(); - public boolean bonemerangBreak = false; public int aoteTeleportationMillis = 0; public Vector3f aoteTeleportationCurr = null; @@ -197,55 +194,7 @@ public class CustomItemEffects { tick++; if(tick > Integer.MAX_VALUE/2) tick = 0; - heldBonemerang = false; - bonemerangBreak = false; - bonemeragedEntities.clear(); - if(Minecraft.getMinecraft().thePlayer == null) return; - if(Minecraft.getMinecraft().theWorld == null) return; - - ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); - - String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); - if(internal != null && internal.equals("BONE_BOOMERANG")) { - heldBonemerang = true; - - EntityPlayerSP p = Minecraft.getMinecraft().thePlayer; - float stepSize = 0.15f; - float bonemerangDistance = 15; - - Vector3f position = new Vector3f((float)p.posX, (float)p.posY + p.getEyeHeight(), (float)p.posZ); - Vec3 look = p.getLook(0); - - Vector3f step = new Vector3f((float)look.xCoord, (float)look.yCoord, (float)look.zCoord); - step.scale(stepSize / step.length()); - - for(int i=0; i entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity(Minecraft.getMinecraft().thePlayer, bb); - for(Entity entity : entities) { - if(entity instanceof EntityLivingBase && !(entity instanceof EntityArmorStand) && !entity.isInvisible()) { - if(!bonemeragedEntities.contains(entity)) { - bonemeragedEntities.add((EntityLivingBase)entity); - } - } - } - } - position.translate(step.x, step.y, step.z); - } - } } private float lastPartialTicks = 0; @@ -329,14 +278,8 @@ public class CustomItemEffects { } } - if(heldBonemerang) { - if(bonemerangBreak) { - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - Utils.drawStringCentered(EnumChatFormatting.RED+"Bonemerang will break!", - Minecraft.getMinecraft().fontRendererObj, - scaledResolution.getScaledWidth()/2f, scaledResolution.getScaledHeight()/2f+10, true, 0); - } - } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay && + + if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay && Minecraft.getMinecraft().objectMouseOver != null && Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java index a71fd6f8..ee71a995 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.mixins; import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects; import io.github.moulberry.notenoughupdates.miscfeatures.DamageCommas; +import io.github.moulberry.notenoughupdates.overlays.BonemerangOverlay; import net.minecraft.client.renderer.entity.RendererLivingEntity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -30,7 +31,7 @@ public abstract class MixinRendererLivingEntity { @Inject(method="getColorMultiplier", at=@At("HEAD"), cancellable = true) public void getColorMultiplier(T entitylivingbaseIn, float lightBrightness, float partialTickTime, CallbackInfoReturnable cir) { - if(CustomItemEffects.INSTANCE.bonemeragedEntities.contains(entitylivingbaseIn)) { + if(BonemerangOverlay.INSTANCE.bonemeragedEntities.contains(entitylivingbaseIn)) { cir.setReturnValue(0x80ff9500); } } 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 543d5bdd..261be236 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -82,6 +82,9 @@ public class NEUConfig extends Config { case 8: NotEnoughUpdates.INSTANCE.openGui = new GuiEnchantColour(); return; + case 9: + editOverlay(activeConfigCategory, OverlayManager.bonemerangOverlay, itemOverlays.bonemerangPosition); + return; } } 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 501bc8ae..82f73891 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 @@ -1,8 +1,13 @@ package io.github.moulberry.notenoughupdates.options.seperateSections; import com.google.gson.annotations.Expose; +import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.core.config.annotations.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + public class ItemOverlays { @ConfigOption( name = "Treecapitator Overlay", @@ -209,12 +214,51 @@ public class ItemOverlays { @Expose @ConfigOption( - name = "Break Warning", - desc = "Show a warning below your crosshair if the bonemerang will break on a block" + name = "Bonemerang overlay Position", + desc = "The position of the Bonemerang overlay." + ) + @ConfigEditorButton( + runnableId = 9, + buttonText = "Edit" + ) + @ConfigAccordionId(id = 3) + public Position bonemerangPosition = new Position(-1, -1); + + @Expose + @ConfigOption( + name = "Bonemerang overlay Text", + desc = "\u00a7eDrag text to change the appearance of the overlay\n" + + "\u00a7rHold a Bonemerang to display the overlay" + ) + @ConfigEditorDraggableList( + exampleText = {"\u00a74Gonna break", + "\u00a77Targets: \u00a76\u00a7l10" + } + ) + @ConfigAccordionId(id = 3) + public List bonemerangOverlayText = new ArrayList<>(Arrays.asList(0, 1)); + + @Expose + @ConfigOption( + name = "Bonemerang Overlay Style", + desc = "Change the style of the Bonemerang overlay" + ) + @ConfigEditorDropdown( + values = {"Background", "No Shadow", "Shadow Only", "Full Shadow"} + ) + @ConfigAccordionId(id = 3) + public int bonemerangOverlayStyle = 0; + @Expose + @ConfigOption( + name = "Fast update", + desc = "Updates the bonemerang overlay faster.\n"+ + "Might cause some lag." ) @ConfigEditorBoolean @ConfigAccordionId(id = 3) - public boolean showBreak = true; + public boolean bonemerangFastUpdate = false; + + @ConfigOption( name = "Minion Crystal Radius Overlay", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java new file mode 100644 index 00000000..e8d34ec7 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java @@ -0,0 +1,112 @@ +package io.github.moulberry.notenoughupdates.overlays; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.config.Position; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityArmorStand; +import net.minecraft.item.ItemStack; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.Vec3; +import org.lwjgl.util.vector.Vector3f; + +import java.util.*; +import java.util.function.Supplier; + +import static net.minecraft.util.EnumChatFormatting.DARK_AQUA; + +public class BonemerangOverlay extends TextOverlay{ + public BonemerangOverlay(Position position, Supplier> dummyStrings, Supplier styleSupplier) { + super(position, dummyStrings, styleSupplier); + INSTANCE = this; + } + public static BonemerangOverlay INSTANCE; + + + public final Set bonemeragedEntities = new HashSet<>(); + + + + @Override + public void updateFrequent() { + if(NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangFastUpdate){ + updateOverlay(); + } + + } + + @Override + public void update() { + if(!NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangFastUpdate){ + updateOverlay(); + } + + } + + private void updateOverlay(){ + overlayStrings = new ArrayList<>(); + + + bonemeragedEntities.clear(); + if(Minecraft.getMinecraft().thePlayer == null) return; + if(Minecraft.getMinecraft().theWorld == null) return; + + ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); + + String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); + + if(internal != null && internal.equals("BONE_BOOMERANG")) { + HashMap map = new HashMap<>(); + + + EntityPlayerSP p = Minecraft.getMinecraft().thePlayer; + float stepSize = 0.15f; + float bonemerangDistance = 15; + + Vector3f position = new Vector3f((float)p.posX, (float)p.posY + p.getEyeHeight(), (float)p.posZ); + Vec3 look = p.getLook(0); + + Vector3f step = new Vector3f((float)look.xCoord, (float)look.yCoord, (float)look.zCoord); + step.scale(stepSize / step.length()); + + for(int i=0; i entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity(Minecraft.getMinecraft().thePlayer, bb); + for(Entity entity : entities) { + if(entity instanceof EntityLivingBase && !(entity instanceof EntityArmorStand) && !entity.isInvisible()) { + if(!bonemeragedEntities.contains(entity)) { + bonemeragedEntities.add((EntityLivingBase)entity); + } + } + } + } + position.translate(step.x, step.y, step.z); + } + + map.put(1, EnumChatFormatting.GRAY+"Targets: "+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+bonemeragedEntities.size()); + for(int index : NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangOverlayText) { + if(map.containsKey(index)) { + overlayStrings.add(map.get(index)); + } + } + + } + + if(overlayStrings.isEmpty()) overlayStrings = null; + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java index 357815b7..3c1f2e3a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -15,6 +15,7 @@ public class OverlayManager { public static FarmingOverlay farmingOverlay; public static PetInfoOverlay petInfoOverlay; public static TimersOverlay timersOverlay; + public static BonemerangOverlay bonemerangOverlay; public static final List textOverlays = new ArrayList<>(); static { @@ -108,9 +109,23 @@ public class OverlayManager { return TextOverlayStyle.BACKGROUND; }); + List bonemerangDummy = Lists.newArrayList( + "\u00a74Gonna break", + "\u00a77Targets: \u00a76\u00a7lLike alot" + ); + bonemerangOverlay = new BonemerangOverlay(NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangPosition, () -> bonemerangDummy, () -> { + int style = NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangOverlayStyle; + if(style >= 0 && style < TextOverlayStyle.values().length) { + return TextOverlayStyle.values()[style]; + } + return TextOverlayStyle.BACKGROUND; + }); + + textOverlays.add(miningOverlay); textOverlays.add(farmingOverlay); textOverlays.add(petInfoOverlay); + textOverlays.add(bonemerangOverlay); } -- cgit From 91dc78fde9f515cdcc8a7b4f690bd1bde5957326 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 10 Aug 2021 15:39:58 +0200 Subject: Added a toggle to bonemerang overlay --- .../notenoughupdates/options/seperateSections/ItemOverlays.java | 9 +++++++++ .../moulberry/notenoughupdates/overlays/BonemerangOverlay.java | 4 ++++ 2 files changed, 13 insertions(+) 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 82f73891..6233945b 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 @@ -203,6 +203,15 @@ public class ItemOverlays { @ConfigEditorAccordion(id = 3) public boolean bonemerangAccordion = false; + @Expose + @ConfigOption( + name = "Enable Bonemerang Overlay", + desc = "Shows info about the bonemerang while holding it." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean enableBonemerangOverlay = true; + @Expose @ConfigOption( name = "Highlight Targeted Entities", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java index e8d34ec7..e108e232 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java @@ -48,6 +48,10 @@ public class BonemerangOverlay extends TextOverlay{ } private void updateOverlay(){ + if(!NotEnoughUpdates.INSTANCE.config.itemOverlays.enableBonemerangOverlay){ + overlayStrings = null; + return; + } overlayStrings = new ArrayList<>(); -- cgit From e234eb53d30b7005829e0d6dac4cd4748f46f57d Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 10 Aug 2021 16:17:11 +0200 Subject: Fixed capitalisation in itemoverlay settings --- .../notenoughupdates/options/seperateSections/ItemOverlays.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 6233945b..5b7dbbb0 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 @@ -223,7 +223,7 @@ public class ItemOverlays { @Expose @ConfigOption( - name = "Bonemerang overlay Position", + name = "Bonemerang Overlay Position", desc = "The position of the Bonemerang overlay." ) @ConfigEditorButton( @@ -235,7 +235,7 @@ public class ItemOverlays { @Expose @ConfigOption( - name = "Bonemerang overlay Text", + name = "Bonemerang Overlay Text", desc = "\u00a7eDrag text to change the appearance of the overlay\n" + "\u00a7rHold a Bonemerang to display the overlay" ) -- cgit From 4993d127348f00bafd73fb0fe5b8cc6a0c2346d1 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 10 Aug 2021 16:28:39 +0200 Subject: Fix bug with bonemerang overlay should be all good now --- .../mixins/MixinRendererLivingEntity.java | 3 ++- .../overlays/BonemerangOverlay.java | 26 ++++++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java index ee71a995..7a1be4de 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinRendererLivingEntity.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.mixins; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.miscfeatures.CustomItemEffects; import io.github.moulberry.notenoughupdates.miscfeatures.DamageCommas; import io.github.moulberry.notenoughupdates.overlays.BonemerangOverlay; @@ -31,7 +32,7 @@ public abstract class MixinRendererLivingEntity { @Inject(method="getColorMultiplier", at=@At("HEAD"), cancellable = true) public void getColorMultiplier(T entitylivingbaseIn, float lightBrightness, float partialTickTime, CallbackInfoReturnable cir) { - if(BonemerangOverlay.INSTANCE.bonemeragedEntities.contains(entitylivingbaseIn)) { + if(BonemerangOverlay.INSTANCE.bonemeragedEntities.contains(entitylivingbaseIn) && NotEnoughUpdates.INSTANCE.config.itemOverlays.highlightTargeted) { cir.setReturnValue(0x80ff9500); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java index e108e232..7d54cf47 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/BonemerangOverlay.java @@ -48,7 +48,7 @@ public class BonemerangOverlay extends TextOverlay{ } private void updateOverlay(){ - if(!NotEnoughUpdates.INSTANCE.config.itemOverlays.enableBonemerangOverlay){ + if(!NotEnoughUpdates.INSTANCE.config.itemOverlays.enableBonemerangOverlay && NotEnoughUpdates.INSTANCE.config.itemOverlays.highlightTargeted){ overlayStrings = null; return; } @@ -89,23 +89,25 @@ public class BonemerangOverlay extends TextOverlay{ break; } - if(NotEnoughUpdates.INSTANCE.config.itemOverlays.highlightTargeted) { - List entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity(Minecraft.getMinecraft().thePlayer, bb); - for(Entity entity : entities) { - if(entity instanceof EntityLivingBase && !(entity instanceof EntityArmorStand) && !entity.isInvisible()) { - if(!bonemeragedEntities.contains(entity)) { - bonemeragedEntities.add((EntityLivingBase)entity); - } + + List entities = Minecraft.getMinecraft().theWorld.getEntitiesWithinAABBExcludingEntity(Minecraft.getMinecraft().thePlayer, bb); + for (Entity entity : entities) { + if (entity instanceof EntityLivingBase && !(entity instanceof EntityArmorStand) && !entity.isInvisible()) { + if (!bonemeragedEntities.contains(entity)) { + bonemeragedEntities.add((EntityLivingBase) entity); } } } + position.translate(step.x, step.y, step.z); } + if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableBonemerangOverlay) { - map.put(1, EnumChatFormatting.GRAY+"Targets: "+ EnumChatFormatting.GOLD+EnumChatFormatting.BOLD+bonemeragedEntities.size()); - for(int index : NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangOverlayText) { - if(map.containsKey(index)) { - overlayStrings.add(map.get(index)); + map.put(1, EnumChatFormatting.GRAY + "Targets: " + EnumChatFormatting.GOLD + EnumChatFormatting.BOLD + bonemeragedEntities.size()); + for (int index : NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangOverlayText) { + if (map.containsKey(index)) { + overlayStrings.add(map.get(index)); + } } } -- cgit From 7f703f867435734b892e5a36b3314ee315d8887e Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 10 Aug 2021 19:36:31 +0200 Subject: Fix dungeon map appearing in boss room while holding bow --- .../io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java index 01b27f3d..658f72df 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/dungeons/DungeonMap.java @@ -22,6 +22,7 @@ import net.minecraft.client.shader.Shader; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; +import net.minecraft.item.Item; import net.minecraft.item.ItemMap; import net.minecraft.item.ItemStack; import net.minecraft.scoreboard.Score; @@ -1516,6 +1517,10 @@ public class DungeonMap { renderMap(pos.getAbsX(scaledResolution, size/2)+size/2, pos.getAbsY(scaledResolution, size/2)+size/2, colourMap, decorations, roomSizeBlocks, actualPlayers, true, event.partialTicks); Utils.pushGuiScale(-1); + } else if(stack != null && Item.getIdFromItem(stack.getItem()) == 399){ + //This should clear the map if you're in the dungeon boss room + //so when you're holding a bow it doesnt show the map anymore + this.colourMap = null; } } } -- cgit From 466a06bbb9073b6f87bfac544d9c1bbea6eb5bab Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 11 Aug 2021 11:44:30 +0200 Subject: Added help command and disabled outdated commands tutorial and gamemodes have been disabled --- .../notenoughupdates/NotEnoughUpdates.java | 63 +++++++++++++++++++++- 1 file changed, 61 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index eb40336c..bee1da68 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -233,6 +233,64 @@ public class NotEnoughUpdates { } });*/ + SimpleCommand neuhelp = new SimpleCommand("neuhelp", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + ArrayList neuHelpMessages = Lists.newArrayList( + "\u00a75\u00a7lNotEnoughUpdates commands", + "\u00a76/neu \u00a77- opens the neu gui", + "\u00a76/pv \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- opens the profile viewer", + "\u00a76/neusouls \u00a7r\u00a77- fairy souls waypoints", + "\u00a76/neubuttons \u00a7r\u00a77- add custom inventory buttons", + "\u00a76/neuec \u00a7r\u00a77- recolour enchantment text", + + "\u00a76/join {floor} \u00a7r\u00a77- quickly join a dungeon {4/f7/m5}", + "\u00a76/neucosmetics \u00a7r\u00a77- open the cosmetic gui", + "\u00a76/neurename \u00a7r\u00a77- rename/customize items/armor", + "\u00a76/cata \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- opens the profile viewer's catacombs page", + "\u00a76/neulinks \u00a7r\u00a77- links to neu/moulberry", + "\u00a76/neuoverlay \u00a7r\u00a77- inventory overlay placement command", + "\u00a76/neuah \u00a7r\u00a77- neu's custom Auction house gui", + "\u00a76/neumap \u00a7r\u00a77- opens the dungeon map gui", + "\u00a76/neucalendar \u00a7r\u00a77- opens neu's custom calendar gui", + "", + "\u00a76\u00a7lOld commands:", + "\u00a76/peek \u00a7b?{user} \u00a72\u2D35 \u00a7r\u00a77- quickly get stats for a user", + "", + "\u00a76\u00a7lDebug commands:", + "\u00a76/neustats \u00a7r\u00a77- copies pc info to clipboard", + "\u00a76/neustats modlist \u00a7r\u00a77- copies mod list info to clipboard", + "\u00a76/neuresetrepo \u00a7r\u00a77- resets the repo", + "\u00a76/neureloadrepo \u00a7r\u00a77- reloads the repo", + "", + "\u00a76\u00a7lDev commands:", + "\u00a76/neupackdev \u00a7r\u00a77- pack creator command - getnpc", + "\u00a76/neudevtest \u00a7r\u00a77- dont touch - moulberry"); + for (int i = 0; i < neuHelpMessages.size(); i++) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuHelpMessages.get(i) + )); + + } + if(NotEnoughUpdates.INSTANCE.config.hidden.dev) { + ArrayList neuDevHelpMessages = Lists.newArrayList( + + "\u00a76/neuzeephere \u00a7r\u00a77- sphere", + "\u00a76/neudungeonwintest \u00a7r\u00a77- displays the dungeon win screen"); + + for (int i = 0; i < neuDevHelpMessages.size(); i++) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuDevHelpMessages.get(i) + )); + + } + } + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a7fCommands marked with a \u00a72\"\u2D35\"\u00a7f require are api key. You can set your api key via \u00a77\"/api new\"\u00a7f or \u00a7fby manually putting it in the api field in \u00a77\"/neu\"")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a7fArguments marked with a \u00a7b\"?\"\u00a7f are optional.")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a76\u00a7lScroll up to see everything")); + } + }); + SimpleCommand stWhyCommand = new SimpleCommand("neustwhy", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { NEUEventListener.displayNotification(Lists.newArrayList( @@ -1183,7 +1241,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(nullzeeSphereCommand); ClientCommandHandler.instance.registerCommand(cosmeticsCommand); ClientCommandHandler.instance.registerCommand(linksCommand); - ClientCommandHandler.instance.registerCommand(gamemodesCommand); + //ClientCommandHandler.instance.registerCommand(gamemodesCommand); ClientCommandHandler.instance.registerCommand(stWhyCommand); ClientCommandHandler.instance.registerCommand(buttonsCommand); ClientCommandHandler.instance.registerCommand(resetRepoCommand); @@ -1200,7 +1258,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(packDevCommand); if(!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(viewCataCommand); ClientCommandHandler.instance.registerCommand(peekCommand); - ClientCommandHandler.instance.registerCommand(tutorialCommand); + //ClientCommandHandler.instance.registerCommand(tutorialCommand); ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); ClientCommandHandler.instance.registerCommand(enchantColourCommand); ClientCommandHandler.instance.registerCommand(neuAhCommand); @@ -1212,6 +1270,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(dungeonWinTest); ClientCommandHandler.instance.registerCommand(calendarCommand); ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommand()); + ClientCommandHandler.instance.registerCommand(neuhelp); BackgroundBlur.registerListener(); -- cgit From b9969795b98665509af5ba05fc60c30e7459a52a Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 11 Aug 2021 12:30:55 +0200 Subject: move devtest command to dev commands and change white to gray --- .../io/github/moulberry/notenoughupdates/NotEnoughUpdates.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index bee1da68..3bb3c0e6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -263,8 +263,7 @@ public class NotEnoughUpdates { "\u00a76/neureloadrepo \u00a7r\u00a77- reloads the repo", "", "\u00a76\u00a7lDev commands:", - "\u00a76/neupackdev \u00a7r\u00a77- pack creator command - getnpc", - "\u00a76/neudevtest \u00a7r\u00a77- dont touch - moulberry"); + "\u00a76/neupackdev \u00a7r\u00a77- pack creator command - getnpc"); for (int i = 0; i < neuHelpMessages.size(); i++) { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(neuHelpMessages.get(i) )); @@ -272,7 +271,7 @@ public class NotEnoughUpdates { } if(NotEnoughUpdates.INSTANCE.config.hidden.dev) { ArrayList neuDevHelpMessages = Lists.newArrayList( - + "\u00a76/neudevtest \u00a7r\u00a77- dev test command", "\u00a76/neuzeephere \u00a7r\u00a77- sphere", "\u00a76/neudungeonwintest \u00a7r\u00a77- displays the dungeon win screen"); @@ -283,9 +282,9 @@ public class NotEnoughUpdates { } } Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a7fCommands marked with a \u00a72\"\u2D35\"\u00a7f require are api key. You can set your api key via \u00a77\"/api new\"\u00a7f or \u00a7fby manually putting it in the api field in \u00a77\"/neu\"")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Commands marked with a \u00a72\"\u2D35\"\u00a77 require are api key. You can set your api key via \"/api new\" or by manually putting it in the api field in \"/neu\"")); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a7fArguments marked with a \u00a7b\"?\"\u00a7f are optional.")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a77Arguments marked with a \u00a7b\"?\"\u00a77 are optional.")); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a76\u00a7lScroll up to see everything")); } -- cgit From 1dc2b76f92322e7848e9d8d122a39254a5df5225 Mon Sep 17 00:00:00 2001 From: jani270 Date: Wed, 11 Aug 2021 17:34:37 +0200 Subject: Updated neuhelp text --- .../notenoughupdates/NotEnoughUpdates.java | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index da35d6ab..97c5e818 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -237,30 +237,30 @@ public class NotEnoughUpdates { public void processCommand(ICommandSender sender, String[] args) { ArrayList neuHelpMessages = Lists.newArrayList( "\u00a75\u00a7lNotEnoughUpdates commands", - "\u00a76/neu \u00a77- opens the neu gui", - "\u00a76/pv \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- opens the profile viewer", - "\u00a76/neusouls \u00a7r\u00a77- fairy souls waypoints", - "\u00a76/neubuttons \u00a7r\u00a77- add custom inventory buttons", - "\u00a76/neuec \u00a7r\u00a77- recolour enchantment text", - - "\u00a76/join {floor} \u00a7r\u00a77- quickly join a dungeon {4/f7/m5}", - "\u00a76/neucosmetics \u00a7r\u00a77- open the cosmetic gui", - "\u00a76/neurename \u00a7r\u00a77- rename/customize items/armor", - "\u00a76/cata \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- opens the profile viewer's catacombs page", - "\u00a76/neulinks \u00a7r\u00a77- links to neu/moulberry", - "\u00a76/neuoverlay \u00a7r\u00a77- inventory overlay placement command", - "\u00a76/neuah \u00a7r\u00a77- neu's custom Auction house gui", - "\u00a76/neumap \u00a7r\u00a77- opens the dungeon map gui", - "\u00a76/neucalendar \u00a7r\u00a77- opens neu's custom calendar gui", + "\u00a76/neu \u00a77- Opens the main neu GUI.", + "\u00a76/pv \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer", + "\u00a76/neusouls {on/off/clear/unclear}\u00a7r\u00a77- Shows waypoints to fairy souls.", + "\u00a76/neubuttons \u00a7r\u00a77- Opens a GUI which allows you to customize inventory buttons.", + "\u00a76/neuec \u00a7r\u00a77- Opens the enchant colour GUI.", + + "\u00a76/join {floor} \u00a7r\u00a77- Short Command to join a Dungeon. \u00a7lNeed a Party of 5 People\u00a7r\u00a77 {4/f7/m5}.", + "\u00a76/neucosmetics \u00a7r\u00a77- Opens the cosmetic GUI.", + "\u00a76/neurename \u00a7r\u00a77- Opens the NEU Item Customizer.", + "\u00a76/cata \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer's catacombs page.", + "\u00a76/neulinks \u00a7r\u00a77- Shows links to neu/moulberry.", + "\u00a76/neuoverlay \u00a7r\u00a77- Opens GUI Editor for quickcommands and searchbar.", + "\u00a76/neuah \u00a7r\u00a77- Opens neu's custom ah GUI.", + "\u00a76/neumap \u00a7r\u00a77- Opens the dungeon map GUI.", + "\u00a76/neucalendar \u00a7r\u00a77- Opens neu's custom calendar GUI.", "", "\u00a76\u00a7lOld commands:", - "\u00a76/peek \u00a7b?{user} \u00a72\u2D35 \u00a7r\u00a77- quickly get stats for a user", + "\u00a76/peek \u00a7b?{user} \u00a72\u2D35 \u00a7r\u00a77- Shows quickly stats for a user.", "", "\u00a76\u00a7lDebug commands:", - "\u00a76/neustats \u00a7r\u00a77- copies pc info to clipboard", - "\u00a76/neustats modlist \u00a7r\u00a77- copies mod list info to clipboard", - "\u00a76/neuresetrepo \u00a7r\u00a77- resets the repo", - "\u00a76/neureloadrepo \u00a7r\u00a77- reloads the repo", + "\u00a76/neustats \u00a7r\u00a77- Copies helpful info to the clipboard.", + "\u00a76/neustats modlist \u00a7r\u00a77- Copies modlist info to clipboard.", + "\u00a76/neuresetrepo \u00a7r\u00a77- Deletes all repo files.", + "\u00a76/neureloadrepo \u00a7r\u00a77- Debug command with repo.", "", "\u00a76\u00a7lDev commands:", "\u00a76/neupackdev \u00a7r\u00a77- pack creator command - getnpc"); -- cgit From 385fc2d6d028447258cc31e60326a0fc39b4be81 Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 11 Aug 2021 22:12:50 +0200 Subject: Add a missing space to help command --- .../java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 97c5e818..bdb94a41 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -239,7 +239,7 @@ public class NotEnoughUpdates { "\u00a75\u00a7lNotEnoughUpdates commands", "\u00a76/neu \u00a77- Opens the main neu GUI.", "\u00a76/pv \u00a7b?{name} \u00a72\u2D35 \u00a7r\u00a77- Opens the profile viewer", - "\u00a76/neusouls {on/off/clear/unclear}\u00a7r\u00a77- Shows waypoints to fairy souls.", + "\u00a76/neusouls {on/off/clear/unclear} \u00a7r\u00a77- Shows waypoints to fairy souls.", "\u00a76/neubuttons \u00a7r\u00a77- Opens a GUI which allows you to customize inventory buttons.", "\u00a76/neuec \u00a7r\u00a77- Opens the enchant colour GUI.", -- cgit From 58e60def541f21260c567a6ec939d9b8e4683167 Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 12 Aug 2021 15:06:40 +0200 Subject: Fixed dwarven mines waypoints not working if overlay was disabled --- .../github/moulberry/notenoughupdates/overlays/MiningOverlay.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index bafd04b6..e6bc90ad 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -155,7 +155,7 @@ public class MiningOverlay extends TextOverlay { } }*/ - if(!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay) return; + if(!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay && NotEnoughUpdates.INSTANCE.config.mining.emissaryWaypoints == 0) return; if(SBInfo.getInstance().getLocation() == null) return; if(!SBInfo.getInstance().getLocation().equals("mining_3") && !SBInfo.getInstance().getLocation().equals("crystal_hollows")) return; @@ -217,6 +217,10 @@ public class MiningOverlay extends TextOverlay { forges = false; } } + if(!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay){ + overlayStrings = null; + return; + } List commissionsStrings = new ArrayList<>(); for(Map.Entry entry : commissionProgress.entrySet()) { -- cgit From 20876c7a8a15aad04cf99c9f4214e0f8b6a462b2 Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 12 Aug 2021 16:14:34 +0200 Subject: Add prismapump overlay toggle --- .../notenoughupdates/miscfeatures/CustomItemEffects.java | 2 +- .../options/seperateSections/ItemOverlays.java | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) 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 2f9d326e..3ca05dea 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -795,7 +795,7 @@ public class CustomItemEffects { GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } - } else if((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET")) && + } else if((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET") && NotEnoughUpdates.INSTANCE.config.itemOverlays.enablePrismapumpOverlay) && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { BlockPos hover = event.target.getBlockPos().offset(event.target.sideHit, 1); 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 5b7dbbb0..af236bf8 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 @@ -279,7 +279,7 @@ public class ItemOverlays { @Expose @ConfigOption( name = "Enable Crystal Overlay", - desc = "Show a block overlay for the effective radius of minion crystals (farming, mining, etc)" + desc = "Show a block overlay for the effective radius of minion crystals (farming, mining, etc)." ) @ConfigEditorBoolean @ConfigAccordionId(id = 5) @@ -288,9 +288,19 @@ public class ItemOverlays { @Expose @ConfigOption( name = "Always Show Crystal Overlay", - desc = "Show the crystal overlay, even when a minion crystal is not being held" + desc = "Show the crystal overlay, even when a minion crystal is not being held." ) @ConfigEditorBoolean @ConfigAccordionId(id = 5) public boolean alwaysShowCrystal = false; + + + @Expose + @ConfigOption( + name = "Enable Prismapump Overlay", + desc = "Show a block overlay for the effected blocks of prismapump's ability." + ) + @ConfigEditorBoolean + public boolean enablePrismapumpOverlay = true; + } -- cgit From be000081ccf5d6f69586d7b63a32df1984b1bd82 Mon Sep 17 00:00:00 2001 From: TymanWasTaken Date: Thu, 12 Aug 2021 20:02:15 -0400 Subject: Add workflow --- .github/workflows/build.yml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..2df530bf --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,42 @@ +name: Build + +on: + push: + branches: [ master ] + paths-ignore: + - 'README.md' + - 'LICENSE' + - '.gitignore' + pull_request: + branches: [ master ] + paths-ignore: + - 'README.md' + - 'LICENSE' + - '.gitignore' + workflow_dispatch: +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew build --no-daemon + - uses: actions/upload-artifact@v2 + with: + path: build/libs/*.jar -- cgit From 4cd0aad40adda684235ead5defa84d880a3f447d Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 13 Aug 2021 13:06:47 +0200 Subject: Add load and save to/from clipboard for invbuttons and neuec Clipboard should be a base64 encoded javaarray --- .../notenoughupdates/miscgui/GuiEnchantColour.java | 225 +++++++++++++++++++-- .../miscgui/GuiInvButtonEditor.java | 84 +++++++- 2 files changed, 294 insertions(+), 15 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java index df13b42a..7a82dc4a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java @@ -2,10 +2,10 @@ package io.github.moulberry.notenoughupdates.miscgui; import com.google.common.base.Splitter; import com.google.common.collect.Lists; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; +import com.google.gson.*; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger; +import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.Utils; @@ -19,19 +19,32 @@ import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; +import java.awt.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.UnsupportedFlavorException; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; +import java.util.Base64; import java.util.HashMap; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import static io.github.moulberry.notenoughupdates.util.GuiTextures.button_tex; public class GuiEnchantColour extends GuiScreen { public static final ResourceLocation custom_ench_colour = new ResourceLocation("notenoughupdates:custom_ench_colour.png"); + private int guiLeft; private int guiTop; private final int xSize = 217; private int ySize = 0; + private int ySizeSidebar = 0; + private int guiTopSidebar; public static final Splitter splitter = Splitter.on(":").limit(5); @@ -40,14 +53,18 @@ public class GuiEnchantColour extends GuiScreen { private List guiElementTextFields = new ArrayList<>(); private List enchantNamesPretty = null; + private JsonArray enchantPresets = null; private LerpingInteger scroll = new LerpingInteger(0, 100); + private LerpingInteger scrollSideBar = new LerpingInteger(0, 100); public static int BOLD_MODIFIER = 0b1; public static int ITALIC_MODIFIER = 0b10; public static int OBFUSCATED_MODIFIER = 0b100; public static int UNDERLINE_MODIFIER = 0b1000; public static int STRIKETHROUGH_MODIFIER = 0b10000; + private Gson gson = new Gson(); + private static final Pattern settingPattern = Pattern.compile(".*:[>=<]:[0-9]:[a-zA-Z0-9]:[0-9][0-9]?"); private List getEnchantNamesPretty() { if(enchantNamesPretty == null) { @@ -79,14 +96,17 @@ public class GuiEnchantColour extends GuiScreen { ySize = 53+25*enchantColours.size(); guiLeft = (width-xSize)/2; + if(ySize > height) { - if(scroll.getTarget() > 0) { + + if (scroll.getTarget() > 0) { scroll.setTarget(0); - } else if(scroll.getTarget() < height-ySize) { - scroll.setTarget(height-ySize); + } else if (scroll.getTarget() < height - ySize) { + scroll.setTarget(height - ySize); } scroll.tick(); guiTop = scroll.getValue(); + } else { guiTop = (height-ySize)/2; scroll.setValue(0); @@ -105,6 +125,12 @@ public class GuiEnchantColour extends GuiScreen { Utils.drawStringCentered("Add Ench Colour", fontRendererObj, guiLeft+xSize/2+1, guiTop+ySize-20, false, 4210752); + //Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); + +// Utils.drawTexturedRect(guiLeft+2, guiTop+ySize+2, 48, 16); +// Utils.drawTexturedRect(guiLeft+xSize-50, guiTop+ySize+2, 48, 16); + + int yIndex = 0; for(String str : enchantColours) { Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); @@ -165,6 +191,83 @@ public class GuiEnchantColour extends GuiScreen { yIndex++; } + renderSideBar(mouseX, mouseY, partialTicks); + } + + private void renderSideBar(int mouseX, int mouseY, float partialTicks){ + //ySizeSidebar = 25*(enchantPresets.size()+2); +// enchantPresets = getEnchantPresetKeys(); + + + ySizeSidebar = 24*(2); + + + if(ySizeSidebar > height) { + + if (scrollSideBar.getTarget() > 0) { + scrollSideBar.setTarget(0); + } else if (scrollSideBar.getTarget() < height - ySizeSidebar) { + scrollSideBar.setTarget(height - ySizeSidebar); + } + + scrollSideBar.tick(); + guiTopSidebar = scrollSideBar.getValue(); + + } else { + guiTopSidebar = (height-ySizeSidebar)/2; + scrollSideBar.setValue(0); + scrollSideBar.resetTimer(); + } + + Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2+24, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawStringCenteredScaledMaxWidth("Load preset from clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("Save preset to clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12+24, false, 86, 4210752); + +// for (int i = 0; i < enchantPresets.size(); i++) { +// +// Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); +// GlStateManager.color(1, 1, 1, 1); +// Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2+24*(i+2), 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); +// String text; +// +// text = "Test"; +// +//// { +//// JsonElement element = enchantPresets.get(i - 2); +//// if(element.isJsonObject()){ +//// JsonObject object = enchantPresets.get(i - 2).getAsJsonObject(); +//// if(object.has("NAME")){ +//// JsonElement nameobject = object.get("NAME"); +//// if(nameobject.isJsonPrimitive()){ +//// text = nameobject.getAsJsonPrimitive().getAsString(); +//// break; +//// } +//// } +//// } +//// text = "ERROR"; +//// } +//// break; +// +// Utils.drawStringCenteredScaledMaxWidth(text, fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12+24*i, false, 86, 4210752); +// } + + + } + + private JsonArray getEnchantPresetKeys(){ + return new JsonArray(); +// if(enchantPresets == null) { +// JsonObject enchantsJson = Constants.ENCHANTS; +// if(!enchantsJson.has("enchants_pretty")) { +// return new JsonArray(); +// } else { +// JsonArray pretty = enchantsJson.getAsJsonArray("enchants_pretty"); +// } +// } +// return enchantPresets; } @Override @@ -218,14 +321,25 @@ public class GuiEnchantColour extends GuiScreen { super.handleMouseInput(); int dWheel = Mouse.getEventDWheel(); - - if(dWheel < 0) { - scroll.setTarget(scroll.getTarget()-50); - scroll.resetTimer(); - } else if(dWheel > 0) { - scroll.setTarget(scroll.getTarget()+50); - scroll.resetTimer(); + int mouseX = Mouse.getEventX() * this.width / this.mc.displayWidth; + if(mouseX > guiLeft && mouseX < guiLeft + xSize) { + if (dWheel < 0) { + scroll.setTarget(scroll.getTarget() - 50); + scroll.resetTimer(); + } else if (dWheel > 0) { + scroll.setTarget(scroll.getTarget() + 50); + scroll.resetTimer(); + } + } else if(mouseX > guiLeft+xSize && mouseX < guiLeft + xSize+ 100) { + if (dWheel < 0) { + scrollSideBar.setTarget(scrollSideBar.getTarget() - 50); + scrollSideBar.resetTimer(); + } else if (dWheel > 0) { + scrollSideBar.setTarget(scrollSideBar.getTarget() + 50); + scrollSideBar.resetTimer(); + } } + } public static int getIntModifier(String modifier) { @@ -320,6 +434,93 @@ public class GuiEnchantColour extends GuiScreen { NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.add("[a-zA-Z\\- ]+:>:5:9:0"); } } +// System.out.println("Hit Mouse X: "+mouseX+ " Mouse Y: "+mouseY); +// System.out.println("guileft: "+ (guiLeft+xSize+3)+ " Gui Right: "+ (guiLeft+xSize+3+88)); + if(mouseX > guiLeft+xSize+3 && mouseX< guiLeft+xSize+3+88){ + if(mouseY > guiTopSidebar && mouseY < guiTopSidebar+25){ + +// String result = NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.toString(); +// String base64String = Base64.getEncoder().encodeToString(result.getBytes(StandardCharsets.UTF_8)); + + String base64; + + try { + base64 = (String)Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor); + } catch (HeadlessException | IOException | UnsupportedFlavorException e) { + return; + } + String jsonString; + try { + jsonString = new String(Base64.getDecoder().decode(base64)); + } catch (IllegalArgumentException e){ + return; + + } + JsonArray presetArray; + try{ + presetArray = new JsonParser().parse(jsonString).getAsJsonArray(); + } catch (IllegalStateException | JsonParseException e){ + return; + } + ArrayList presetList = new ArrayList<>(); + + + for (int i = 0; i < presetArray.size(); i++) { + if (presetArray.get(i).isJsonPrimitive()) { + String test = presetArray.get(i).getAsString(); + Matcher matcher = settingPattern.matcher(test); + if(matcher.matches()) { + presetList.add(presetArray.get(i).getAsString()); + } + } + } + if(presetList.size() != 0) { + NotEnoughUpdates.INSTANCE.config.hidden.enchantColours = presetList; + } + + + } else if(mouseY > guiTopSidebar+25 && mouseY < guiTopSidebar+25+25){ + + ArrayList result = NotEnoughUpdates.INSTANCE.config.hidden.enchantColours; + JsonArray jsonArray = new JsonArray(); + + for (int i = 0; i < result.size(); i++) { + jsonArray.add(new JsonPrimitive(result.get(i))); + } + + + String base64String = Base64.getEncoder().encodeToString(jsonArray.toString().getBytes(StandardCharsets.UTF_8)); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(base64String), null); + } + +// for(int sidebarYIndex=0; sidebarYIndex guiTopSidebar+50+25*sidebarYIndex && mouseY < guiTopSidebar+50+25+25*sidebarYIndex) { +// +// if(mouseButton == 0) { +// +// JsonElement element = enchantPresets.get(sidebarYIndex - 2); +// if (element.isJsonObject()) { +// JsonObject object = enchantPresets.get(sidebarYIndex - 2).getAsJsonObject(); +// if (object.has("SETTINGS")) { +// JsonElement settingsElement = object.get("SETTINGS"); +// if (settingsElement.isJsonArray()) { +// JsonArray newEnchantColours = settingsElement.getAsJsonArray(); +// +// ArrayList tempEnchantColours = new ArrayList<>(); +// for (int i = 0; i < newEnchantColours.size(); i++) { +// tempEnchantColours.add(newEnchantColours.get(i).getAsString()); +// } +// NotEnoughUpdates.INSTANCE.config.hidden.enchantColours = tempEnchantColours; +// } +// } +// } +// } +// } +// } + } } public static String getColourOpIndex(List colourOps, int index) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java index 1260dbd2..02f64f82 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiInvButtonEditor.java @@ -1,8 +1,6 @@ package io.github.moulberry.notenoughupdates.miscgui; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; +import com.google.gson.*; import com.google.gson.annotations.Expose; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.GlScissorStack; @@ -25,15 +23,22 @@ import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; +import java.awt.*; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.UnsupportedFlavorException; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.*; +import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.atomic.AtomicInteger; +import static io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour.custom_ench_colour; + public class GuiInvButtonEditor extends GuiScreen { private static final ResourceLocation INVENTORY = new ResourceLocation("minecraft:textures/gui/container/inventory.png"); @@ -284,6 +289,13 @@ public class GuiInvButtonEditor extends GuiScreen { fontRendererObj.drawString("+", x+6, y+5, 0xffcccccc); } } + Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(guiLeft-88-2-22, guiTop+2, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawTexturedRect(guiLeft-88-2-22, guiTop+2+24, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawStringCenteredScaledMaxWidth("Load preset from clipboard", fontRendererObj, guiLeft-44-2-22, guiTop+12, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("Save preset to clipboard", fontRendererObj, guiLeft-44-2-22, guiTop+12+24, false, 86, 4210752); + GlStateManager.color(1, 1, 1, 1); if(presets != null) { Minecraft.getMinecraft().getTextureManager().bindTexture(EDITOR); @@ -557,6 +569,72 @@ public class GuiInvButtonEditor extends GuiScreen { } } + if(mouseX > guiLeft-2-88-22 && mouseX< guiLeft-2-22) { + if (mouseY > guiTop + 2 && mouseY < guiTop + 22) { + +// String result = NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.toString(); +// String base64String = Base64.getEncoder().encodeToString(result.getBytes(StandardCharsets.UTF_8)); + + String base64; + + try { + base64 = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getData(DataFlavor.stringFlavor); + } catch (HeadlessException | IOException | UnsupportedFlavorException e) { + return; + } + String jsonString; + try { + jsonString = new String(Base64.getDecoder().decode(base64)); + } catch (IllegalArgumentException e) { + return; + + } + JsonArray presetArray; + try { + presetArray = new JsonParser().parse(jsonString).getAsJsonArray(); + } catch (IllegalStateException | JsonParseException e) { + return; + } + + + List buttons = new ArrayList<>(); + System.out.println(presetArray.size()); + try { + for (int i = 0; i < presetArray.size(); i++) { + + + JsonElement shittyO = presetArray.get(i); + JsonElement lessShittyO = new JsonParser().parse(shittyO.getAsString()); + if (lessShittyO.isJsonObject()) { + JsonObject o = lessShittyO.getAsJsonObject(); + NEUConfig.InventoryButton button = NotEnoughUpdates.INSTANCE.manager.gson.fromJson(o, NEUConfig.InventoryButton.class); + buttons.add(button); + } + + } + + NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons = buttons; + return; + } catch(JsonParseException | ClassCastException | IllegalStateException e){ + return; + } + + + } else if (mouseY > guiTop + 26 && mouseY < guiTop + 26 + 20) { + + List result = NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons; + JsonArray jsonArray = new JsonArray(); + + for (int i = 0; i < result.size(); i++) { + + jsonArray.add(new JsonPrimitive(NotEnoughUpdates.INSTANCE.manager.gson.toJson(result.get(i), NEUConfig.InventoryButton.class))); + } + String base64String = Base64.getEncoder().encodeToString(jsonArray.toString().getBytes(StandardCharsets.UTF_8)); + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(base64String), null); + return; + } + } + if(editingButton == null) { int index = 0; for(List buttons : presets.values()) { -- cgit From 2a4e05f6bdde3c34c9533cfeaf12479408385d5e Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 14 Aug 2021 08:47:37 +0200 Subject: Add neuec reset button and improve button hitboxes for neuecgui --- .../notenoughupdates/miscgui/GuiEnchantColour.java | 11 +++++++---- .../notenoughupdates/options/NEUConfig.java | 20 ++++++++++++-------- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java index 7a82dc4a..c518afaa 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiEnchantColour.java @@ -7,6 +7,7 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpingInteger; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; +import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -223,8 +224,10 @@ public class GuiEnchantColour extends GuiScreen { GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2+24, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawTexturedRect(guiLeft+xSize+3, guiTopSidebar+2+24*2, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); Utils.drawStringCenteredScaledMaxWidth("Load preset from clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12, false, 86, 4210752); Utils.drawStringCenteredScaledMaxWidth("Save preset to clipboard", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12+24, false, 86, 4210752); + Utils.drawStringCenteredScaledMaxWidth("Reset Config", fontRendererObj, guiLeft+xSize+4+44, guiTopSidebar+12+24*2, false, 86, 4210752); // for (int i = 0; i < enchantPresets.size(); i++) { // @@ -437,7 +440,7 @@ public class GuiEnchantColour extends GuiScreen { // System.out.println("Hit Mouse X: "+mouseX+ " Mouse Y: "+mouseY); // System.out.println("guileft: "+ (guiLeft+xSize+3)+ " Gui Right: "+ (guiLeft+xSize+3+88)); if(mouseX > guiLeft+xSize+3 && mouseX< guiLeft+xSize+3+88){ - if(mouseY > guiTopSidebar && mouseY < guiTopSidebar+25){ + if(mouseY > guiTopSidebar+2 && mouseY < guiTopSidebar+20+2){ // String result = NotEnoughUpdates.INSTANCE.config.hidden.enchantColours.toString(); // String base64String = Base64.getEncoder().encodeToString(result.getBytes(StandardCharsets.UTF_8)); @@ -479,7 +482,7 @@ public class GuiEnchantColour extends GuiScreen { } - } else if(mouseY > guiTopSidebar+25 && mouseY < guiTopSidebar+25+25){ + } else if(mouseY > guiTopSidebar+2+24 && mouseY < guiTopSidebar+20+24+2){ ArrayList result = NotEnoughUpdates.INSTANCE.config.hidden.enchantColours; JsonArray jsonArray = new JsonArray(); @@ -487,10 +490,10 @@ public class GuiEnchantColour extends GuiScreen { for (int i = 0; i < result.size(); i++) { jsonArray.add(new JsonPrimitive(result.get(i))); } - - String base64String = Base64.getEncoder().encodeToString(jsonArray.toString().getBytes(StandardCharsets.UTF_8)); Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(base64String), null); + } else if(mouseY > guiTopSidebar+2+(24*2) && mouseY < guiTopSidebar+20+2+24*2){ + NotEnoughUpdates.INSTANCE.config.hidden.enchantColours = NEUConfig.createDefaultEnchantColours(); } // for(int sidebarYIndex=0; sidebarYIndex previousAuctionSearches = new ArrayList<>(); @Expose public ArrayList eventFavourites = new ArrayList<>(); @Expose public ArrayList quickCommands = createDefaultQuickCommands(); - @Expose public ArrayList enchantColours = Lists.newArrayList( - "[a-zA-Z\\- ]+:\u003e:9:6:0", - "[a-zA-Z\\- ]+:\u003e:6:c:0", - "[a-zA-Z\\- ]+:\u003e:5:5:0", - "Experience:\u003e:3:5:0", - "Life Steal:\u003e:3:5:0", - "Scavenger:\u003e:3:5:0", - "Looting:\u003e:3:5:0"); + @Expose public ArrayList enchantColours = createDefaultEnchantColours(); @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"; @@ -297,6 +290,17 @@ public class NEUConfig extends Config { } + public static ArrayList createDefaultEnchantColours(){ + return Lists.newArrayList( + "[a-zA-Z\\- ]+:\u003e:9:6:0", + "[a-zA-Z\\- ]+:\u003e:6:c:0", + "[a-zA-Z\\- ]+:\u003e:5:5:0", + "Experience:\u003e:3:5:0", + "Life Steal:\u003e:3:5:0", + "Scavenger:\u003e:3:5:0", + "Looting:\u003e:3:5:0"); + } + private static ArrayList createDefaultQuickCommands() { ArrayList arr = new ArrayList<>(); arr.add("/warp home:Warp Home:eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYzljODg4MWU0MjkxNWE5ZDI5YmI2MWExNmZiMjZkMDU5OTEzMjA0ZDI2NWRmNWI0MzliM2Q3OTJhY2Q1NiJ9fX0="); -- cgit From cd83375fced4440c556efcae6ae9aea50badbb07 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 14 Aug 2021 08:54:02 +0200 Subject: Update change log --- Update Notes/2.0-Pre31.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 33480a87..21f89fef 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -20,6 +20,11 @@ - Added explenation to search highlight feature. - Added fast render warning to storage gui. - Added info about how to get neu capes to the cosmetics gui. +- Redid bonemerang overlay - Moveable and a bit more info. +- Added /neuhelp (neu command list with bit of explenation) +- Added toggle to prismapump overlay. +- Added load from/copy to clipboard and reset config buttons to neuec gui. +- Added load from/copy to clipboard to neu inventory buttons gui. ### **Bug Fixes** - Fishing helper not showing "!" when rod colours are disabled. @@ -40,6 +45,9 @@ - Maybe fixed neu's slotlocking in dungeons. (limited testing) - Fixed Key's being "autoclicked" when bound to a keyboard key. - Fixed being able to drop slotlocked items by quickly swapping slots and spamming/holding Q. +- Fixed not being able to use keybinds while hovering over locked slots. +- Fixed dungeon map appearing in boss room while holding bow (will be gone after switching from bow to another item). +- Fixed dwarven mines waypoints not working if dwarven mines overlay was disabled. ### **Other** @@ -55,4 +63,7 @@ - Reformatted Total Slayer XP number. - Added Master Mode buttons to NEUButtons dungeon preset. (jani270) - Added Moul's twitch link to /neulinks. (GET THEM PRIMES) +- Disabled middle click search when searchbar is disabled. +- Disabled tutorial command. +- Disabled gamemodes command. -- cgit From 48d460882e72bb075c20491d89c09b04d23c8043 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 14 Aug 2021 10:10:49 +0200 Subject: Change first time message to open /neuhelp instead of tutorial --- .../java/io/github/moulberry/notenoughupdates/NEUEventListener.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index d5d89dd7..fd6253a7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -374,8 +374,8 @@ public class NEUEventListener { Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( EnumChatFormatting.BLUE+"It seems this is your first time using NotEnoughUpdates.")); ChatComponentText clickText = new ChatComponentText( - EnumChatFormatting.YELLOW+"Click this message if you would like to view a short tutorial."); - clickText.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/neututorial")); + EnumChatFormatting.YELLOW+"Click this message if you would like to view a list of NotEnoughUpdate's commands."); + clickText.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/neuhelp")); Minecraft.getMinecraft().thePlayer.addChatMessage(clickText); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); } -- cgit From 537b92239998a4fbddae8f89cc8d71a2933dac72 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 14 Aug 2021 19:11:42 +0200 Subject: Disable neu gamemodes further --- .../java/io/github/moulberry/notenoughupdates/NEUEventListener.java | 2 +- .../java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index fd6253a7..4603b4c1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -346,7 +346,7 @@ public class NEUEventListener { if(!joinedSB) { joinedSB = true; - SBGamemodes.loadFromFile(); + //SBGamemodes.loadFromFile(); if(NotEnoughUpdates.INSTANCE.config.notifications.showUpdateMsg) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index bdb94a41..b699afa5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -1206,7 +1206,7 @@ public class NotEnoughUpdates { MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new NEUEventListener(this)); MinecraftForge.EVENT_BUS.register(CapeManager.getInstance()); - MinecraftForge.EVENT_BUS.register(new SBGamemodes()); + //MinecraftForge.EVENT_BUS.register(new SBGamemodes()); MinecraftForge.EVENT_BUS.register(new EnchantingSolvers()); MinecraftForge.EVENT_BUS.register(new CalendarOverlay()); MinecraftForge.EVENT_BUS.register(SBInfo.getInstance()); -- cgit From fb08aa9689264222eeda0c0196d0554ff543ab4b Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 14 Aug 2021 22:02:59 +0200 Subject: Fixed being able to slot lock the 9th slot also change log --- Update Notes/2.0-Pre31.md | 1 + .../io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java | 1 + 2 files changed, 2 insertions(+) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 21f89fef..02da8b18 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -48,6 +48,7 @@ - Fixed not being able to use keybinds while hovering over locked slots. - Fixed dungeon map appearing in boss room while holding bow (will be gone after switching from bow to another item). - Fixed dwarven mines waypoints not working if dwarven mines overlay was disabled. +- Fixed being able to slot lock the 9th slot. ### **Other** diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index cd128ebe..11351857 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -310,6 +310,7 @@ public class SlotLocking { } public void toggleLock(int lockIndex) { + if(lockIndex == 8) return; LockedSlot[] lockedSlots = getDataForProfile(); if(lockedSlots != null) { -- cgit From dfa28718b54de915bb823eea54313b40842c1ce9 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 15 Aug 2021 15:57:42 +0200 Subject: Add Sba chroma support to neuec --- .../notenoughupdates/NEUEventListener.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 4603b4c1..0933c1a7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -51,6 +51,7 @@ import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.*; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.world.WorldEvent; +import net.minecraftforge.fml.common.Loader; import net.minecraftforge.fml.common.eventhandler.EventPriority; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -1675,6 +1676,19 @@ public class NEUEventListener { private boolean copied = false; + //just to try and optimize it a bit + private int sbaloaded = -1; + private boolean isSbaloaded(){ + if(sbaloaded == -1){ + if(Loader.isModLoaded("skyblockaddons")) { + sbaloaded = 1; + } else { + sbaloaded = 0; + } + } + return sbaloaded == 1; + } + @SubscribeEvent(priority = EventPriority.LOW) public void onItemTooltipLow(ItemTooltipEvent event) { if(!NotEnoughUpdates.INSTANCE.isOnSkyblock()) return; @@ -1952,7 +1966,12 @@ public class NEUEventListener { } catch(Exception e) { continue; } if(comparatorI < 0) continue; - if("0123456789abcdefz".indexOf(colourCode.charAt(0)) < 0) continue; + String regexText = "0123456789abcdefz"; + if(isSbaloaded()) { + regexText = regexText + "Z"; + } + + if (regexText.indexOf(colourCode.charAt(0)) < 0) continue; //item_lore = item_lore.replaceAll("\\u00A79("+lvl4Max+" IV)", EnumChatFormatting.DARK_PURPLE+"$1"); //9([a-zA-Z ]+?) ([0-9]+|(I|II|III|IV|V|VI|VII|VIII|IX|X))(,|$) -- cgit From 990d5523721f1b2c6206ac4cff30fe56987faa0f Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 16 Aug 2021 15:11:39 +0200 Subject: Fix Neubuttons and accessory bag icon overlap also update the change log --- Update Notes/2.0-Pre31.md | 3 +++ .../moulberry/notenoughupdates/NEUEventListener.java | 15 +++++++++++++++ .../notenoughupdates/miscgui/AccessoryBagOverlay.java | 8 +++++++- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 02da8b18..bba18209 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -25,6 +25,7 @@ - Added toggle to prismapump overlay. - Added load from/copy to clipboard and reset config buttons to neuec gui. - Added load from/copy to clipboard to neu inventory buttons gui. +- Added SBA chroma support to neuec. ### **Bug Fixes** - Fishing helper not showing "!" when rod colours are disabled. @@ -49,6 +50,7 @@ - Fixed dungeon map appearing in boss room while holding bow (will be gone after switching from bow to another item). - Fixed dwarven mines waypoints not working if dwarven mines overlay was disabled. - Fixed being able to slot lock the 9th slot. +- Fixed NEUButtons overlapping with the Accessory Bag overlay by moving the overlapping icons to the right of the overlay. (should work pretty well, too lazy to test with custom button positions but should work fine.) ### **Other** @@ -67,4 +69,5 @@ - Disabled middle click search when searchbar is disabled. - Disabled tutorial command. - Disabled gamemodes command. +- Changed first time message to open /neuhelp instead of tutorial. diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 0933c1a7..6ebcc04f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1003,6 +1003,11 @@ public class NEUEventListener { if(button.anchorBottom) { y += ySize; } + if(AccessoryBagOverlay.isInAccessoryBag()){ + if(x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28+ 5 && y > guiTop-18 && y < guiTop + 150){ + x += 80+28; + } + } GlStateManager.color(1, 1, 1, 1f); @@ -1105,6 +1110,11 @@ public class NEUEventListener { if(button.anchorBottom) { y += ySize; } + if(AccessoryBagOverlay.isInAccessoryBag()){ + if(x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28+ 5 && y > guiTop-18 && y < guiTop + 150){ + x += 80+28; + } + } if(x-guiLeft >= 85 && x-guiLeft <= 115 && y-guiTop >= 4 && y-guiTop <= 25) { disableCraftingText = true; @@ -1430,6 +1440,11 @@ public class NEUEventListener { if(button.anchorBottom) { y += ySize; } + if(AccessoryBagOverlay.isInAccessoryBag()){ + if(x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28+ 5 && y > guiTop-18 && y < guiTop + 150){ + x += 80+28; + } + } if(mouseX >= x && mouseX <= x+18 && mouseY >= y && mouseY <= y+18) { if(Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java index b2d301a6..728d4478 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java @@ -582,13 +582,19 @@ public class AccessoryBagOverlay { return o1.compareTo(o2); }; } + private static boolean inAccessoryBag = false; + public static boolean isInAccessoryBag(){ + return inAccessoryBag; + } - public static void renderOverlay() { + public static void renderOverlay() { + inAccessoryBag = false; if(Minecraft.getMinecraft().currentScreen instanceof GuiChest && NEUEventListener.inventoryLoaded) { GuiChest eventGui = (GuiChest) Minecraft.getMinecraft().currentScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; String containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); if(containerName.trim().startsWith("Accessory Bag")) { + inAccessoryBag = true; try { int xSize = (int) Utils.getField(GuiContainer.class, eventGui, "xSize", "field_146999_f"); int ySize = (int) Utils.getField(GuiContainer.class, eventGui, "ySize", "field_147000_g"); -- cgit From 233cd3eb7392cb3ed2a7b31c36967e8a187bc024 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Mon, 16 Aug 2021 21:49:23 +0200 Subject: Crafting overlay --- .../notenoughupdates/NEUEventListener.java | 10 ++- .../moulberry/notenoughupdates/NEUManager.java | 33 +++++---- .../notenoughupdates/overlays/CraftingOverlay.java | 86 ++++++++++++++++++++++ 3 files changed, 112 insertions(+), 17 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 6ebcc04f..d661c290 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -19,10 +19,7 @@ import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes; import io.github.moulberry.notenoughupdates.miscfeatures.*; import io.github.moulberry.notenoughupdates.miscgui.*; import io.github.moulberry.notenoughupdates.options.NEUConfig; -import io.github.moulberry.notenoughupdates.overlays.AuctionSearchOverlay; -import io.github.moulberry.notenoughupdates.overlays.OverlayManager; -import io.github.moulberry.notenoughupdates.overlays.RancherBootOverlay; -import io.github.moulberry.notenoughupdates.overlays.TextOverlay; +import io.github.moulberry.notenoughupdates.overlays.*; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import io.github.moulberry.notenoughupdates.util.*; import net.minecraft.client.Minecraft; @@ -570,6 +567,8 @@ public class NEUEventListener { AtomicBoolean missingRecipe = new AtomicBoolean(false); @SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { + CraftingOverlay.shouldRender = false; + if((Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper || Minecraft.getMinecraft().currentScreen instanceof GuiItemRecipe) && event.gui == null && !(Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) && @@ -1060,6 +1059,9 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if (containerName.equals("Craft Item")) { + CraftingOverlay.render(); + } } if(GuiCustomEnchant.getInstance().shouldOverride(containerName)) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 967ef903..74c8b2d3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -4,6 +4,7 @@ import com.google.common.collect.Lists; import com.google.gson.*; import io.github.moulberry.notenoughupdates.auction.APIManager; import io.github.moulberry.notenoughupdates.miscgui.GuiItemRecipe; +import io.github.moulberry.notenoughupdates.overlays.CraftingOverlay; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.HypixelApi; import io.github.moulberry.notenoughupdates.util.SBInfo; @@ -12,6 +13,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.inventory.ContainerChest; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.*; @@ -35,10 +37,10 @@ import java.util.zip.ZipInputStream; public class NEUManager { private final NotEnoughUpdates neu; - public final Gson gson; + public static Gson gson; public final APIManager auctionManager; - private TreeMap itemMap = new TreeMap<>(); + private static TreeMap itemMap = new TreeMap<>(); private TreeMap>> titleWordMap = new TreeMap<>(); private TreeMap>> loreWordMap = new TreeMap<>(); @@ -60,7 +62,7 @@ public class NEUManager { private String currentProfileBackup = ""; public final HypixelApi hypixelApi = new HypixelApi(); - private Map itemstackCache = new HashMap<>(); + private static Map itemstackCache = new HashMap<>(); private ExecutorService repoLoaderES = Executors.newSingleThreadExecutor(); @@ -797,7 +799,12 @@ public class NEUManager { } public void showRecipe(JsonObject item) { - if(item.has("useneucraft") && item.get("useneucraft").getAsBoolean()) { + if (item.has("recipe") && Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerChest) { + ContainerChest container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; + if (container.getLowerChestInventory().getDisplayName().getUnformattedText().equals("Craft Item")) { + CraftingOverlay.updateItem(item); + } + } else if(item.has("useneucraft") && item.get("useneucraft").getAsBoolean()) { displayGuiItemRecipe(item.get("internalname").getAsString(), ""); } else if(item.has("clickcommand")) { String clickcommand = item.get("clickcommand").getAsString(); @@ -1181,11 +1188,11 @@ public class NEUManager { writeJson(json, file); } - public TreeMap getItemInformation() { + public static TreeMap getItemInformation() { return itemMap; } - public String removeUnusedDecimal(double num) { + public static String removeUnusedDecimal(double num) { if(num % 1 == 0) { return String.valueOf((int)num); } else { @@ -1193,7 +1200,7 @@ public class NEUManager { } } - public HashMap getLoreReplacements(String petname, String tier, int level) { + public static HashMap getLoreReplacements(String petname, String tier, int level) { JsonObject petnums = null; if(petname != null && tier != null) { petnums = Constants.PETNUMS; @@ -1257,7 +1264,7 @@ public class NEUManager { return replacements; } - public HashMap getLoreReplacements(NBTTagCompound tag, int level) { + public static HashMap getLoreReplacements(NBTTagCompound tag, int level) { String petname = null; String tier = null; if(tag != null && tag.hasKey("ExtraAttributes")) { @@ -1289,7 +1296,7 @@ public class NEUManager { return getLoreReplacements(petname, tier, level); } - public NBTTagList processLore(JsonArray lore, HashMap replacements) { + public static NBTTagList processLore(JsonArray lore, HashMap replacements) { NBTTagList nbtLore = new NBTTagList(); for(JsonElement line : lore) { String lineStr = line.getAsString(); @@ -1304,19 +1311,19 @@ public class NEUManager { return nbtLore; } - public ItemStack jsonToStack(JsonObject json) { + public static ItemStack jsonToStack(JsonObject json) { return jsonToStack(json, true); } - public ItemStack jsonToStack(JsonObject json, boolean useCache) { + public static ItemStack jsonToStack(JsonObject json, boolean useCache) { return jsonToStack(json, useCache, true); } - public ItemStack jsonToStack(JsonObject json, boolean useCache, boolean useReplacements) { + public static ItemStack jsonToStack(JsonObject json, boolean useCache, boolean useReplacements) { return jsonToStack(json, useCache, useReplacements, true); } - public ItemStack jsonToStack(JsonObject json, boolean useCache, boolean useReplacements, boolean copyStack) { + public static ItemStack jsonToStack(JsonObject json, boolean useCache, boolean useReplacements, boolean copyStack) { if(json == null) return new ItemStack(Items.painting, 1, 10); String internalname = json.get("internalname").getAsString(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java new file mode 100644 index 00000000..50fa9848 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java @@ -0,0 +1,86 @@ +package io.github.moulberry.notenoughupdates.overlays; + +import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.NEUManager; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.inventory.GuiChest; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.inventory.ContainerChest; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import org.luaj.vm2.ast.Str; +import org.lwjgl.input.Mouse; + +import java.util.List; + +public class CraftingOverlay { + private static ItemStack[] items = new ItemStack[9]; + public static boolean shouldRender = false; + private static String text = null; + + public static void render() { + if (shouldRender) { + ContainerChest container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; + GuiChest gc = (GuiChest) Minecraft.getMinecraft().currentScreen; + FontRenderer ft = Minecraft.getMinecraft().fontRendererObj; + int width = Utils.peekGuiScale().getScaledWidth(); + int height = Utils.peekGuiScale().getScaledHeight(); + int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; + int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; + List tooltip = null; + for (int i = 0; i < 9; i++) { + if (items[i] != null) { + int slotIndex = (int) (10 + 9 * Math.floor(i / 3f) + (i % 3)); + Slot slot = container.inventorySlots.get(slotIndex); + int x = slot.xDisplayPosition + gc.guiLeft; + int y = slot.yDisplayPosition + gc.guiTop; + if (!slot.getHasStack() || !slot.getStack().getDisplayName().equals(items[i].getDisplayName()) || + slot.getStack().stackSize < items[i].stackSize) + Gui.drawRect(x, y, + x + 16, y + 16, 0x64ff0000); + if (!slot.getHasStack()) + Utils.drawItemStack(items[i], x, y); + if (mouseX >= x && mouseX < x + 16 && mouseY >= y && mouseY < y + 16) + tooltip = items[i].getTooltip(Minecraft.getMinecraft().thePlayer, false); + } + } + if (text != null) + ft.drawStringWithShadow(text, + Utils.peekGuiScale().getScaledWidth() / 2f - ft.getStringWidth(text) / 2f, + gc.guiTop - 15f, 0x808080); + if (tooltip != null) + Utils.drawHoveringText(tooltip, mouseX, mouseY, width, height, -1, ft); + } + } + + public static void updateItem(JsonObject item) { + items = new ItemStack[9]; + String[] x = {"1", "2", "3"}; + String[] y = {"A", "B", "C"}; + for (int i = 0; i < 9; i++) { + String name = y[i / 3] + x[i % 3]; + String itemS = item.getAsJsonObject("recipe").get(name).getAsString(); + if (itemS != null && !itemS.equals("")) { + int count = 1; + if (itemS.split(":").length == 2) { + count = Integer.parseInt(itemS.split(":")[1]); + itemS = itemS.split(":")[0]; + } + JsonObject craft = NEUManager.getItemInformation().get(itemS); + if (craft != null) { + ItemStack stack = NEUManager.jsonToStack(craft); + stack.stackSize = count; + items[i] = stack; + } + } + } + if (item.has("crafttext")) { + text = item.get("crafttext").getAsString(); + } + shouldRender = true; + } +} -- cgit From 7cdef907c08e2378d97428945bcd0075e6c89347 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 16 Aug 2021 22:05:50 +0200 Subject: Add sba chroma info to neurename --- .../io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java index 21d1018d..07f1340d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java @@ -215,6 +215,7 @@ public class GuiItemCustomize extends GuiScreen { EnumChatFormatting.LIGHT_PURPLE+"\u00B6d = Purple", EnumChatFormatting.YELLOW+"\u00B6e = Yellow", EnumChatFormatting.WHITE+"\u00B6f = White", + "\u00A7Z\u00B6Z = SBA Chroma"+EnumChatFormatting.RESET+EnumChatFormatting.GRAY+" (Requires SBA)", "", EnumChatFormatting.GREEN+"Available formatting codes:", EnumChatFormatting.GRAY+"\u00B6k = "+EnumChatFormatting.OBFUSCATED+"Obfuscated", -- cgit From 63ae2fa539ff608f07350fad7235234ef26828a8 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 16 Aug 2021 22:13:37 +0200 Subject: Fix slotlocking a bit more --- .../moulberry/notenoughupdates/miscfeatures/SlotLocking.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index 11351857..7f981092 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -99,10 +99,11 @@ public class SlotLocking { public void changedSlot(int slotNumber){ int pingModifier = NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockSwapDelay; if(pingModifier == 0){ return; }; + if(!isSlotIndexLocked(slotNumber)){ return;} long currentTimeMilis = System.currentTimeMillis(); for (int i = 0; i < slotChanges.length; i++) { - if(i != slotNumber && slotChanges[i] != 0 && slotChanges[i] < (currentTimeMilis+pingModifier)){ + if(i != slotNumber && slotChanges[i] != 0 && (slotChanges[i] + (long) pingModifier) > currentTimeMilis){ slotChanges[i] = 0; } } @@ -115,10 +116,8 @@ public class SlotLocking { long currentTimeMilis = System.currentTimeMillis(); for (int i = 0; i < slotChanges.length; i++) { - if(slotChanges[i] != 0 && slotChanges[i] < (currentTimeMilis+pingModifier)){ - if(isSlotIndexLocked(i)){ - return true; - } + if (slotChanges[i] != 0 && isSlotIndexLocked(i) && (slotChanges[i] + (long) pingModifier) > currentTimeMilis) { + return true; } } return false; -- cgit From 00d03d913dcfbc73e839bf61981ff9926c9f46ce Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Mon, 16 Aug 2021 22:38:54 +0200 Subject: now use internalname to check + code cleanup --- .../notenoughupdates/NEUEventListener.java | 10 ++++---- .../moulberry/notenoughupdates/NEUManager.java | 28 ++++++++++++---------- .../notenoughupdates/overlays/CraftingOverlay.java | 24 ++++++++++--------- 3 files changed, 34 insertions(+), 28 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index d661c290..610d6931 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -15,11 +15,13 @@ import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; import io.github.moulberry.notenoughupdates.dungeons.DungeonBlocks; import io.github.moulberry.notenoughupdates.dungeons.DungeonWin; -import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes; import io.github.moulberry.notenoughupdates.miscfeatures.*; import io.github.moulberry.notenoughupdates.miscgui.*; import io.github.moulberry.notenoughupdates.options.NEUConfig; -import io.github.moulberry.notenoughupdates.overlays.*; +import io.github.moulberry.notenoughupdates.overlays.AuctionSearchOverlay; +import io.github.moulberry.notenoughupdates.overlays.OverlayManager; +import io.github.moulberry.notenoughupdates.overlays.RancherBootOverlay; +import io.github.moulberry.notenoughupdates.overlays.TextOverlay; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import io.github.moulberry.notenoughupdates.util.*; import net.minecraft.client.Minecraft; @@ -567,7 +569,7 @@ public class NEUEventListener { AtomicBoolean missingRecipe = new AtomicBoolean(false); @SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { - CraftingOverlay.shouldRender = false; + neu.manager.craftingOverlay.shouldRender = false; if((Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper || Minecraft.getMinecraft().currentScreen instanceof GuiItemRecipe) && @@ -1060,7 +1062,7 @@ public class NEUEventListener { ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); if (containerName.equals("Craft Item")) { - CraftingOverlay.render(); + neu.manager.craftingOverlay.render(); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 74c8b2d3..aff030d8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -37,10 +37,10 @@ import java.util.zip.ZipInputStream; public class NEUManager { private final NotEnoughUpdates neu; - public static Gson gson; + public final Gson gson; public final APIManager auctionManager; - private static TreeMap itemMap = new TreeMap<>(); + private TreeMap itemMap = new TreeMap<>(); private TreeMap>> titleWordMap = new TreeMap<>(); private TreeMap>> loreWordMap = new TreeMap<>(); @@ -62,7 +62,7 @@ public class NEUManager { private String currentProfileBackup = ""; public final HypixelApi hypixelApi = new HypixelApi(); - private static Map itemstackCache = new HashMap<>(); + private Map itemstackCache = new HashMap<>(); private ExecutorService repoLoaderES = Executors.newSingleThreadExecutor(); @@ -76,6 +76,8 @@ public class NEUManager { public File repoLocation; public File configFile; + public CraftingOverlay craftingOverlay = new CraftingOverlay(this); + public NEUManager(NotEnoughUpdates neu, File configLocation) { this.neu = neu; this.configLocation = configLocation; @@ -802,7 +804,7 @@ public class NEUManager { if (item.has("recipe") && Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerChest) { ContainerChest container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; if (container.getLowerChestInventory().getDisplayName().getUnformattedText().equals("Craft Item")) { - CraftingOverlay.updateItem(item); + craftingOverlay.updateItem(item); } } else if(item.has("useneucraft") && item.get("useneucraft").getAsBoolean()) { displayGuiItemRecipe(item.get("internalname").getAsString(), ""); @@ -1188,11 +1190,11 @@ public class NEUManager { writeJson(json, file); } - public static TreeMap getItemInformation() { + public TreeMap getItemInformation() { return itemMap; } - public static String removeUnusedDecimal(double num) { + public String removeUnusedDecimal(double num) { if(num % 1 == 0) { return String.valueOf((int)num); } else { @@ -1200,7 +1202,7 @@ public class NEUManager { } } - public static HashMap getLoreReplacements(String petname, String tier, int level) { + public HashMap getLoreReplacements(String petname, String tier, int level) { JsonObject petnums = null; if(petname != null && tier != null) { petnums = Constants.PETNUMS; @@ -1264,7 +1266,7 @@ public class NEUManager { return replacements; } - public static HashMap getLoreReplacements(NBTTagCompound tag, int level) { + public HashMap getLoreReplacements(NBTTagCompound tag, int level) { String petname = null; String tier = null; if(tag != null && tag.hasKey("ExtraAttributes")) { @@ -1296,7 +1298,7 @@ public class NEUManager { return getLoreReplacements(petname, tier, level); } - public static NBTTagList processLore(JsonArray lore, HashMap replacements) { + public NBTTagList processLore(JsonArray lore, HashMap replacements) { NBTTagList nbtLore = new NBTTagList(); for(JsonElement line : lore) { String lineStr = line.getAsString(); @@ -1311,19 +1313,19 @@ public class NEUManager { return nbtLore; } - public static ItemStack jsonToStack(JsonObject json) { + public ItemStack jsonToStack(JsonObject json) { return jsonToStack(json, true); } - public static ItemStack jsonToStack(JsonObject json, boolean useCache) { + public ItemStack jsonToStack(JsonObject json, boolean useCache) { return jsonToStack(json, useCache, true); } - public static ItemStack jsonToStack(JsonObject json, boolean useCache, boolean useReplacements) { + public ItemStack jsonToStack(JsonObject json, boolean useCache, boolean useReplacements) { return jsonToStack(json, useCache, useReplacements, true); } - public static ItemStack jsonToStack(JsonObject json, boolean useCache, boolean useReplacements, boolean copyStack) { + public ItemStack jsonToStack(JsonObject json, boolean useCache, boolean useReplacements, boolean copyStack) { if(json == null) return new ItemStack(Items.painting, 1, 10); String internalname = json.get("internalname").getAsString(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java index 50fa9848..ecc88ccc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java @@ -6,23 +6,25 @@ import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiChest; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import org.luaj.vm2.ast.Str; import org.lwjgl.input.Mouse; import java.util.List; public class CraftingOverlay { - private static ItemStack[] items = new ItemStack[9]; - public static boolean shouldRender = false; - private static String text = null; + private ItemStack[] items = new ItemStack[9]; + private final NEUManager manager; + public boolean shouldRender = false; + private String text = null; - public static void render() { + public CraftingOverlay(NEUManager manager) { + this.manager = manager; + } + + public void render() { if (shouldRender) { ContainerChest container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; GuiChest gc = (GuiChest) Minecraft.getMinecraft().currentScreen; @@ -38,7 +40,7 @@ public class CraftingOverlay { Slot slot = container.inventorySlots.get(slotIndex); int x = slot.xDisplayPosition + gc.guiLeft; int y = slot.yDisplayPosition + gc.guiTop; - if (!slot.getHasStack() || !slot.getStack().getDisplayName().equals(items[i].getDisplayName()) || + if (!slot.getHasStack() || !manager.getInternalNameForItem(items[i]).equals(manager.getInternalNameForItem(slot.getStack())) || slot.getStack().stackSize < items[i].stackSize) Gui.drawRect(x, y, x + 16, y + 16, 0x64ff0000); @@ -57,7 +59,7 @@ public class CraftingOverlay { } } - public static void updateItem(JsonObject item) { + public void updateItem(JsonObject item) { items = new ItemStack[9]; String[] x = {"1", "2", "3"}; String[] y = {"A", "B", "C"}; @@ -70,9 +72,9 @@ public class CraftingOverlay { count = Integer.parseInt(itemS.split(":")[1]); itemS = itemS.split(":")[0]; } - JsonObject craft = NEUManager.getItemInformation().get(itemS); + JsonObject craft = manager.getItemInformation().get(itemS); if (craft != null) { - ItemStack stack = NEUManager.jsonToStack(craft); + ItemStack stack = manager.jsonToStack(craft); stack.stackSize = count; items[i] = stack; } -- cgit From c14ea38372c30d40820a7bcb7c8f56d407d7022f Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Mon, 16 Aug 2021 22:50:00 +0200 Subject: fix double tooltips --- .../github/moulberry/notenoughupdates/overlays/CraftingOverlay.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java index ecc88ccc..8640fd0e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java @@ -42,11 +42,10 @@ public class CraftingOverlay { int y = slot.yDisplayPosition + gc.guiTop; if (!slot.getHasStack() || !manager.getInternalNameForItem(items[i]).equals(manager.getInternalNameForItem(slot.getStack())) || slot.getStack().stackSize < items[i].stackSize) - Gui.drawRect(x, y, - x + 16, y + 16, 0x64ff0000); + Gui.drawRect(x, y, x + 16, y + 16, 0x64ff0000); if (!slot.getHasStack()) Utils.drawItemStack(items[i], x, y); - if (mouseX >= x && mouseX < x + 16 && mouseY >= y && mouseY < y + 16) + if (!slot.getHasStack() && mouseX >= x && mouseX < x + 16 && mouseY >= y && mouseY < y + 16) tooltip = items[i].getTooltip(Minecraft.getMinecraft().thePlayer, false); } } -- cgit From 46df5e8f55ae1147bae9ecba3447605729b3d9f4 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Mon, 16 Aug 2021 23:06:46 +0200 Subject: I better stop finding bugs I wanna sleep --- .../io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java index 8640fd0e..9b555dfd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java @@ -60,6 +60,7 @@ public class CraftingOverlay { public void updateItem(JsonObject item) { items = new ItemStack[9]; + text = null; String[] x = {"1", "2", "3"}; String[] y = {"A", "B", "C"}; for (int i = 0; i < 9; i++) { -- cgit From fc5a51e96fd1702fecbd152d9193703a3e567d1d Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 17 Aug 2021 20:23:32 +0200 Subject: Update changelog --- Update Notes/2.0-Pre31.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index bba18209..3748e380 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -26,6 +26,7 @@ - Added load from/copy to clipboard and reset config buttons to neuec gui. - Added load from/copy to clipboard to neu inventory buttons gui. - Added SBA chroma support to neuec. +- Added a crafting recipe overlay when looking up a recipe while in the crafting menu (to more easily craft items like the Soul Esoward recipe) (DeDiamondPro) ### **Bug Fixes** - Fishing helper not showing "!" when rod colours are disabled. -- cgit From 3c304b3c3fea6c34598728640ddb6740283658e9 Mon Sep 17 00:00:00 2001 From: DoKM <54663875+DoKM@users.noreply.github.com> Date: Tue, 17 Aug 2021 21:35:45 +0200 Subject: Fix wrong master_catacombs floor in preset --- src/main/resources/assets/notenoughupdates/invbuttons/presets.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/assets/notenoughupdates/invbuttons/presets.json b/src/main/resources/assets/notenoughupdates/invbuttons/presets.json index b6d56e90..4184e6d4 100644 --- a/src/main/resources/assets/notenoughupdates/invbuttons/presets.json +++ b/src/main/resources/assets/notenoughupdates/invbuttons/presets.json @@ -2529,7 +2529,7 @@ "anchorRight": false, "anchorBottom": false, "backgroundIndex": 0, - "command": "joindungeon master_catacombs 1", + "command": "joindungeon master_catacombs 3", "icon": "DIAMOND_PROFESSOR_HEAD" }, { @@ -2732,4 +2732,4 @@ "command": "" } ] -} \ No newline at end of file +} -- cgit From cbdbc5f2901d7bb7eeb568cdf530ccf4a64e2f0b Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 18 Aug 2021 16:19:31 +0200 Subject: Fix a duplicate value exception in capemanger slow update Somehow there can be two exact players in the theworld.playerEntities https://hst.sh/enuvamecef --- .../io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 583e3715..75a63644 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/cosmetics/CapeManager.java @@ -312,7 +312,9 @@ public class CapeManager { playerMap.clear(); for(EntityPlayer player : Minecraft.getMinecraft().theWorld.playerEntities) { String uuid = player.getUniqueID().toString().replace("-", ""); - playerMap.put(uuid, player); + try { + playerMap.put(uuid, player); + } catch(IllegalArgumentException ignored){} } } -- cgit From bb9ff71de7f7db3e45e47a6b79a9e4419e0bc630 Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 18 Aug 2021 17:47:52 +0200 Subject: Do not display rawcraftcost if its at 0 --- .../java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java index 1bca2a84..83c4b7ae 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/ItemPriceInformation.java @@ -105,6 +105,7 @@ public class ItemPriceInformation { break; case 4: if(craftCost.fromRecipe) { + if((int)craftCost.craftCost == 0){ continue;} if(!added) { tooltip.add(""); added = true; @@ -172,6 +173,7 @@ public class ItemPriceInformation { break; case 3: if(craftCost.fromRecipe) { + if((int)craftCost.craftCost == 0){ continue;} if(!added) { tooltip.add(""); added = true; -- cgit From cb4d7f49fdb6d244b19b7f991a5ef606012ae1a5 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Wed, 18 Aug 2021 20:12:41 +0200 Subject: thing --- .../notenoughupdates/NEUEventListener.java | 9 ++ .../core/util/render/RenderUtils.java | 85 ++++++++++++++ .../miscfeatures/CrystalMetalDetectorSolver.java | 128 +++++++++++++++++++++ .../miscfeatures/DwarvenMinesWaypoints.java | 88 +------------- 4 files changed, 228 insertions(+), 82 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 610d6931..882dd965 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -787,6 +787,7 @@ public class NEUEventListener { @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) public void onGuiChat(ClientChatReceivedEvent e) { if(e.type == 2) { + CrystalMetalDetectorSolver.process(e.message); e.message = processChatComponent(e.message); return; } @@ -834,6 +835,9 @@ public class NEUEventListener { e.message = new ChatComponentText(m2); } } + if (unformatted.startsWith("You found ") && SBInfo.getInstance().getLocation().equals("crystal_hollows")){ + CrystalMetalDetectorSolver.reset(); + } } public static boolean drawingGuiScreen = false; @@ -2446,4 +2450,9 @@ public class NEUEventListener { } } } + + @SubscribeEvent + public void onRenderLast(RenderWorldLastEvent event){ + CrystalMetalDetectorSolver.render(event.partialTicks); + } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java index a43eb0e6..b63831ac 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/core/util/render/RenderUtils.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.core.util.render; import io.github.moulberry.notenoughupdates.core.BackgroundBlur; import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.renderer.GlStateManager; @@ -9,8 +10,12 @@ import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumChatFormatting; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL14; +import org.lwjgl.util.vector.Vector3f; public class RenderUtils { @@ -141,4 +146,84 @@ public class RenderUtils { GlStateManager.enableTexture2D(); } + public static void renderWayPoint(String str, BlockPos loc, float partialTicks) { + renderWayPoint(str, new Vector3f(loc.getX(), loc.getY(), loc.getZ()), partialTicks); + } + public static void renderWayPoint(String str, Vector3f loc, float partialTicks) { + GlStateManager.alphaFunc(516, 0.1F); + + GlStateManager.pushMatrix(); + + Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); + double viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks; + double viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks; + double viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks; + + double x = loc.x-viewerX+0.5f; + double y = loc.y-viewerY-viewer.getEyeHeight(); + double z = loc.z-viewerZ+0.5f; + + double distSq = x*x + y*y + z*z; + double dist = Math.sqrt(distSq); + if(distSq > 144) { + x *= 12/dist; + y *= 12/dist; + z *= 12/dist; + } + GlStateManager.translate(x, y, z); + GlStateManager.translate(0, viewer.getEyeHeight(), 0); + + renderNametag(str); + + GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.translate(0, -0.25f, 0); + GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + + renderNametag(EnumChatFormatting.YELLOW.toString()+Math.round(dist)+"m"); + + GlStateManager.popMatrix(); + + GlStateManager.disableLighting(); + } + + public static void renderNametag(String str) { + FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj; + float f = 1.6F; + float f1 = 0.016666668F * f; + GlStateManager.pushMatrix(); + GL11.glNormal3f(0.0F, 1.0F, 0.0F); + GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); + GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); + GlStateManager.scale(-f1, -f1, f1); + GlStateManager.disableLighting(); + GlStateManager.depthMask(false); + GlStateManager.disableDepth(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int i = 0; + + int j = fontrenderer.getStringWidth(str) / 2; + GlStateManager.disableTexture2D(); + worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + worldrenderer.pos((double)(-j - 1), (double)(-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(-j - 1), (double)(8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(j + 1), (double)(8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + worldrenderer.pos((double)(j + 1), (double)(-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + tessellator.draw(); + GlStateManager.enableTexture2D(); + fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, 553648127); + GlStateManager.depthMask(true); + + fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, -1); + + GlStateManager.enableDepth(); + GlStateManager.enableBlend(); + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.popMatrix(); + } + } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java new file mode 100644 index 00000000..7ed2414a --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -0,0 +1,128 @@ +package io.github.moulberry.notenoughupdates.miscfeatures; + +import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; +import io.github.moulberry.notenoughupdates.util.SBInfo; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.entity.Entity; +import net.minecraft.util.BlockPos; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import org.lwjgl.opengl.GL11; +import org.lwjgl.util.vector.Vector3f; + +import java.util.ArrayList; +import java.util.List; + +public class CrystalMetalDetectorSolver { + private static final Minecraft mc = Minecraft.getMinecraft(); + private static float prev; + private static List possibleBlocks = new ArrayList<>(); + private static final List distances = new ArrayList<>(); + + public static void process(IChatComponent message) { + if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") + && message.getUnformattedText().contains("TREASURE: ")) { + float dist = Float.parseFloat(message.getUnformattedText().split("TREASURE: ")[1].split("m")[0].replaceAll("(?!\\.)\\D", "")); + if (prev == dist && dist > 5 && !distances.contains(dist) && possibleBlocks.size() != 1) { //Distance 5 minimum because distance calculation is inaccurate under 5 + distances.add(dist); + List temp = new ArrayList<>(); + for (int zOffset = Math.round(-dist); zOffset <= dist; zOffset++) { + float calculatedDist = 0; + int xOffset = 0; + int yOffset = 0; + int loops = 0; + while (calculatedDist < dist) { + loops++; + BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, + Math.floor(mc.thePlayer.posY - 1) + yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); + BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, + Math.floor(mc.thePlayer.posY) + yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); + if (mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:air")) { + yOffset--; + System.out.println("-" + pos + " " + yOffset + " " + mc.theWorld.getBlockState(pos).getBlock().getRegistryName() + " " + + mc.theWorld.getBlockState(above).getBlock().getRegistryName()); + } else if (mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:gold_block")) { + yOffset++; + System.out.println("+" + pos + " " + yOffset + " " + mc.theWorld.getBlockState(pos).getBlock().getRegistryName() + " " + + mc.theWorld.getBlockState(above).getBlock().getRegistryName()); + } else { + System.out.println("Calculating block distance"); + xOffset++; + calculatedDist = (float) round(mc.thePlayer.getDistance(pos.getX(), pos.getY() + 1, pos.getZ()), 1); + if (calculatedDist == dist && (mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:gold_block") + || mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:chest")) && + (possibleBlocks.size() == 0 || possibleBlocks.contains(pos))) { + temp.add(pos); + } + } + if (loops > 500) break; + } + xOffset = 0; + calculatedDist = 0; + yOffset = 0; + loops = 0; + while (calculatedDist < dist) { + loops++; + BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, + Math.floor(mc.thePlayer.posY - 1) + yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); + BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, + Math.floor(mc.thePlayer.posY) + yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); + if (mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:air")) { + yOffset--; + System.out.println("-" + pos + " " + yOffset + " " + mc.theWorld.getBlockState(pos).getBlock().getRegistryName() + " " + + mc.theWorld.getBlockState(above).getBlock().getRegistryName()); + } else if (mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:gold_block")) { + yOffset++; + System.out.println("+" + pos + " " + yOffset + " " + mc.theWorld.getBlockState(pos).getBlock().getRegistryName() + " " + + mc.theWorld.getBlockState(above).getBlock().getRegistryName()); + } else { + System.out.println("Calculating block distance"); + xOffset++; + calculatedDist = (float) round(mc.thePlayer.getDistance(pos.getX(), pos.getY() + 1, pos.getZ()), 1); + if (calculatedDist == dist && (mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:gold_block") + || mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:chest")) && + (possibleBlocks.size() == 0 || possibleBlocks.contains(pos))) { + temp.add(pos); + } + } + if (loops > 500) break; + } + } + possibleBlocks = temp; + System.out.println(possibleBlocks); + if (possibleBlocks.size() > 1) { + mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Need another position to find solution. Possible blocks: " + + possibleBlocks.size())); + } else if (possibleBlocks.size() == 0) { + mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Failed to find solution.")); + } else { + mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Found solution.")); + } + } + prev = dist; + } + } + + public static void reset() { + possibleBlocks.clear(); + distances.clear(); + } + + public static void render(float partialTicks){ + if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && possibleBlocks.size() == 1){ + RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0), partialTicks); + } + } + + private static double round(double value, int precision) { + int scale = (int) Math.pow(10, precision); + return (double) Math.round(value * scale) / scale; + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java index 96f86c36..5c4fb61d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/DwarvenMinesWaypoints.java @@ -1,6 +1,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.overlays.MiningOverlay; import io.github.moulberry.notenoughupdates.util.SBInfo; @@ -197,7 +198,7 @@ public class DwarvenMinesWaypoints { System.currentTimeMillis() - dynamicMillis < 30*1000) { for(Map.Entry entry : waypointsMap.entrySet()) { if(entry.getKey().equals(dynamicLocation)) { - renderWayPoint(dynamicName, new Vector3f(entry.getValue()).translate(0, 15, 0), event.partialTicks); + RenderUtils.renderWayPoint(dynamicName, new Vector3f(entry.getValue()).translate(0, 15, 0), event.partialTicks); break; } } @@ -206,14 +207,14 @@ public class DwarvenMinesWaypoints { if(locWaypoint >= 1) { for(Map.Entry entry : waypointsMap.entrySet()) { if(locWaypoint >= 2) { - renderWayPoint(EnumChatFormatting.AQUA+entry.getKey(), entry.getValue(), event.partialTicks); + RenderUtils.renderWayPoint(EnumChatFormatting.AQUA+entry.getKey(), entry.getValue(), event.partialTicks); } else { for(String commissionName : MiningOverlay.commissionProgress.keySet()) { if(commissionName.toLowerCase().contains(entry.getKey().toLowerCase())) { if(commissionName.contains("Titanium")) { - renderWayPoint(EnumChatFormatting.WHITE+entry.getKey(), entry.getValue(), event.partialTicks); + RenderUtils.renderWayPoint(EnumChatFormatting.WHITE+entry.getKey(), entry.getValue(), event.partialTicks); } else { - renderWayPoint(EnumChatFormatting.AQUA+entry.getKey(), entry.getValue(), event.partialTicks); + RenderUtils.renderWayPoint(EnumChatFormatting.AQUA+entry.getKey(), entry.getValue(), event.partialTicks); } } } @@ -247,7 +248,7 @@ public class DwarvenMinesWaypoints { double distSq = dX*dX + dY*dY + dZ*dZ; if(distSq >= 12*12) { - renderWayPoint(EnumChatFormatting.GOLD+emissary.name, + RenderUtils.renderWayPoint(EnumChatFormatting.GOLD+emissary.name, new Vector3f(emissary.loc).translate(0.5f, 2.488f, 0.5f), event.partialTicks); } @@ -258,81 +259,4 @@ public class DwarvenMinesWaypoints { } } - private void renderWayPoint(String str, Vector3f loc, float partialTicks) { - GlStateManager.alphaFunc(516, 0.1F); - - GlStateManager.pushMatrix(); - - Entity viewer = Minecraft.getMinecraft().getRenderViewEntity(); - double viewerX = viewer.lastTickPosX + (viewer.posX - viewer.lastTickPosX) * partialTicks; - double viewerY = viewer.lastTickPosY + (viewer.posY - viewer.lastTickPosY) * partialTicks; - double viewerZ = viewer.lastTickPosZ + (viewer.posZ - viewer.lastTickPosZ) * partialTicks; - - double x = loc.x-viewerX+0.5f; - double y = loc.y-viewerY-viewer.getEyeHeight(); - double z = loc.z-viewerZ+0.5f; - - double distSq = x*x + y*y + z*z; - double dist = Math.sqrt(distSq); - if(distSq > 144) { - x *= 12/dist; - y *= 12/dist; - z *= 12/dist; - } - GlStateManager.translate(x, y, z); - GlStateManager.translate(0, viewer.getEyeHeight(), 0); - - renderNametag(str); - - GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); - GlStateManager.translate(0, -0.25f, 0); - GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); - GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - - renderNametag(EnumChatFormatting.YELLOW.toString()+Math.round(dist)+"m"); - - GlStateManager.popMatrix(); - - GlStateManager.disableLighting(); - } - - private void renderNametag(String str) { - FontRenderer fontrenderer = Minecraft.getMinecraft().fontRendererObj; - float f = 1.6F; - float f1 = 0.016666668F * f; - GlStateManager.pushMatrix(); - GL11.glNormal3f(0.0F, 1.0F, 0.0F); - GlStateManager.rotate(-Minecraft.getMinecraft().getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(Minecraft.getMinecraft().getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F); - GlStateManager.scale(-f1, -f1, f1); - GlStateManager.disableLighting(); - GlStateManager.depthMask(false); - GlStateManager.disableDepth(); - GlStateManager.enableBlend(); - GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); - Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - int i = 0; - - int j = fontrenderer.getStringWidth(str) / 2; - GlStateManager.disableTexture2D(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - worldrenderer.pos((double)(-j - 1), (double)(-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - worldrenderer.pos((double)(-j - 1), (double)(8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - worldrenderer.pos((double)(j + 1), (double)(8 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - worldrenderer.pos((double)(j + 1), (double)(-1 + i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - tessellator.draw(); - GlStateManager.enableTexture2D(); - fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, 553648127); - GlStateManager.depthMask(true); - - fontrenderer.drawString(str, -fontrenderer.getStringWidth(str) / 2, i, -1); - - GlStateManager.enableDepth(); - GlStateManager.enableBlend(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - GlStateManager.popMatrix(); - } - } -- cgit From f1e34bb4c6add9a371f4017f404635133d61d496 Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 18 Aug 2021 20:41:41 +0200 Subject: disable mixin for loadingscreenrenderer as the feature it was made for was never implemented --- src/main/resources/mixins.notenoughupdates.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/mixins.notenoughupdates.json b/src/main/resources/mixins.notenoughupdates.json index f82f6311..bec344ec 100644 --- a/src/main/resources/mixins.notenoughupdates.json +++ b/src/main/resources/mixins.notenoughupdates.json @@ -22,7 +22,7 @@ "MixinItemStack", "MixinLayerArmorBase", "MixinLayerCustomHead", - "MixinLoadingScreenRenderer", + "MixinMouseHelper", "MixinNetHandlerPlayClient", "MixinPlayerControllerMP", -- cgit From d8548dbf5eefc8bc01b4ab5bb7726b416df7a574 Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 18 Aug 2021 23:04:56 +0200 Subject: Add mastermode to /pv not fully done yet but should be good enough for a release also update changelog --- Update Notes/2.0-Pre31.md | 5 +- .../profileviewer/GuiProfileViewer.java | 150 +++++++++++++++++++-- .../assets/notenoughupdates/pv_elements.png | Bin 5129 -> 3052 bytes 3 files changed, 142 insertions(+), 13 deletions(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 3748e380..7083cea0 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -27,6 +27,8 @@ - Added load from/copy to clipboard to neu inventory buttons gui. - Added SBA chroma support to neuec. - Added a crafting recipe overlay when looking up a recipe while in the crafting menu (to more easily craft items like the Soul Esoward recipe) (DeDiamondPro) +- Added mastermode support to /pv (not fully done yet) + ### **Bug Fixes** - Fishing helper not showing "!" when rod colours are disabled. @@ -52,7 +54,8 @@ - Fixed dwarven mines waypoints not working if dwarven mines overlay was disabled. - Fixed being able to slot lock the 9th slot. - Fixed NEUButtons overlapping with the Accessory Bag overlay by moving the overlapping icons to the right of the overlay. (should work pretty well, too lazy to test with custom button positions but should work fine.) - +- Stopped tooltip tweak rawcraftcost displaying if the cost was 0 (either due to the price being really low or api issue) +- Added a catch to the capemanger slow to catch duplicate players (https://hst.sh/enuvamecef) (idk how but hey its there now) ### **Other** - Code clean up by Ironm00n. 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 56ed9502..d257ef1d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -553,6 +553,15 @@ public class GuiProfileViewer extends GuiScreen { } } } + if(mouseX >= guiLeft-29 && mouseX <= guiLeft){ + if(mouseY >= guiTop && mouseY<= guiTop+28){ + onMasterMode = false; + return; + } else if(mouseY+28 >= guiTop && mouseY<= guiTop+28*2){ + onMasterMode = true; + return; + } + } } protected void keyTypedDung(char typedChar, int keyCode) { @@ -754,6 +763,13 @@ public class GuiProfileViewer extends GuiScreen { } } + private static final LinkedHashMap dungeonsModeIcons = new LinkedHashMap<>(); + static { + dungeonsModeIcons.put("catacombs", Utils.editItemStackInfo(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DUNGEON_STONE")),EnumChatFormatting.GRAY+"Normal Mode", true)); + dungeonsModeIcons.put("master_catacombs", Utils.editItemStackInfo(NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("MASTER_SKULL_TIER_7")),EnumChatFormatting.GRAY+"Master Mode", true)); + + } + private void drawDungPage(int mouseX, int mouseY, float partialTicks) { Minecraft.getMinecraft().getTextureManager().bindTexture(pv_dung); Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY, GL11.GL_NEAREST); @@ -768,6 +784,10 @@ public class GuiProfileViewer extends GuiScreen { int sectionWidth = 110; + String dungeonString = onMasterMode?"master_catacombs":"catacombs"; + + + ProfileViewer.Level levelObjCata = levelObjCatas.get(profileId); //Catacombs level thingy { @@ -865,35 +885,58 @@ public class GuiProfileViewer extends GuiScreen { float secrets = Utils.getElementAsFloat(Utils.getElement(hypixelInfo, "achievements.skyblock_treasure_hunter"), 0); - float totalRuns = 0; + float totalRunsF = 0; float totalRunsF5 = 0; for(int i=1; i<=7; i++) { float runs = Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.dungeon_types.catacombs.tier_completions."+i), 0); - totalRuns += runs; + totalRunsF += runs; if(i >= 5) { totalRunsF5 += runs; } } + float totalRunsM = 0; + float totalRunsM5 = 0; + for(int i=1; i<=7; i++) { + float runs = Utils.getElementAsFloat(Utils.getElement(profileInfo, + "dungeons.dungeon_types.master_catacombs.tier_completions."+i), 0); + totalRunsM += runs; + if(i >= 5) { + totalRunsM5 += runs; + } + } + totalRuns=totalRunsF+totalRunsM; float mobKills = 0; + float mobKillsF = 0; float mobKillsF5 = 0; for(int i=1; i<=7; i++) { float kills = Utils.getElementAsFloat(Utils.getElement(profileInfo, "dungeons.dungeon_types.catacombs.mobs_killed."+i), 0); - mobKills += kills; + mobKillsF += kills; if(i >= 5) { mobKillsF5 += kills; } } + float mobKillsM = 0; + float mobKillsM5 = 0; + for(int i=1; i<=7; i++) { + float kills = Utils.getElementAsFloat(Utils.getElement(profileInfo, + "dungeons.dungeon_types.master_catacombs.mobs_killed."+i), 0); + mobKillsM += kills; + if(i >= 5) { + mobKillsM5 += kills; + } + } + mobKills = mobKillsF+mobKillsM; int miscTopY = y+55; - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs ", - EnumChatFormatting.WHITE.toString()+((int)(totalRuns)), x, miscTopY, sectionWidth); - Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs (F5-7) ", - EnumChatFormatting.WHITE.toString()+((int)(totalRunsF5)), x, miscTopY+10, sectionWidth); + Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs "+(onMasterMode?"M":"F"), + EnumChatFormatting.WHITE.toString()+((int)(onMasterMode?totalRunsM:totalRunsF)), x, miscTopY, sectionWidth); + Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Total Runs ("+(onMasterMode?"M":"F")+ "5-7) ", + EnumChatFormatting.WHITE.toString()+((int)(onMasterMode?totalRunsM5:totalRunsF5)), x, miscTopY+10, sectionWidth); Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Secrets (Total) ", EnumChatFormatting.WHITE.toString()+shortNumberFormat(secrets, 0), x, miscTopY+20, sectionWidth); Utils.renderAlignedString(EnumChatFormatting.YELLOW+"Secrets (/Run) ", @@ -924,11 +967,11 @@ public class GuiProfileViewer extends GuiScreen { } float timeNorm = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time."+floorTime), 0); + "dungeons.dungeon_types."+dungeonString+".fastest_time."+floorTime), 0); float timeS = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time_s."+floorTime), 0); + "dungeons.dungeon_types."+dungeonString+".fastest_time_s."+floorTime), 0); float timeSPLUS = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.fastest_time_s_plus."+floorTime), 0); + "dungeons.dungeon_types."+dungeonString+".fastest_time_s_plus."+floorTime), 0); String timeNormStr = timeNorm <= 0 ? "N/A" : Utils.prettyTime((long)timeNorm); String timeSStr = timeS <= 0 ? "N/A" : Utils.prettyTime((long)timeS); String timeSPlusStr = timeSPLUS <= 0 ? "N/A" : Utils.prettyTime((long)timeSPLUS); @@ -949,7 +992,7 @@ public class GuiProfileViewer extends GuiScreen { x+sectionWidth/2, y, sectionWidth); for(int i=1; i<=7; i++) { float compl = Utils.getElementAsFloat(Utils.getElement(profileInfo, - "dungeons.dungeon_types.catacombs.tier_completions."+i), 0); + "dungeons.dungeon_types."+dungeonString+".tier_completions."+i), 0); if(BOSS_HEADS[i-1] == null) { String textureLink = bossFloorHeads[i-1]; @@ -985,7 +1028,7 @@ public class GuiProfileViewer extends GuiScreen { Utils.drawItemStack(BOSS_HEADS[i-1], 0, 0); GlStateManager.popMatrix(); - Utils.renderAlignedString(String.format(EnumChatFormatting.YELLOW+"%s (F%d) ", bossFloorArr[i-1], i), + Utils.renderAlignedString(String.format(EnumChatFormatting.YELLOW+"%s ("+(onMasterMode?"M":"F")+"%d) ", bossFloorArr[i-1], i), EnumChatFormatting.WHITE.toString()+(int)compl, x+16, y+18+20*(i-1), sectionWidth-15); @@ -1031,6 +1074,89 @@ public class GuiProfileViewer extends GuiScreen { renderXpBar(colour+skillName, dungSkillsStack[i], x, y+20+29*i, sectionWidth, levelObj, mouseX, mouseY); } } + + drawSideButtons(); + + //drawSideButton(0, dungeonsModeIcons.get("catacombs"), true); + //drawSideButton(1, dungeonsModeIcons.get("master_catacombs"), true); + //drawSideButton(1, dungeonsModeIcons.get("catacombs"), true); + //drawSideButton(2, dungeonsModeIcons.get("catacombs"), false); + + + } + + private boolean onMasterMode = false; + + //TODO: improve this shit + private void drawSideButtons(){ + // GlStateManager.pushMatrix(); + GlStateManager.enableDepth(); + GlStateManager.translate(0, 0, 5); + if(onMasterMode){ + drawSideButton(1, dungeonsModeIcons.get("master_catacombs"), true); + } else { + drawSideButton(0, dungeonsModeIcons.get("catacombs"), true); + } + GlStateManager.translate(0, 0, -3); + + GlStateManager.translate(0, 0, -2); + if(!onMasterMode){ + drawSideButton(1, dungeonsModeIcons.get("master_catacombs"), false); + } else { + drawSideButton(0, dungeonsModeIcons.get("catacombs"), false); + } + GlStateManager.disableDepth(); + //GlStateManager.popMatrix(); + } + + + + + private void drawSideButton(int yIndex, ItemStack itemStack, boolean pressed){ + GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + + int x = guiLeft-28; + int y = guiTop+yIndex*28; + + float uMin = 194/256f; + float uMax = 224/256f; + float vMin = 200/256f; + float vMax = 228/256f; + if(pressed) { + uMin = 224/256f; + uMax = 1f; + + + if(yIndex != 0) { + vMin = 228/256f; + vMax = 1f; + } + + renderBlurredBackground(width, height, x+2, y+2, 30, 28-4); + } else { + renderBlurredBackground(width, height, x+2, y+2, 28-2, 28-4); + } + + GlStateManager.disableLighting(); + GlStateManager.enableBlend(); + GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); + GlStateManager.enableAlpha(); + GlStateManager.alphaFunc(516, 0.1F); + + Minecraft.getMinecraft().getTextureManager().bindTexture(pv_elements); + + Utils.drawTexturedRect(x, y, pressed?32:28, 28, uMin, uMax, vMin, vMax, GL11.GL_NEAREST); + + GlStateManager.enableDepth(); + Utils.drawItemStack(itemStack, x+6, y+6); + + + + } private void renderXpBar(String skillName, ItemStack stack, int x, int y, int xSize, ProfileViewer.Level levelObj, int mouseX, int mouseY) { diff --git a/src/main/resources/assets/notenoughupdates/pv_elements.png b/src/main/resources/assets/notenoughupdates/pv_elements.png index 68c4fd9f..25d500c9 100644 Binary files a/src/main/resources/assets/notenoughupdates/pv_elements.png and b/src/main/resources/assets/notenoughupdates/pv_elements.png differ -- cgit From b87e2135d394ea66f0f09e5db63a1c842558d9be Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Wed, 18 Aug 2021 23:57:30 +0200 Subject: code --- .../notenoughupdates/NEUEventListener.java | 1 + .../miscfeatures/CrystalMetalDetectorSolver.java | 164 ++++++++++----------- 2 files changed, 78 insertions(+), 87 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 882dd965..a8be9991 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -170,6 +170,7 @@ public class NEUEventListener { @SubscribeEvent public void onWorldLoad(WorldEvent.Unload event) { NotEnoughUpdates.INSTANCE.saveConfig(); + CrystalMetalDetectorSolver.reset(); } private static long notificationDisplayMillis = 0; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 7ed2414a..2686272d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -2,127 +2,117 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.util.SBInfo; -import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.Entity; import net.minecraft.util.BlockPos; import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IChatComponent; -import org.lwjgl.opengl.GL11; -import org.lwjgl.util.vector.Vector3f; import java.util.ArrayList; import java.util.List; public class CrystalMetalDetectorSolver { private static final Minecraft mc = Minecraft.getMinecraft(); - private static float prev; + private static BlockPos prevPos; + private static float prevDist = 0; private static List possibleBlocks = new ArrayList<>(); - private static final List distances = new ArrayList<>(); + private static final List locations = new ArrayList<>(); public static void process(IChatComponent message) { if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && message.getUnformattedText().contains("TREASURE: ")) { float dist = Float.parseFloat(message.getUnformattedText().split("TREASURE: ")[1].split("m")[0].replaceAll("(?!\\.)\\D", "")); - if (prev == dist && dist > 5 && !distances.contains(dist) && possibleBlocks.size() != 1) { //Distance 5 minimum because distance calculation is inaccurate under 5 - distances.add(dist); - List temp = new ArrayList<>(); - for (int zOffset = Math.round(-dist); zOffset <= dist; zOffset++) { - float calculatedDist = 0; - int xOffset = 0; - int yOffset = 0; - int loops = 0; - while (calculatedDist < dist) { - loops++; - BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, - Math.floor(mc.thePlayer.posY - 1) + yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); - BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, - Math.floor(mc.thePlayer.posY) + yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); - if (mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:air")) { - yOffset--; - System.out.println("-" + pos + " " + yOffset + " " + mc.theWorld.getBlockState(pos).getBlock().getRegistryName() + " " + - mc.theWorld.getBlockState(above).getBlock().getRegistryName()); - } else if (mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:gold_block")) { - yOffset++; - System.out.println("+" + pos + " " + yOffset + " " + mc.theWorld.getBlockState(pos).getBlock().getRegistryName() + " " + - mc.theWorld.getBlockState(above).getBlock().getRegistryName()); - } else { - System.out.println("Calculating block distance"); - xOffset++; - calculatedDist = (float) round(mc.thePlayer.getDistance(pos.getX(), pos.getY() + 1, pos.getZ()), 1); - if (calculatedDist == dist && (mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:gold_block") - || mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:chest")) && - (possibleBlocks.size() == 0 || possibleBlocks.contains(pos))) { - temp.add(pos); + if (prevDist == dist && prevPos.getX() == mc.thePlayer.getPosition().getX() && prevPos.getY() == mc.thePlayer.getPosition().getY() && + prevPos.getZ() == mc.thePlayer.getPosition().getZ() && !locations.contains(mc.thePlayer.getPosition())) { + if (possibleBlocks.size() == 0) { + locations.add(mc.thePlayer.getPosition()); + for (int zOffset = Math.round(-dist); zOffset <= dist; zOffset++) { + for (int yOffset = 65; yOffset <= 70; yOffset++) { + float calculatedDist = 0; + int xOffset = 0; + while (calculatedDist < dist) { + BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, + yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); + BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, + yOffset + 1, Math.floor(mc.thePlayer.posZ) + zOffset); + xOffset++; + calculatedDist = round(mc.thePlayer.getDistance(pos.getX(), pos.getY() + 1, pos.getZ()), 1); + if (calculatedDist == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && + mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { + possibleBlocks.add(pos); + } + xOffset++; + } + xOffset = 0; + calculatedDist = 0; + while (calculatedDist < dist) { + BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, + yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); + BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, + yOffset + 1, Math.floor(mc.thePlayer.posZ) + zOffset); + calculatedDist = round(mc.thePlayer.getDistance(pos.getX(), pos.getY() + 1, pos.getZ()), 1); + if (calculatedDist == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && + mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { + possibleBlocks.add(pos); + } + xOffset++; } } - if (loops > 500) break; } - xOffset = 0; - calculatedDist = 0; - yOffset = 0; - loops = 0; - while (calculatedDist < dist) { - loops++; - BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, - Math.floor(mc.thePlayer.posY - 1) + yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); - BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, - Math.floor(mc.thePlayer.posY) + yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); - if (mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:air")) { - yOffset--; - System.out.println("-" + pos + " " + yOffset + " " + mc.theWorld.getBlockState(pos).getBlock().getRegistryName() + " " + - mc.theWorld.getBlockState(above).getBlock().getRegistryName()); - } else if (mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:gold_block")) { - yOffset++; - System.out.println("+" + pos + " " + yOffset + " " + mc.theWorld.getBlockState(pos).getBlock().getRegistryName() + " " + - mc.theWorld.getBlockState(above).getBlock().getRegistryName()); - } else { - System.out.println("Calculating block distance"); - xOffset++; - calculatedDist = (float) round(mc.thePlayer.getDistance(pos.getX(), pos.getY() + 1, pos.getZ()), 1); - if (calculatedDist == dist && (mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:gold_block") - || mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:chest")) && - (possibleBlocks.size() == 0 || possibleBlocks.contains(pos))) { - temp.add(pos); - } + if (possibleBlocks.size() == 1) possibleBlocks.clear(); //protection from completely wrong things + sendMessage(); + } else if (possibleBlocks.size() != 1) { + locations.add(mc.thePlayer.getPosition()); + List temp = new ArrayList<>(); + for (BlockPos pos : possibleBlocks) { + if (round(mc.thePlayer.getDistance(pos.getX(), pos.getY() + 1, pos.getZ()), 1) == dist) { + temp.add(pos); } - if (loops > 500) break; } - } - possibleBlocks = temp; - System.out.println(possibleBlocks); - if (possibleBlocks.size() > 1) { - mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Need another position to find solution. Possible blocks: " - + possibleBlocks.size())); - } else if (possibleBlocks.size() == 0) { - mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Failed to find solution.")); - } else { - mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Found solution.")); + possibleBlocks = temp; + sendMessage(); } } - prev = dist; + prevPos = mc.thePlayer.getPosition(); + prevDist = dist; } } public static void reset() { possibleBlocks.clear(); - distances.clear(); + locations.clear(); } - public static void render(float partialTicks){ - if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && possibleBlocks.size() == 1){ - RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0), partialTicks); + public static void render(float partialTicks) { + if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && possibleBlocks.size() == 1) { + RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); } } - private static double round(double value, int precision) { + private static float round(double value, int precision) { int scale = (int) Math.pow(10, precision); - return (double) Math.round(value * scale) / scale; + return (float) Math.round(value * scale) / scale; + } + + private static boolean treasureAllowed(BlockPos pos) { + return mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:gold_block") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:prismarine") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:chest") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_glass") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_glass_pane") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:wool") || + mc.theWorld.getBlockState(pos).getBlock().getRegistryName().equals("minecraft:stained_hardened_clay"); + } + + private static void sendMessage() { + if (possibleBlocks.size() > 1) { + mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Need another position to find solution. Possible blocks: " + + possibleBlocks.size())); + } else if (possibleBlocks.size() == 0) { + mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "[NEU] Failed to find solution.")); + reset(); + } else { + mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Found solution.")); + } } } -- cgit From 9c1e2163350c3a2eea843deda5c13d42594d85b0 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 19 Aug 2021 12:47:38 +0200 Subject: better math:tm: --- .../miscfeatures/CrystalMetalDetectorSolver.java | 27 ++++++++++++++-------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 2686272d..f30a792c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -3,10 +3,7 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.util.SBInfo; import net.minecraft.client.Minecraft; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.*; import java.util.ArrayList; import java.util.List; @@ -27,7 +24,7 @@ public class CrystalMetalDetectorSolver { if (possibleBlocks.size() == 0) { locations.add(mc.thePlayer.getPosition()); for (int zOffset = Math.round(-dist); zOffset <= dist; zOffset++) { - for (int yOffset = 65; yOffset <= 70; yOffset++) { + for (int yOffset = 65; yOffset <= 69; yOffset++) { float calculatedDist = 0; int xOffset = 0; while (calculatedDist < dist) { @@ -36,7 +33,7 @@ public class CrystalMetalDetectorSolver { BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, yOffset + 1, Math.floor(mc.thePlayer.posZ) + zOffset); xOffset++; - calculatedDist = round(mc.thePlayer.getDistance(pos.getX(), pos.getY() + 1, pos.getZ()), 1); + calculatedDist = round(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), 1); if (calculatedDist == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); @@ -50,7 +47,7 @@ public class CrystalMetalDetectorSolver { yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, yOffset + 1, Math.floor(mc.thePlayer.posZ) + zOffset); - calculatedDist = round(mc.thePlayer.getDistance(pos.getX(), pos.getY() + 1, pos.getZ()), 1); + calculatedDist = round(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), 1); if (calculatedDist == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); @@ -65,7 +62,7 @@ public class CrystalMetalDetectorSolver { locations.add(mc.thePlayer.getPosition()); List temp = new ArrayList<>(); for (BlockPos pos : possibleBlocks) { - if (round(mc.thePlayer.getDistance(pos.getX(), pos.getY() + 1, pos.getZ()), 1) == dist) { + if (round(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), 1) == dist) { temp.add(pos); } } @@ -84,8 +81,14 @@ public class CrystalMetalDetectorSolver { } public static void render(float partialTicks) { - if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && possibleBlocks.size() == 1) { - RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); + if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows")) { + if (possibleBlocks.size() == 1) { + RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); + } else { + for (BlockPos block : possibleBlocks) { + RenderUtils.renderWayPoint("Possible Treasure Location", block.add(0, 2.5, 0), partialTicks); + } + } } } @@ -115,4 +118,8 @@ public class CrystalMetalDetectorSolver { mc.thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "[NEU] Found solution.")); } } + + private static float calculateDistance(Vec3 pos1, Vec3 pos2) { + return (float) Math.sqrt(Math.pow(pos2.xCoord - pos1.xCoord, 2) + Math.pow(pos2.yCoord - pos1.yCoord, 2) + Math.pow(pos2.zCoord - pos1.zCoord, 2)); + } } -- cgit From 3a1d5603de6e6e80adc80fa5535be1b05912d1f0 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 19 Aug 2021 12:55:35 +0200 Subject: moulBeFix --- .../notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index f30a792c..ae6a2f5c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -23,7 +23,7 @@ public class CrystalMetalDetectorSolver { prevPos.getZ() == mc.thePlayer.getPosition().getZ() && !locations.contains(mc.thePlayer.getPosition())) { if (possibleBlocks.size() == 0) { locations.add(mc.thePlayer.getPosition()); - for (int zOffset = Math.round(-dist); zOffset <= dist; zOffset++) { + for (int zOffset = (int) Math.floor(-dist); zOffset <= Math.ceil(dist); zOffset++) { for (int yOffset = 65; yOffset <= 69; yOffset++) { float calculatedDist = 0; int xOffset = 0; @@ -120,6 +120,6 @@ public class CrystalMetalDetectorSolver { } private static float calculateDistance(Vec3 pos1, Vec3 pos2) { - return (float) Math.sqrt(Math.pow(pos2.xCoord - pos1.xCoord, 2) + Math.pow(pos2.yCoord - pos1.yCoord, 2) + Math.pow(pos2.zCoord - pos1.zCoord, 2)); + return (float) Math.sqrt(Math.pow(pos2.xCoord - pos1.xCoord, 2) + pos2.yCoord - pos1.yCoord + Math.pow(pos2.zCoord - pos1.zCoord, 2)); } } -- cgit From 3ba1d2b5bf7b1a5d29fa4cc9299599db1bae31bc Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 19 Aug 2021 13:00:29 +0200 Subject: Almost finish mastermode support just needs mastermode xp but the rest is very pog already --- Update Notes/2.0-Pre31.md | 2 +- .../profileviewer/GuiProfileViewer.java | 9 ++++++--- .../resources/assets/notenoughupdates/pv_elements.png | Bin 3052 -> 3030 bytes 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 7083cea0..b6cc67bd 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -27,7 +27,7 @@ - Added load from/copy to clipboard to neu inventory buttons gui. - Added SBA chroma support to neuec. - Added a crafting recipe overlay when looking up a recipe while in the crafting menu (to more easily craft items like the Soul Esoward recipe) (DeDiamondPro) -- Added mastermode support to /pv (not fully done yet) +- Added mastermode support to /pv (basically done, just needs mastermode xp) ### **Bug Fixes** 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 d257ef1d..22cbf04d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -786,6 +786,9 @@ public class GuiProfileViewer extends GuiScreen { String dungeonString = onMasterMode?"master_catacombs":"catacombs"; + //Utils.drawStringCentered((onMasterMode?"Master Mode":"Catacombs"),fontRendererObj,(guiLeft+sizeX/2), guiTop+10, true, 0xffff0000); + Utils.renderShadowedString(EnumChatFormatting.RED+(onMasterMode?"Master Mode":"Catacombs"), + (guiLeft+sizeX/2), guiTop+5, sectionWidth); ProfileViewer.Level levelObjCata = levelObjCatas.get(profileId); @@ -1122,8 +1125,8 @@ public class GuiProfileViewer extends GuiScreen { int x = guiLeft-28; int y = guiTop+yIndex*28; - float uMin = 194/256f; - float uMax = 224/256f; + float uMin = 193/256f; + float uMax = 223/256f; float vMin = 200/256f; float vMax = 228/256f; if(pressed) { @@ -1152,7 +1155,7 @@ public class GuiProfileViewer extends GuiScreen { Utils.drawTexturedRect(x, y, pressed?32:28, 28, uMin, uMax, vMin, vMax, GL11.GL_NEAREST); GlStateManager.enableDepth(); - Utils.drawItemStack(itemStack, x+6, y+6); + Utils.drawItemStack(itemStack, x+8, y+7); diff --git a/src/main/resources/assets/notenoughupdates/pv_elements.png b/src/main/resources/assets/notenoughupdates/pv_elements.png index 25d500c9..7e9033bd 100644 Binary files a/src/main/resources/assets/notenoughupdates/pv_elements.png and b/src/main/resources/assets/notenoughupdates/pv_elements.png differ -- cgit From c8a767d0125dec4a1cc3d9fecddcb4aa3a45c301 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 19 Aug 2021 13:06:16 +0200 Subject: nvm --- .../notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index ae6a2f5c..62f47787 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -120,6 +120,6 @@ public class CrystalMetalDetectorSolver { } private static float calculateDistance(Vec3 pos1, Vec3 pos2) { - return (float) Math.sqrt(Math.pow(pos2.xCoord - pos1.xCoord, 2) + pos2.yCoord - pos1.yCoord + Math.pow(pos2.zCoord - pos1.zCoord, 2)); + return (float) Math.sqrt(Math.pow(pos2.xCoord - pos1.xCoord, 2) + Math.pow(pos2.yCoord - pos1.yCoord, 2) + Math.pow(pos2.zCoord - pos1.zCoord, 2)); } } -- cgit From f284801b2ec08afe1136ed76252045ef8d66f96e Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 19 Aug 2021 14:08:06 +0200 Subject: Swap the help button to /neuhelp instead of the tutorial gui --- src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 19bd0dfa..d196f75a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -387,7 +387,8 @@ public class NEUOverlay extends Gui { if(Mouse.getEventButtonState()) { //displayInformationPane(HTMLInfoPane.createFromWikiUrl(overlay, manager, "Help", // "https://moulberry.github.io/files/neu_help.html")); - Minecraft.getMinecraft().displayGuiScreen(new HelpGUI()); + //Minecraft.getMinecraft().displayGuiScreen(new HelpGUI()); + ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/neuhelp"); Utils.playPressSound(); } } -- cgit From 80ef1d055cd685bf6dc643a2f51354d91f227862 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 19 Aug 2021 14:27:10 +0200 Subject: using less accurate calculations to have a higher probability of finding it even with some calculation errors --- .../miscfeatures/CrystalMetalDetectorSolver.java | 25 ++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 62f47787..a21673da 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -24,7 +24,7 @@ public class CrystalMetalDetectorSolver { if (possibleBlocks.size() == 0) { locations.add(mc.thePlayer.getPosition()); for (int zOffset = (int) Math.floor(-dist); zOffset <= Math.ceil(dist); zOffset++) { - for (int yOffset = 65; yOffset <= 69; yOffset++) { + for (int yOffset = 65; yOffset <= 70; yOffset++) { float calculatedDist = 0; int xOffset = 0; while (calculatedDist < dist) { @@ -33,10 +33,11 @@ public class CrystalMetalDetectorSolver { BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, yOffset + 1, Math.floor(mc.thePlayer.posZ) + zOffset); xOffset++; - calculatedDist = round(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), 1); - if (calculatedDist == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && + calculatedDist = calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)); + if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); + System.out.println(calculatedDist); } xOffset++; } @@ -47,16 +48,16 @@ public class CrystalMetalDetectorSolver { yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, yOffset + 1, Math.floor(mc.thePlayer.posZ) + zOffset); - calculatedDist = round(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), 1); - if (calculatedDist == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && + calculatedDist = calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)); + if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); + System.out.println(calculatedDist); } xOffset++; } } } - if (possibleBlocks.size() == 1) possibleBlocks.clear(); //protection from completely wrong things sendMessage(); } else if (possibleBlocks.size() != 1) { locations.add(mc.thePlayer.getPosition()); @@ -66,6 +67,14 @@ public class CrystalMetalDetectorSolver { temp.add(pos); } } + if(temp.size() == 0){ + for (BlockPos pos : possibleBlocks) { + if (inRange(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), dist)) { + temp.add(pos); + mc.thePlayer.addChatMessage(new ChatComponentText("Less accurate calculation")); + } + } + } possibleBlocks = temp; sendMessage(); } @@ -122,4 +131,8 @@ public class CrystalMetalDetectorSolver { private static float calculateDistance(Vec3 pos1, Vec3 pos2) { return (float) Math.sqrt(Math.pow(pos2.xCoord - pos1.xCoord, 2) + Math.pow(pos2.yCoord - pos1.yCoord, 2) + Math.pow(pos2.zCoord - pos1.zCoord, 2)); } + + private static boolean inRange(float number, float dist) { + return dist + 0.1D >= number && dist - 0.1D <= number; + } } -- cgit From 9bf3a34c63179cfa7df0272c10e1ad09268f42ab Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 19 Aug 2021 14:51:33 +0200 Subject: change --- .../miscfeatures/CrystalMetalDetectorSolver.java | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index a21673da..22d8e59c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -63,18 +63,10 @@ public class CrystalMetalDetectorSolver { locations.add(mc.thePlayer.getPosition()); List temp = new ArrayList<>(); for (BlockPos pos : possibleBlocks) { - if (round(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), 1) == dist) { + if (inRange(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), dist)) { temp.add(pos); } } - if(temp.size() == 0){ - for (BlockPos pos : possibleBlocks) { - if (inRange(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), dist)) { - temp.add(pos); - mc.thePlayer.addChatMessage(new ChatComponentText("Less accurate calculation")); - } - } - } possibleBlocks = temp; sendMessage(); } -- cgit From f26c7b84a9e2d72d4ba3e7b03283697bfe610ea8 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 19 Aug 2021 16:07:46 +0200 Subject: finalize --- .../miscfeatures/CrystalMetalDetectorSolver.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 22d8e59c..24496593 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -37,7 +37,6 @@ public class CrystalMetalDetectorSolver { if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); - System.out.println(calculatedDist); } xOffset++; } @@ -52,7 +51,6 @@ public class CrystalMetalDetectorSolver { if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); - System.out.println(calculatedDist); } xOffset++; } @@ -63,10 +61,18 @@ public class CrystalMetalDetectorSolver { locations.add(mc.thePlayer.getPosition()); List temp = new ArrayList<>(); for (BlockPos pos : possibleBlocks) { - if (inRange(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), dist)) { + if (round(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), 1) + == dist) { temp.add(pos); } } + if(temp.size() == 0) { + for (BlockPos pos : possibleBlocks) { + if (inRange(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), dist)) { + temp.add(pos); + } + } + } possibleBlocks = temp; sendMessage(); } @@ -125,6 +131,6 @@ public class CrystalMetalDetectorSolver { } private static boolean inRange(float number, float dist) { - return dist + 0.1D >= number && dist - 0.1D <= number; + return dist + 0.15D >= number && dist - 0.15D <= number; } } -- cgit From daf03820a63662b3024e1722a587c8fffd694b3b Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 19 Aug 2021 16:13:01 +0200 Subject: fix crash that might happen --- .../java/io/github/moulberry/notenoughupdates/NEUEventListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index a8be9991..2e108d21 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -836,7 +836,7 @@ public class NEUEventListener { e.message = new ChatComponentText(m2); } } - if (unformatted.startsWith("You found ") && SBInfo.getInstance().getLocation().equals("crystal_hollows")){ + if (unformatted.startsWith("You found ") && SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows")){ CrystalMetalDetectorSolver.reset(); } } -- cgit From d525edf7b6395250feefb8b930d7234574721aba Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 19 Aug 2021 18:24:35 +0200 Subject: config options --- .../miscfeatures/CrystalMetalDetectorSolver.java | 8 ++++--- .../options/seperateSections/Mining.java | 26 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 24496593..b95675bc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.miscfeatures; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.util.SBInfo; import net.minecraft.client.Minecraft; @@ -19,12 +20,13 @@ public class CrystalMetalDetectorSolver { if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && message.getUnformattedText().contains("TREASURE: ")) { float dist = Float.parseFloat(message.getUnformattedText().split("TREASURE: ")[1].split("m")[0].replaceAll("(?!\\.)\\D", "")); - if (prevDist == dist && prevPos.getX() == mc.thePlayer.getPosition().getX() && prevPos.getY() == mc.thePlayer.getPosition().getY() && + if (NotEnoughUpdates.INSTANCE.config.mining.metalDetectorEnabled && prevDist == dist && prevPos.getX() == mc.thePlayer.getPosition().getX() && + prevPos.getY() == mc.thePlayer.getPosition().getY() && prevPos.getZ() == mc.thePlayer.getPosition().getZ() && !locations.contains(mc.thePlayer.getPosition())) { if (possibleBlocks.size() == 0) { locations.add(mc.thePlayer.getPosition()); for (int zOffset = (int) Math.floor(-dist); zOffset <= Math.ceil(dist); zOffset++) { - for (int yOffset = 65; yOffset <= 70; yOffset++) { + for (int yOffset = 65; yOffset <= 75; yOffset++) { float calculatedDist = 0; int xOffset = 0; while (calculatedDist < dist) { @@ -91,7 +93,7 @@ public class CrystalMetalDetectorSolver { if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows")) { if (possibleBlocks.size() == 1) { RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); - } else { + } else if(possibleBlocks.size() > 1 && NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { for (BlockPos block : possibleBlocks) { RenderUtils.renderWayPoint("Possible Treasure Location", block.add(0, 2.5, 0), partialTicks); } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index 157da202..2c05b462 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -139,6 +139,32 @@ public class Mining { @ConfigAccordionId(id = 2) public int overlayStyle = 0; + @ConfigOption( + name = "Metal Detector Solver", + desc = "" + ) + @ConfigEditorAccordion(id = 3) + public boolean metalDetectorSolverAccordion = false; + + @Expose + @ConfigOption( + name = "Enabled", + desc = "Enabled the metal detector solver for Mines of Divan, to use this stand still to calculate possible blocks and then if required stand" + + " still on another block." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean metalDetectorEnabled = true; + + @Expose + @ConfigOption( + name = "Show Possible Blocks", + desc = "Show waypoints on possible locations when NEU isn't sure about what block the treasure is." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 3) + public boolean metalDetectorShowPossible = false; + @Expose @ConfigOption( name = "Puzzler Solver", -- cgit From c518e81a6e4165c1736414c2cf45a19bb5acb355 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Fri, 20 Aug 2021 12:30:12 +0200 Subject: better --- .../miscfeatures/CrystalMetalDetectorSolver.java | 41 +++++++++++----------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index b95675bc..c6ad2ef1 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -12,30 +12,30 @@ import java.util.List; public class CrystalMetalDetectorSolver { private static final Minecraft mc = Minecraft.getMinecraft(); private static BlockPos prevPos; - private static float prevDist = 0; + private static double prevDist = 0; private static List possibleBlocks = new ArrayList<>(); private static final List locations = new ArrayList<>(); public static void process(IChatComponent message) { if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && message.getUnformattedText().contains("TREASURE: ")) { - float dist = Float.parseFloat(message.getUnformattedText().split("TREASURE: ")[1].split("m")[0].replaceAll("(?!\\.)\\D", "")); + double dist = Double.parseDouble(message.getUnformattedText().split("TREASURE: ")[1].split("m")[0].replaceAll("(?!\\.)\\D", "")); if (NotEnoughUpdates.INSTANCE.config.mining.metalDetectorEnabled && prevDist == dist && prevPos.getX() == mc.thePlayer.getPosition().getX() && prevPos.getY() == mc.thePlayer.getPosition().getY() && prevPos.getZ() == mc.thePlayer.getPosition().getZ() && !locations.contains(mc.thePlayer.getPosition())) { if (possibleBlocks.size() == 0) { locations.add(mc.thePlayer.getPosition()); for (int zOffset = (int) Math.floor(-dist); zOffset <= Math.ceil(dist); zOffset++) { - for (int yOffset = 65; yOffset <= 75; yOffset++) { - float calculatedDist = 0; + for (int y = 65; y <= 75; y++) { + double calculatedDist = 0; int xOffset = 0; while (calculatedDist < dist) { BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, - yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); + y, Math.floor(mc.thePlayer.posZ) + zOffset); BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, - yOffset + 1, Math.floor(mc.thePlayer.posZ) + zOffset); + y + 1, Math.floor(mc.thePlayer.posZ) + zOffset); xOffset++; - calculatedDist = calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)); + calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)); if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); @@ -46,10 +46,10 @@ public class CrystalMetalDetectorSolver { calculatedDist = 0; while (calculatedDist < dist) { BlockPos pos = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, - yOffset, Math.floor(mc.thePlayer.posZ) + zOffset); + y, Math.floor(mc.thePlayer.posZ) + zOffset); BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, - yOffset + 1, Math.floor(mc.thePlayer.posZ) + zOffset); - calculatedDist = calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)); + y + 1, Math.floor(mc.thePlayer.posZ) + zOffset); + calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)); if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); @@ -63,14 +63,14 @@ public class CrystalMetalDetectorSolver { locations.add(mc.thePlayer.getPosition()); List temp = new ArrayList<>(); for (BlockPos pos : possibleBlocks) { - if (round(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), 1) + if (round(getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)), 1) == dist) { temp.add(pos); } } - if(temp.size() == 0) { + if (temp.size() == 0) { for (BlockPos pos : possibleBlocks) { - if (inRange(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), dist)) { + if (inRange(getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)), dist)) { temp.add(pos); } } @@ -93,7 +93,7 @@ public class CrystalMetalDetectorSolver { if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows")) { if (possibleBlocks.size() == 1) { RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); - } else if(possibleBlocks.size() > 1 && NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { + } else if (possibleBlocks.size() > 1 && NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { for (BlockPos block : possibleBlocks) { RenderUtils.renderWayPoint("Possible Treasure Location", block.add(0, 2.5, 0), partialTicks); } @@ -101,9 +101,9 @@ public class CrystalMetalDetectorSolver { } } - private static float round(double value, int precision) { + private static double round(double value, int precision) { int scale = (int) Math.pow(10, precision); - return (float) Math.round(value * scale) / scale; + return (double) Math.round(value * scale) / scale; } private static boolean treasureAllowed(BlockPos pos) { @@ -128,11 +128,12 @@ public class CrystalMetalDetectorSolver { } } - private static float calculateDistance(Vec3 pos1, Vec3 pos2) { - return (float) Math.sqrt(Math.pow(pos2.xCoord - pos1.xCoord, 2) + Math.pow(pos2.yCoord - pos1.yCoord, 2) + Math.pow(pos2.zCoord - pos1.zCoord, 2)); + + private static boolean inRange(double number, double dist) { + return dist + 0.1D >= number && dist - 0.1D <= number; } - private static boolean inRange(float number, float dist) { - return dist + 0.15D >= number && dist - 0.15D <= number; + private static Vec3 getPlayerPos() { + return new Vec3(mc.thePlayer.posX, mc.thePlayer.posY + (mc.thePlayer.getEyeHeight() - mc.thePlayer.getDefaultEyeHeight()), mc.thePlayer.posZ); } } -- cgit From 20fd2dc63a7547c341062a20e26b1154a48952c1 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 20 Aug 2021 14:53:17 +0200 Subject: Add option to disable pickaxe ability cooldown as pickaxe durability --- .../moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java | 4 ++-- .../notenoughupdates/options/seperateSections/ItemOverlays.java | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java index 59b3d802..053910bc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/ItemCooldowns.java @@ -124,7 +124,7 @@ public class ItemCooldowns { } private static void updatePickaxeCooldown() { - if(pickaxeCooldown == -1) { + if(pickaxeCooldown == -1 && NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility) { for(ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) { if(stack != null && stack.hasTagCompound()) { String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack); @@ -148,7 +148,7 @@ public class ItemCooldowns { @SubscribeEvent public void onChatMessage(ClientChatReceivedEvent event) { - if(pickaxeCooldown != 0 && PICKAXE_ABILITY_REGEX.matcher(event.message.getFormattedText()).matches()) { + if(pickaxeCooldown != 0 && PICKAXE_ABILITY_REGEX.matcher(event.message.getFormattedText()).matches() && NotEnoughUpdates.INSTANCE.config.itemOverlays.pickaxeAbility) { updatePickaxeCooldown(); pickaxeUseCooldownMillisRemaining = pickaxeCooldown*1000; } 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 af236bf8..86256650 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 @@ -303,4 +303,13 @@ public class ItemOverlays { @ConfigEditorBoolean public boolean enablePrismapumpOverlay = true; + + @Expose + @ConfigOption( + name = "Pickaxe Ability Cooldown", + desc = "Show the cooldown duration off the pickaxe ability as the durability." + ) + @ConfigEditorBoolean + public boolean pickaxeAbility = true; + } -- cgit From 1f0af827fe5e89f40a3e052b60d93bae116f8b2d Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 20 Aug 2021 15:09:01 +0200 Subject: Update changelog --- Update Notes/2.0-Pre31.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index b6cc67bd..d9fb5d0d 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -2,7 +2,7 @@ ### **Major new features** -- None yet +- Added divan's mines metel detector waypoints (DeDiamondPro) ### **New Features:** - Added Ferocity, Magic find, Mining speed and mining fortune to Accessory bag (and ferocity and magic find to /pv). @@ -28,6 +28,7 @@ - Added SBA chroma support to neuec. - Added a crafting recipe overlay when looking up a recipe while in the crafting menu (to more easily craft items like the Soul Esoward recipe) (DeDiamondPro) - Added mastermode support to /pv (basically done, just needs mastermode xp) +- Added ability to toggle the pickaxe's ability cooldown showing up as the pickaxe durability. ### **Bug Fixes** @@ -57,6 +58,7 @@ - Stopped tooltip tweak rawcraftcost displaying if the cost was 0 (either due to the price being really low or api issue) - Added a catch to the capemanger slow to catch duplicate players (https://hst.sh/enuvamecef) (idk how but hey its there now) + ### **Other** - Code clean up by Ironm00n. - Rename variables to be more consistent. (Ironm00n) @@ -75,3 +77,13 @@ - Disabled gamemodes command. - Changed first time message to open /neuhelp instead of tutorial. +### **Notes for texturepack creators** + +- Added 4 new button textures have been added to notenoughupdates/pv_elements.png (bottom right) +- Added a new button texture (notenoughupdates/dungeon_map/editor/button.png) so the dungeon map editor's buttons arent dark while using dark gui (packshq i think) +- Added the edit button to the Storage gui texture (it was already on transparent but not on the others) please update your textures +- Added neu logo to the bottom right of the Storage gui textures +- Added ironman icon to pv (notenoughupdates/pv_ironman.png) (thanks ery for the icon) + + + -- cgit From 0f2be33018c085c11d0f283fe91b291d5a5a197b Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Fri, 20 Aug 2021 18:59:37 +0200 Subject: cleanup code + allow r to view recipe and u to view usages with virtual items in the crafting overlay --- .../notenoughupdates/NEUEventListener.java | 12 +++--- .../moulberry/notenoughupdates/NEUManager.java | 4 +- .../notenoughupdates/overlays/CraftingOverlay.java | 49 ++++++++++++++++++---- 3 files changed, 47 insertions(+), 18 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 2e108d21..0f45eb1a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -18,10 +18,7 @@ import io.github.moulberry.notenoughupdates.dungeons.DungeonWin; import io.github.moulberry.notenoughupdates.miscfeatures.*; import io.github.moulberry.notenoughupdates.miscgui.*; import io.github.moulberry.notenoughupdates.options.NEUConfig; -import io.github.moulberry.notenoughupdates.overlays.AuctionSearchOverlay; -import io.github.moulberry.notenoughupdates.overlays.OverlayManager; -import io.github.moulberry.notenoughupdates.overlays.RancherBootOverlay; -import io.github.moulberry.notenoughupdates.overlays.TextOverlay; +import io.github.moulberry.notenoughupdates.overlays.*; import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer; import io.github.moulberry.notenoughupdates.util.*; import net.minecraft.client.Minecraft; @@ -570,7 +567,7 @@ public class NEUEventListener { AtomicBoolean missingRecipe = new AtomicBoolean(false); @SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { - neu.manager.craftingOverlay.shouldRender = false; + CraftingOverlay.shouldRender = false; if((Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper || Minecraft.getMinecraft().currentScreen instanceof GuiItemRecipe) && @@ -1067,7 +1064,7 @@ public class NEUEventListener { ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); if (containerName.equals("Craft Item")) { - neu.manager.craftingOverlay.render(); + CraftingOverlay.render(); } } @@ -1503,6 +1500,9 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if(CraftingOverlay.shouldRender && containerName.equals("Craft Item")){ + CraftingOverlay.keyInput(); + } } if(GuiCustomEnchant.getInstance().shouldOverride(containerName) && diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index aff030d8..2975115c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -76,8 +76,6 @@ public class NEUManager { public File repoLocation; public File configFile; - public CraftingOverlay craftingOverlay = new CraftingOverlay(this); - public NEUManager(NotEnoughUpdates neu, File configLocation) { this.neu = neu; this.configLocation = configLocation; @@ -804,7 +802,7 @@ public class NEUManager { if (item.has("recipe") && Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerChest) { ContainerChest container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; if (container.getLowerChestInventory().getDisplayName().getUnformattedText().equals("Craft Item")) { - craftingOverlay.updateItem(item); + CraftingOverlay.updateItem(item); } } else if(item.has("useneucraft") && item.get("useneucraft").getAsBoolean()) { displayGuiItemRecipe(item.get("internalname").getAsString(), ""); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java index 9b555dfd..1ddb25fd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.overlays; import com.google.gson.JsonObject; import io.github.moulberry.notenoughupdates.NEUManager; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; @@ -10,21 +11,20 @@ import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; +import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; +import java.io.File; import java.util.List; public class CraftingOverlay { - private ItemStack[] items = new ItemStack[9]; - private final NEUManager manager; - public boolean shouldRender = false; - private String text = null; + private static ItemStack[] items = new ItemStack[9]; + private static final NEUManager manager = NotEnoughUpdates.INSTANCE.manager; + public static boolean shouldRender = false; + private static String text = null; - public CraftingOverlay(NEUManager manager) { - this.manager = manager; - } - public void render() { + public static void render() { if (shouldRender) { ContainerChest container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; GuiChest gc = (GuiChest) Minecraft.getMinecraft().currentScreen; @@ -58,7 +58,7 @@ public class CraftingOverlay { } } - public void updateItem(JsonObject item) { + public static void updateItem(JsonObject item) { items = new ItemStack[9]; text = null; String[] x = {"1", "2", "3"}; @@ -85,4 +85,35 @@ public class CraftingOverlay { } shouldRender = true; } + + public static void keyInput() { + if (!Keyboard.getEventKeyState() || Keyboard.getEventKey() != Keyboard.KEY_U && Keyboard.getEventKey() != Keyboard.KEY_R) + return; + int width = Utils.peekGuiScale().getScaledWidth(); + int height = Utils.peekGuiScale().getScaledHeight(); + int mouseX = Mouse.getX() * width / Minecraft.getMinecraft().displayWidth; + int mouseY = height - Mouse.getY() * height / Minecraft.getMinecraft().displayHeight - 1; + ContainerChest container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; + GuiChest gc = (GuiChest) Minecraft.getMinecraft().currentScreen; + for (int i = 0; i < 9; i++) { + if (items[i] != null) { + int slotIndex = (int) (10 + 9 * Math.floor(i / 3f) + (i % 3)); + Slot slot = container.inventorySlots.get(slotIndex); + int x = slot.xDisplayPosition + gc.guiLeft; + int y = slot.yDisplayPosition + gc.guiTop; + if (mouseX >= x && mouseX < x + 16 && mouseY >= y && mouseY < y + 16) { + if (!slot.getHasStack()) { + String internalName = manager.getInternalNameForItem(items[i]); + if (Keyboard.getEventKey() == Keyboard.KEY_U && internalName != null) { + manager.displayGuiItemUsages(internalName); + } else if (Keyboard.getEventKey() == Keyboard.KEY_R && internalName != null && manager.getItemInformation().containsKey(internalName)) { + JsonObject item = manager.getItemInformation().get(internalName); + manager.showRecipe(item); + } + } + break; + } + } + } + } } -- cgit From 8c6d02fc0f14b84fa69bfbe697ba00a53fbc19a3 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Fri, 20 Aug 2021 19:05:46 +0200 Subject: imports --- .../io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java index 1ddb25fd..eb4749db 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CraftingOverlay.java @@ -14,7 +14,6 @@ import net.minecraft.item.ItemStack; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; -import java.io.File; import java.util.List; public class CraftingOverlay { -- cgit From 8c9a3431f07d3e6a2a7c162c0e47ff7f150afa12 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 20 Aug 2021 19:10:05 +0200 Subject: Fix spelling mistake in change log --- Update Notes/2.0-Pre31.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index d9fb5d0d..7f0c3313 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -2,7 +2,7 @@ ### **Major new features** -- Added divan's mines metel detector waypoints (DeDiamondPro) +- Added divan's mines metal detector waypoints (DeDiamondPro) ### **New Features:** - Added Ferocity, Magic find, Mining speed and mining fortune to Accessory bag (and ferocity and magic find to /pv). -- cgit From da34d19ebed6b7158b1d730d7fef459c73fe1aa4 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 20 Aug 2021 20:16:52 +0200 Subject: Add alternative fairysouls command "/fairysouls" --- .../github/moulberry/notenoughupdates/NotEnoughUpdates.java | 1 + .../moulberry/notenoughupdates/miscfeatures/FairySouls.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index b699afa5..f0cf7774 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -1269,6 +1269,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(dungeonWinTest); ClientCommandHandler.instance.registerCommand(calendarCommand); ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommand()); + ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommandAlt()); ClientCommandHandler.instance.registerCommand(neuhelp); BackgroundBlur.registerListener(); 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 d45ca9ba..28b03f52 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java @@ -17,6 +17,7 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.command.ICommandSender; import net.minecraft.entity.Entity; import net.minecraft.util.*; +import net.minecraftforge.client.ClientCommandHandler; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.event.world.WorldEvent; @@ -293,6 +294,18 @@ public class FairySouls { GlStateManager.enableDepth(); } + public static class FairySoulsCommandAlt extends SimpleCommand { + public FairySoulsCommandAlt() { + super("fairysouls", new ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/neusouls"); + } + } + ); + } + } + public static class FairySoulsCommand extends SimpleCommand { public FairySoulsCommand() { -- cgit From bb2583030b8230e46358c85c342335a82ee91039 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 20 Aug 2021 20:18:24 +0200 Subject: Update changelog --- Update Notes/2.0-Pre31.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 7f0c3313..6f8fe8a4 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -57,7 +57,7 @@ - Fixed NEUButtons overlapping with the Accessory Bag overlay by moving the overlapping icons to the right of the overlay. (should work pretty well, too lazy to test with custom button positions but should work fine.) - Stopped tooltip tweak rawcraftcost displaying if the cost was 0 (either due to the price being really low or api issue) - Added a catch to the capemanger slow to catch duplicate players (https://hst.sh/enuvamecef) (idk how but hey its there now) - +- Added alternative command for "/neusouls" "/fairysouls" ### **Other** - Code clean up by Ironm00n. @@ -82,7 +82,7 @@ - Added 4 new button textures have been added to notenoughupdates/pv_elements.png (bottom right) - Added a new button texture (notenoughupdates/dungeon_map/editor/button.png) so the dungeon map editor's buttons arent dark while using dark gui (packshq i think) - Added the edit button to the Storage gui texture (it was already on transparent but not on the others) please update your textures -- Added neu logo to the bottom right of the Storage gui textures +- Added neu logo to the bottom right of the Storage gui textures (so people stop asking which mod adds the gui (Atleast try to make the amount less)) - Added ironman icon to pv (notenoughupdates/pv_ironman.png) (thanks ery for the icon) -- cgit From 45005ca693c7b43ff7eedd509b0b4a784cedd9f1 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 20 Aug 2021 20:35:36 +0200 Subject: Clean up fairysouls commands a bit more --- .../notenoughupdates/miscfeatures/FairySouls.java | 137 ++++++++++----------- 1 file changed, 66 insertions(+), 71 deletions(-) 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 28b03f52..05591e81 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/FairySouls.java @@ -296,90 +296,85 @@ public class FairySouls { public static class FairySoulsCommandAlt extends SimpleCommand { public FairySoulsCommandAlt() { - super("fairysouls", new ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/neusouls"); - } - } - ); + super("fairysouls", fairysoulRunnable); } } public static class FairySoulsCommand extends SimpleCommand { public FairySoulsCommand() { - super("neusouls", new ProcessCommandRunnable() { - @Override - public void processCommand(ICommandSender sender, String[] args) { - if(args.length != 1) { - printHelp(); - return; + super("neusouls", fairysoulRunnable); + } + } + + private static SimpleCommand.ProcessCommandRunnable fairysoulRunnable = new SimpleCommand.ProcessCommandRunnable() { + @Override + public void processCommand(ICommandSender sender, String[] args) { + if(args.length != 1) { + printHelp(); + return; + } + String subcommand = args[0].toLowerCase(); + + switch (subcommand) { + case "help": + printHelp(); + return; + case "on": + case "enable": + print(EnumChatFormatting.DARK_PURPLE+"Enabled fairy soul waypoints"); + enabled = true; + return; + case "off": + case "disable": + print(EnumChatFormatting.DARK_PURPLE+"Disabled fairy soul waypoints"); + enabled = false; + return; + case "clear": { + String location = SBInfo.getInstance().getLocation(); + if(currentSoulList == null || location == null) { + print(EnumChatFormatting.RED+"No fairy souls found in your current world"); + } else { + Set found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); + for(int i=0; i found = foundSouls.computeIfAbsent(location, k -> new HashSet<>()); - for(int i=0; i Date: Fri, 20 Aug 2021 20:43:23 +0200 Subject: bug sqaushing --- .../moulberry/notenoughupdates/NEUManager.java | 10 ++++----- .../miscfeatures/CrystalMetalDetectorSolver.java | 24 +++++----------------- 2 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 2975115c..80fc0667 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -799,11 +799,11 @@ public class NEUManager { } public void showRecipe(JsonObject item) { - if (item.has("recipe") && Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerChest) { - ContainerChest container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; - if (container.getLowerChestInventory().getDisplayName().getUnformattedText().equals("Craft Item")) { - CraftingOverlay.updateItem(item); - } + ContainerChest container = null; + if(Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerChest) + container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; + if (item.has("recipe") && container != null && container.getLowerChestInventory().getDisplayName().getUnformattedText().equals("Craft Item")) { + CraftingOverlay.updateItem(item); } else if(item.has("useneucraft") && item.get("useneucraft").getAsBoolean()) { displayGuiItemRecipe(item.get("internalname").getAsString(), ""); } else if(item.has("clickcommand")) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index c6ad2ef1..357d8326 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -34,9 +34,8 @@ public class CrystalMetalDetectorSolver { y, Math.floor(mc.thePlayer.posZ) + zOffset); BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, y + 1, Math.floor(mc.thePlayer.posZ) + zOffset); - xOffset++; - calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)); - if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && + calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)); + if (round(calculatedDist, 1) == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); } @@ -49,8 +48,8 @@ public class CrystalMetalDetectorSolver { y, Math.floor(mc.thePlayer.posZ) + zOffset); BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, y + 1, Math.floor(mc.thePlayer.posZ) + zOffset); - calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)); - if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && + calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)); + if (round(calculatedDist, 1) == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); } @@ -63,18 +62,10 @@ public class CrystalMetalDetectorSolver { locations.add(mc.thePlayer.getPosition()); List temp = new ArrayList<>(); for (BlockPos pos : possibleBlocks) { - if (round(getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)), 1) - == dist) { + if (round(getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)), 1) == dist) { temp.add(pos); } } - if (temp.size() == 0) { - for (BlockPos pos : possibleBlocks) { - if (inRange(getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)), dist)) { - temp.add(pos); - } - } - } possibleBlocks = temp; sendMessage(); } @@ -128,11 +119,6 @@ public class CrystalMetalDetectorSolver { } } - - private static boolean inRange(double number, double dist) { - return dist + 0.1D >= number && dist - 0.1D <= number; - } - private static Vec3 getPlayerPos() { return new Vec3(mc.thePlayer.posX, mc.thePlayer.posY + (mc.thePlayer.getEyeHeight() - mc.thePlayer.getDefaultEyeHeight()), mc.thePlayer.posZ); } -- cgit From fefed35f9af4e2abdedf9d1788d83662171089c8 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 21 Aug 2021 11:44:30 +0200 Subject: Fix being able to hotkey slotlocked items in a container --- Update Notes/2.0-Pre31.md | 7 ++++--- .../moulberry/notenoughupdates/mixins/MixinGuiContainer.java | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 6f8fe8a4..bd0360f3 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -29,6 +29,7 @@ - Added a crafting recipe overlay when looking up a recipe while in the crafting menu (to more easily craft items like the Soul Esoward recipe) (DeDiamondPro) - Added mastermode support to /pv (basically done, just needs mastermode xp) - Added ability to toggle the pickaxe's ability cooldown showing up as the pickaxe durability. +- Added alternative command for "/neusouls" "/fairysouls". ### **Bug Fixes** @@ -55,9 +56,9 @@ - Fixed dwarven mines waypoints not working if dwarven mines overlay was disabled. - Fixed being able to slot lock the 9th slot. - Fixed NEUButtons overlapping with the Accessory Bag overlay by moving the overlapping icons to the right of the overlay. (should work pretty well, too lazy to test with custom button positions but should work fine.) -- Stopped tooltip tweak rawcraftcost displaying if the cost was 0 (either due to the price being really low or api issue) -- Added a catch to the capemanger slow to catch duplicate players (https://hst.sh/enuvamecef) (idk how but hey its there now) -- Added alternative command for "/neusouls" "/fairysouls" +- Stopped tooltip tweak rawcraftcost displaying if the cost was 0 (either due to the price being really low or api issue). +- Added a catch to the capemanger slow to catch duplicate players (https://hst.sh/enuvamecef) (idk how but hey its there now). +- Fix being able to hotkey slotlocked items in a chest gui. ### **Other** - Code clean up by Ironm00n. diff --git a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java index 3ed16e76..82634c87 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/mixins/MixinGuiContainer.java @@ -30,6 +30,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @@ -166,6 +167,12 @@ public abstract class MixinGuiContainer extends GuiScreen { } return slot.canBeHovered(); } + @Inject(method="checkHotbarKeys", at=@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/inventory/GuiContainer;handleMouseClick(Lnet/minecraft/inventory/Slot;III)V"), locals = LocalCapture.CAPTURE_FAILSOFT ,cancellable = true) + public void checkHotbarKeys_Slotlock(int keyCode, CallbackInfoReturnable cir, int i){ + if(SlotLocking.getInstance().isSlotIndexLocked(i)){ + cir.setReturnValue(false); + } + } @Inject(method="handleMouseClick", at=@At(value="HEAD"), cancellable = true) public void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType, CallbackInfo ci) { @@ -209,5 +216,4 @@ public abstract class MixinGuiContainer extends GuiScreen { } } } - } -- cgit From 0401cb030a57765eb5d0eff36453add731b69e03 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 21 Aug 2021 14:11:39 +0200 Subject: only show waypoints when in mines of divan --- build.gradle | 1 + .../notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java | 3 ++- .../java/io/github/moulberry/notenoughupdates/util/SBInfo.java | 7 ++++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 5d6d03cf..f2620a00 100644 --- a/build.gradle +++ b/build.gradle @@ -28,6 +28,7 @@ group= "io.github.moulberry" archivesBaseName = "NotEnoughUpdates" String modid = "notenoughupdates" String mixinClassifier = "dep" +compileJava.options.encoding = 'UTF-8' minecraft { version = "1.8.9-11.15.1.2318-1.8.9" diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 357d8326..73e2b412 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -81,7 +81,8 @@ public class CrystalMetalDetectorSolver { } public static void render(float partialTicks) { - if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows")) { + if (SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows") && + SBInfo.getInstance().location.equals("Mines of Divan")) { if (possibleBlocks.size() == 1) { RenderUtils.renderWayPoint("Treasure", possibleBlocks.get(0).add(0, 2.5, 0), partialTicks); } else if (possibleBlocks.size() > 1 && NotEnoughUpdates.INSTANCE.config.mining.metalDetectorShowPossible) { 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 243ee151..c837fc5f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -194,7 +194,12 @@ public class SBInfo { currentTimeDate = parseFormat.parse(timeSpace); } catch (ParseException e) {} } - location = Utils.cleanColour(lines.get(3)).replaceAll("[^A-Za-z0-9() ]", "").trim(); + //Replaced with for loop because in crystal hollows with events the line it's on can shift. + for (String line : lines){ + if (line.contains("⏣")) { + location = Utils.cleanColour(line).replaceAll("[^A-Za-z0-9() ]", "").trim(); + } + } } objective = null; -- cgit From ce968641b42be85e0b308ecb95a435d7b2b97b3d Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 21 Aug 2021 18:16:11 +0200 Subject: Fix experimentation table timer detection not working if you finished all experimentations for the day --- .../notenoughupdates/overlays/TimersOverlay.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) 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 39bc0b60..baa407c9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -1,5 +1,6 @@ package io.github.moulberry.notenoughupdates.overlays; +import io.github.moulberry.notenoughupdates.NEUManager; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.options.NEUConfig; @@ -13,6 +14,8 @@ import net.minecraft.init.Items; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.client.event.ClientChatReceivedEvent; import net.minecraftforge.fml.common.eventhandler.EventPriority; @@ -190,11 +193,22 @@ public class TimersOverlay extends TextOverlay { if (stack.getItem() == Items.blaze_powder) { if (hidden.experimentsCompleted == 0) { hidden.experimentsCompleted = currentTime; + return; } - } else { - hidden.experimentsCompleted = 0; } } + ItemStack stackSuperPairs = lower.getStackInSlot(22); + if(stackSuperPairs != null && stackSuperPairs.getItem() == Items.skull && stackSuperPairs.getTagCompound() != null){ + String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stackSuperPairs.getTagCompound()); + String text = lore[lore.length-1]; + String cleanText = Utils.cleanColour(text); + if(cleanText.equals("Experiments on cooldown!")){ + hidden.experimentsCompleted = currentTime; + return; + } + } + hidden.experimentsCompleted = 0; + return; } } -- cgit From 3b88fe9207828d4292b3d666d966c58c139c7aeb Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 21 Aug 2021 20:19:12 +0200 Subject: done --- .../notenoughupdates/NEUEventListener.java | 2 + .../notenoughupdates/options/NEUConfig.java | 3 +- .../options/seperateSections/Mining.java | 126 +++++++++++++++ .../overlays/AutomatonOverlay.java | 169 +++++++++++++++++++++ .../notenoughupdates/overlays/OverlayManager.java | 17 ++- .../notenoughupdates/overlays/TimersOverlay.java | 4 +- 6 files changed, 318 insertions(+), 3 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 0f45eb1a..8c668da0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -836,6 +836,8 @@ public class NEUEventListener { if (unformatted.startsWith("You found ") && SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows")){ CrystalMetalDetectorSolver.reset(); } + if(unformatted.startsWith("[NPC] Professor Robot: ") || unformatted.startsWith(" ")) + OverlayManager.automatonOverlay.message(unformatted); } public static boolean drawingGuiScreen = 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 a839b3a2..3aca1041 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -85,7 +85,8 @@ public class NEUConfig extends Config { case 9: editOverlay(activeConfigCategory, OverlayManager.bonemerangOverlay, itemOverlays.bonemerangPosition); return; - + case 10: + editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.automatonOverlayPosition); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index 2c05b462..3d5c0b09 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -165,6 +165,132 @@ public class Mining { @ConfigAccordionId(id = 3) public boolean metalDetectorShowPossible = false; + @ConfigOption( + name = "Automaton Parts Overlay", + desc = "" + ) + @ConfigEditorAccordion(id = 4) + public boolean automatonOverlayAccordion = false; + + @Expose + @ConfigOption( + name = "Enabled", + desc = "Enables the Automaton parts overlay." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 4) + public boolean automatonOverlay = true; + + @Expose + @ConfigOption( + name = "Position", + desc = "Change the position of the Automaton parts overlay." + ) + @ConfigEditorButton( + runnableId = 10, + buttonText = "Edit" + ) + @ConfigAccordionId(id = 4) + public Position automatonOverlayPosition = new Position(200, 0); + + @Expose + @ConfigOption( + name = "Style", + desc = "Change the style of the Automaton parts overlay." + ) + @ConfigEditorDropdown( + values = {"Background", "No Shadow", "Shadow", "Full Shadow"} + ) + @ConfigAccordionId(id = 4) + public int automatonOverlayStyle = 0; + + @Expose + @ConfigOption( + name = "Show Icons", + desc = "Show icons in the overlay that represent the part." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 4) + public boolean automatonIcons = true; + + + @Expose + @ConfigOption( + name = "Hide Done", + desc = "Don't show parts you've given to Professor Robot." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 4) + public boolean automatonHideDone = false; + + @ConfigOption( + name = "Colours", + desc = "" + ) + @ConfigEditorAccordion(id = 5) + @ConfigAccordionId(id = 4) + public boolean AutomatonColourAccordion = false; + + @Expose + @ConfigOption( + name = "Part colour", + desc = "Change the colour of the part text." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 5) + public int automatonPartColor = 3; + + @Expose + @ConfigOption( + name = "Ready colour", + desc = "Change the colour when the part is given to Professor Robot." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 5) + public int automatonDoneColor = 10; + + @Expose + @ConfigOption( + name = "In Inventory Color", + desc = "Change the colour when the part is in the inventory." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 5) + public int automatonInventoryColor = 14; + + @Expose + @ConfigOption( + name = "In Storage Color", + desc = "Change the colour when the part is in the storage." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 5) + public int automatonStorageColor = 14; + + @Expose + @ConfigOption( + name = "Missing Color", + desc = "Change the colour when the part is missing." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 5) + public int automatonMissingColor = 12; + @Expose @ConfigOption( name = "Puzzler Solver", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java new file mode 100644 index 00000000..981f269e --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java @@ -0,0 +1,169 @@ +package io.github.moulberry.notenoughupdates.overlays; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.config.Position; +import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; +import io.github.moulberry.notenoughupdates.util.SBInfo; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.util.vector.Vector2f; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class AutomatonOverlay extends TextOverlay { + private static final HashMap items; + private static final Minecraft mc = Minecraft.getMinecraft(); + private final StorageManager storageManager = StorageManager.getInstance(); + private final Pattern givePattern = Pattern.compile("\\[NPC] Professor Robot: Thanks for bringing me the (?[a-zA-Z0-9 ]+)! Bring me (\\d+|one) more components? to fix the giant!"); + private final Pattern notFinalPattern = Pattern.compile("\\[NPC] Professor Robot: That's not the final component! Bring me a (?[a-zA-Z0-9 ]+) to gain access to Automaton Prime's storage container!"); + + static { + items = new HashMap<>(); + items.put("Electron Transmitter", false); + items.put("FTX 3070", false); + items.put("Robotron Reflector", false); + items.put("Superlite Motor", false); + items.put("Control Switch", false); + items.put("Synthetic Heart", false); + } + + public AutomatonOverlay(Position position, Supplier> dummyStrings, Supplier styleSupplier) { + super(position, dummyStrings, styleSupplier); + } + + @Override + public void update() { + overlayStrings = null; + if (!NotEnoughUpdates.INSTANCE.config.mining.automatonOverlay || SBInfo.getInstance().getLocation() == null || + !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Lost Precursor City")) + return; + + overlayStrings = new ArrayList<>(); + HashMap states = new HashMap<>(); + for (String key : items.keySet()) { + Boolean has = items.get(key); + if (has) + states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonDoneColor] + "Done"); + /*else + states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonMissingColor] + "Missing");*/ + } + for (ItemStack item : mc.thePlayer.inventory.mainInventory) { + if (item != null) { + String name = Utils.cleanColour(item.getDisplayName()); + if (!states.containsKey(name)) { + states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonInventoryColor] + "In Inventory"); + } + } + } + for (Map.Entry entry : storageManager.storageConfig.displayToStorageIdMap.entrySet()) { + int storageId = entry.getValue(); + StorageManager.StoragePage page = storageManager.getPage(storageId, false); + if (page != null && page.rows > 0) { + for (ItemStack item : page.items) { + if (item != null) { + String name = Utils.cleanColour(item.getDisplayName()); + if (!states.containsKey(name)) { + states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonStorageColor] + "In Storage"); + } + } + } + } + } + for (String key : items.keySet()) { + if (!NotEnoughUpdates.INSTANCE.config.mining.automatonHideDone || !items.get(key)) { + if (!states.containsKey(key)) + states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonMissingColor] + "Missing"); + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonPartColor] + key + ": " + states.get(key)); + } + } + } + + public void message(String message) { + if (message.startsWith(" ")) { + String item = message.replace(" ", ""); + if (items.containsKey(item)) { + items.put(item, false); + } + } else if (message.startsWith("[NPC] Professor Robot: ")) { + if (message.equals("[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:")) { + items.replaceAll((k, v) -> true); + } else if (message.equals("[NPC] Professor Robot: You've brought me all of the components!")) { + items.replaceAll((k, v) -> false); + } else { + Matcher giveMatcher = givePattern.matcher(message); + Matcher notFinalMatcher = notFinalPattern.matcher(message); + if (giveMatcher.matches()) { + String item = giveMatcher.group("part"); + if (items.containsKey(item)) { + items.put(item, true); + } + } else if (notFinalMatcher.matches()) { + String item = notFinalMatcher.group("part"); + if (items.containsKey(item)) { + items.replaceAll((k, v) -> true); + items.put(item, false); + } + } + } + } + } + + @Override + protected void renderLine(String line, Vector2f position, boolean dummy) { + if (!NotEnoughUpdates.INSTANCE.config.mining.automatonIcons) return; + GlStateManager.enableDepth(); + + ItemStack icon = null; + String cleaned = Utils.cleanColour(line); + String beforeColon = cleaned.split(":")[0]; + switch (beforeColon) { + case "Electron Transmitter": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ELECTRON_TRANSMITTER")); + break; + case "FTX 3070": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("FTX_3070")); + break; + case "Robotron Reflector": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ROBOTRON_REFLECTOR")); + break; + case "Superlite Motor": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SUPERLITE_MOTOR")); + break; + case "Control Switch": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("CONTROL_SWITCH")); + break; + case "Synthetic Heart": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SYNTHETIC_HEART")); + break; + } + + if (icon != null) { + GlStateManager.pushMatrix(); + GlStateManager.translate(position.x - 2, position.y - 2, 0); + GlStateManager.scale(0.7f, 0.7f, 1f); + Utils.drawItemStack(icon, 0, 0); + GlStateManager.popMatrix(); + + position.x += 12; + } + + super.renderLine(line, position, dummy); + } + + @Override + protected Vector2f getSize(List strings) { + if (NotEnoughUpdates.INSTANCE.config.mining.automatonIcons) + return super.getSize(strings).translate(12, 0); + return super.getSize(strings); + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java index 3c1f2e3a..a08eef1e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -16,6 +16,7 @@ public class OverlayManager { public static PetInfoOverlay petInfoOverlay; public static TimersOverlay timersOverlay; public static BonemerangOverlay bonemerangOverlay; + public static AutomatonOverlay automatonOverlay; public static final List textOverlays = new ArrayList<>(); static { @@ -120,13 +121,27 @@ public class OverlayManager { } return TextOverlayStyle.BACKGROUND; }); + List automatonOverlayDummy = Lists.newArrayList( + "\u00a73Electron Transmitter: \u00a7aDone", + "\u00a73Robotron Reflector: \u00a7eIn Storage", + "\u00a73Superlite Motor: \u00a7eIn Inventory", + "\u00a73Synthetic Hearth: \u00a7cMissing", + "\u00a73Control Switch: \u00a7cMissing", + "\u00a73FTX 3070: \u00a7cMissing"); + automatonOverlay = new AutomatonOverlay(NotEnoughUpdates.INSTANCE.config.mining.automatonOverlayPosition, () -> automatonOverlayDummy, () -> { + int style = NotEnoughUpdates.INSTANCE.config.mining.automatonOverlayStyle; + if(style >= 0 && style < TextOverlayStyle.values().length) { + return TextOverlayStyle.values()[style]; + } + return TextOverlayStyle.BACKGROUND; + }); textOverlays.add(miningOverlay); textOverlays.add(farmingOverlay); textOverlays.add(petInfoOverlay); textOverlays.add(bonemerangOverlay); - + textOverlays.add(automatonOverlay); } } 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 39bc0b60..0d111762 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -82,7 +82,9 @@ public class TimersOverlay extends TextOverlay { @Override protected Vector2f getSize(List strings) { - return super.getSize(strings).translate(12, 0); + if(NotEnoughUpdates.INSTANCE.config.miscOverlays.todoIcons) + return super.getSize(strings).translate(12, 0); + return super.getSize(strings); } private static final ItemStack CAKES_ICON = new ItemStack(Items.cake); -- cgit From 4572fcceafb87b1c24563f6fd161662899c455db Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 21 Aug 2021 20:24:05 +0200 Subject: Update SBInfo.java --- src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java | 1 + 1 file changed, 1 insertion(+) 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 c837fc5f..e41ef78d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SBInfo.java @@ -198,6 +198,7 @@ public class SBInfo { for (String line : lines){ if (line.contains("⏣")) { location = Utils.cleanColour(line).replaceAll("[^A-Za-z0-9() ]", "").trim(); + break; } } } -- cgit From 2ee79cb1767dab9550a87ca5208452758a100932 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sat, 21 Aug 2021 20:29:23 +0200 Subject: remove comment oops --- .../io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java index 981f269e..bbdb4786 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java @@ -54,8 +54,6 @@ public class AutomatonOverlay extends TextOverlay { Boolean has = items.get(key); if (has) states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonDoneColor] + "Done"); - /*else - states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonMissingColor] + "Missing");*/ } for (ItemStack item : mc.thePlayer.inventory.mainInventory) { if (item != null) { -- cgit From 6d886c664d34a30e67e450e9af6c88f9466376e8 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 22 Aug 2021 10:17:12 +0200 Subject: "fix" fetchur item predictor showing the wrong item until hypixel changes it again --- .../io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java | 3 +++ 1 file changed, 3 insertions(+) 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 f8ae54f8..c3e33a83 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -135,6 +135,9 @@ public class TimersOverlay extends TextOverlay { ZonedDateTime currentTimeEST = ZonedDateTime.now(ZoneId.of("America/Atikokan")); long fetchurIndex = (currentTimeEST.getDayOfMonth() % 13)-1; + //Added because disabled fetchur and enabled it again but it was showing the wrong item + //Lets see if this stays correct + fetchurIndex+=2; if(fetchurIndex < 0) fetchurIndex += 13; icon = FETCHUR_ICONS[(int)fetchurIndex]; -- cgit From e176ed76f756be322d1f866375e054f0cd438885 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 22 Aug 2021 12:13:12 +0200 Subject: fix storage overlay nullpointer crash --- .../io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index 91ac5e6f..6b459ecb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -594,14 +594,14 @@ public class StorageOverlay extends GuiElement { if(coords.y-11 > 3+storageViewSize || coords.y+90 < 3) continue; StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false); - + if(editingNameId == storageId) { int len = fontRendererObj.getStringWidth(renameStorageField.getTextDisplay())+10; renameStorageField.setSize(len, 12); renameStorageField.render(storageX, storageY-13); } else { String pageTitle; - if(page.customTitle != null && !page.customTitle.isEmpty()) { + if(page != null && page.customTitle != null && !page.customTitle.isEmpty()) { pageTitle = Utils.chromaStringByColourCode(page.customTitle); } else if(entry.getValue() < 9) { pageTitle = "Ender Chest Page " + (entry.getValue() + 1); -- cgit From 6e5730be493996fd5a6bebd0c7b9bb87e6b6b31c Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 22 Aug 2021 12:38:54 +0200 Subject: Fix not being able to dye via neucustomize undyed leather armour --- .../io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java index 07f1340d..fb0deaaf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java @@ -68,7 +68,7 @@ public class GuiItemCustomize extends GuiScreen { this.enchantGlint = stackHasEffect; } - supportCustomLeatherColour = stack.getItem() instanceof ItemArmor && ((ItemArmor)stack.getItem()).hasColor(stack); + supportCustomLeatherColour = stack.getItem() instanceof ItemArmor && ((ItemArmor) stack.getItem()).getArmorMaterial() == ItemArmor.ArmorMaterial.LEATHER; enchantGlintCustomColourAnimation.setValue(enchantGlint ? 17 : 0); this.enchantGlintButton = new GuiElementBoolean(0, 0, enchantGlint, (bool) -> { -- cgit From 665bb67fbcf88315b046e8d0d1bb8a040c207b6d Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 22 Aug 2021 12:39:50 +0200 Subject: Update changelog --- Update Notes/2.0-Pre31.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index bd0360f3..fb452773 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -3,6 +3,8 @@ ### **Major new features** - Added divan's mines metal detector waypoints (DeDiamondPro) +- Added divan's mines required items overlay (DeDiamondPro) +- Added lost precusor city required items overlay (DeDiamondPro) ### **New Features:** - Added Ferocity, Magic find, Mining speed and mining fortune to Accessory bag (and ferocity and magic find to /pv). @@ -59,6 +61,8 @@ - Stopped tooltip tweak rawcraftcost displaying if the cost was 0 (either due to the price being really low or api issue). - Added a catch to the capemanger slow to catch duplicate players (https://hst.sh/enuvamecef) (idk how but hey its there now). - Fix being able to hotkey slotlocked items in a chest gui. +- (Hopefully) Fix storage overlay nullpointer crash. +- Fix not being able to dye undyed leather armour. ### **Other** - Code clean up by Ironm00n. -- cgit From 6899df634766e2a8666ac7f45cac1008da140c4e Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 22 Aug 2021 16:28:33 +0200 Subject: Mines of Divan overlay --- .../notenoughupdates/NEUEventListener.java | 2 + .../notenoughupdates/options/NEUConfig.java | 3 + .../options/seperateSections/Mining.java | 126 ++++++++++++++++++ .../overlays/AutomatonOverlay.java | 43 ++++--- .../overlays/DivanMinesOverlay.java | 143 +++++++++++++++++++++ .../notenoughupdates/overlays/OverlayManager.java | 16 ++- 6 files changed, 313 insertions(+), 20 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 8c668da0..4f565fa6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -838,6 +838,8 @@ public class NEUEventListener { } if(unformatted.startsWith("[NPC] Professor Robot: ") || unformatted.startsWith(" ")) OverlayManager.automatonOverlay.message(unformatted); + else if(unformatted.startsWith("[NPC] Keeper of ")) + OverlayManager.divanMinesOverlay.message(unformatted); } public static boolean drawingGuiScreen = 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 3aca1041..380ca674 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -87,6 +87,9 @@ public class NEUConfig extends Config { return; case 10: editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.automatonOverlayPosition); + return; + case 11: + editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.divanMinesOverlayPosition); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index 3d5c0b09..e8f06eca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -291,6 +291,132 @@ public class Mining { @ConfigAccordionId(id = 5) public int automatonMissingColor = 12; + @ConfigOption( + name = "Mines of Divan overlay", + desc = "" + ) + @ConfigEditorAccordion(id = 6) + public boolean divanMinesOverlayAccordion = false; + + @Expose + @ConfigOption( + name = "Enabled", + desc = "Enables the Mines of Divan overlay." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 6) + public boolean divanMinesOverlay = true; + + @Expose + @ConfigOption( + name = "Position", + desc = "Change the position of the AMines of Divan overlay." + ) + @ConfigEditorButton( + runnableId = 11, + buttonText = "Edit" + ) + @ConfigAccordionId(id = 6) + public Position divanMinesOverlayPosition = new Position(200, 0); + + @Expose + @ConfigOption( + name = "Style", + desc = "Change the style of the Mines of Divan overlay." + ) + @ConfigEditorDropdown( + values = {"Background", "No Shadow", "Shadow", "Full Shadow"} + ) + @ConfigAccordionId(id = 6) + public int divanMinesOverlayStyle = 0; + + @Expose + @ConfigOption( + name = "Show Icons", + desc = "Show icons in the overlay that represent the part." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 6) + public boolean divanMinesIcons = true; + + + @Expose + @ConfigOption( + name = "Hide Done", + desc = "Don't show parts you've given to the Keepers." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 6) + public boolean divanMinesHideDone = false; + + @ConfigOption( + name = "Colours", + desc = "" + ) + @ConfigEditorAccordion(id = 7) + @ConfigAccordionId(id = 6) + public boolean divanMinesColourAccordion = false; + + @Expose + @ConfigOption( + name = "Part colour", + desc = "Change the colour of the part text." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 7) + public int divanMinesPartColor = 3; + + @Expose + @ConfigOption( + name = "Ready colour", + desc = "Change the colour when the part is given to the Keepers." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 7) + public int divanMinesDoneColor = 10; + + @Expose + @ConfigOption( + name = "In Inventory Color", + desc = "Change the colour when the part is in the inventory." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 7) + public int divanMinesInventoryColor = 14; + + @Expose + @ConfigOption( + name = "In Storage Color", + desc = "Change the colour when the part is in the storage." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 7) + public int divanMinesStorageColor = 14; + + @Expose + @ConfigOption( + name = "Missing Color", + desc = "Change the colour when the part is missing." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 7) + public int divanMinesMissingColor = 12; + @Expose @ConfigOption( name = "Puzzler Solver", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java index bbdb4786..e214b1c0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java @@ -7,7 +7,6 @@ import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; import org.lwjgl.util.vector.Vector2f; @@ -93,25 +92,31 @@ public class AutomatonOverlay extends TextOverlay { items.put(item, false); } } else if (message.startsWith("[NPC] Professor Robot: ")) { - if (message.equals("[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:")) { - items.replaceAll((k, v) -> true); - } else if (message.equals("[NPC] Professor Robot: You've brought me all of the components!")) { - items.replaceAll((k, v) -> false); - } else { - Matcher giveMatcher = givePattern.matcher(message); - Matcher notFinalMatcher = notFinalPattern.matcher(message); - if (giveMatcher.matches()) { - String item = giveMatcher.group("part"); - if (items.containsKey(item)) { - items.put(item, true); - } - } else if (notFinalMatcher.matches()) { - String item = notFinalMatcher.group("part"); - if (items.containsKey(item)) { - items.replaceAll((k, v) -> true); - items.put(item, false); + switch (message) { + case "[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:": + items.replaceAll((k, v) -> true); + break; + case "[NPC] Professor Robot: You've brought me all of the components!": + case "[NPC] Professor Robot: You haven't placed the Sapphire Crystal yet!": + case "[NPC] Professor Robot: You have already placed the Sapphire Crystal!": + items.replaceAll((k, v) -> false); + break; + default: + Matcher giveMatcher = givePattern.matcher(message); + Matcher notFinalMatcher = notFinalPattern.matcher(message); + if (giveMatcher.matches()) { + String item = giveMatcher.group("part"); + if (items.containsKey(item)) { + items.put(item, true); + } + } else if (notFinalMatcher.matches()) { + String item = notFinalMatcher.group("part"); + if (items.containsKey(item)) { + items.replaceAll((k, v) -> true); + items.put(item, false); + } } - } + break; } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java new file mode 100644 index 00000000..d6ec1d98 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java @@ -0,0 +1,143 @@ +package io.github.moulberry.notenoughupdates.overlays; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.config.Position; +import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; +import io.github.moulberry.notenoughupdates.util.SBInfo; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.util.vector.Vector2f; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class DivanMinesOverlay extends TextOverlay { + private static final HashMap items; + private static final Minecraft mc = Minecraft.getMinecraft(); + private final StorageManager storageManager = StorageManager.getInstance(); + private final Pattern notFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Talk to me when you have found a (?[a-z-A-Z ]+)!"); + private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (Excellent! You have returned the|You have already restored this Dwarf's) (?[a-z-A-Z ]+)(!| to its rightful place!)"); + private final Pattern resetPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (You haven't placed the Jade Crystal yet!|You found all of the items! Behold\\.\\.\\. the Jade Crystal!|You have already placed the Jade Crystal!)"); + + static { + items = new HashMap<>(); + items.put("Scavenged Lapis Sword", false); + items.put("Scavenged Golden Hammer", false); + items.put("Scavenged Diamond Axe", false); + items.put("Scavenged Emerald Hammer", false); + } + + public DivanMinesOverlay(Position position, Supplier> dummyStrings, Supplier styleSupplier) { + super(position, dummyStrings, styleSupplier); + } + + @Override + public void update() { + overlayStrings = null; + if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlay || SBInfo.getInstance().getLocation() == null || + !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Mines of Divan")) + return; + + overlayStrings = new ArrayList<>(); + HashMap states = new HashMap<>(); + for (String key : items.keySet()) { + Boolean has = items.get(key); + if (has) + states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesDoneColor] + "Done"); + } + for (ItemStack item : mc.thePlayer.inventory.mainInventory) { + if (item != null) { + String name = Utils.cleanColour(item.getDisplayName()); + if (!states.containsKey(name)) { + states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesInventoryColor] + "In Inventory"); + } + } + } + for (Map.Entry entry : storageManager.storageConfig.displayToStorageIdMap.entrySet()) { + int storageId = entry.getValue(); + StorageManager.StoragePage page = storageManager.getPage(storageId, false); + if (page != null && page.rows > 0) { + for (ItemStack item : page.items) { + if (item != null) { + String name = Utils.cleanColour(item.getDisplayName()); + if (!states.containsKey(name)) { + states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesStorageColor] + "In Storage"); + } + } + } + } + } + for (String key : items.keySet()) { + if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesHideDone || !items.get(key)) { + if (!states.containsKey(key)) + states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesMissingColor] + "Missing"); + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesPartColor] + key + ": " + states.get(key)); + } + } + } + + public void message(String message) { + Matcher foundMatcher = foundPattern.matcher(message); + Matcher notFoundMatcher = notFoundPattern.matcher(message); + Matcher resetMatcher = resetPattern.matcher(message); + System.out.println(message); + if (foundMatcher.matches() && items.containsKey(foundMatcher.group("item"))) { + items.put(foundMatcher.group("item"), true); + } else if (notFoundMatcher.matches() && items.containsKey(notFoundMatcher.group("item"))) { + items.put(notFoundMatcher.group("item"), false); + } else if (resetMatcher.matches()) { + items.replaceAll((k, v) -> false); + } + } + + @Override + protected void renderLine(String line, Vector2f position, boolean dummy) { + if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesIcons) return; + GlStateManager.enableDepth(); + + ItemStack icon = null; + String cleaned = Utils.cleanColour(line); + String beforeColon = cleaned.split(":")[0]; + switch (beforeColon) { + case "Scavenged Lapis Sword": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_LAPIS_SWORD")); + break; + case "Scavenged Golden Hammer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_GOLD_HAMMER")); + break; + case "Scavenged Diamond Axe": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_DIAMOND_AXE")); + break; + case "Scavenged Emerald Hammer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_EMERALD_HAMMER")); + break; + } + + if (icon != null) { + GlStateManager.pushMatrix(); + GlStateManager.translate(position.x, position.y, 0); + GlStateManager.scale(0.5f, 0.5f, 1f); + Utils.drawItemStack(icon, 0, 0); + GlStateManager.popMatrix(); + + position.x += 12; + } + + super.renderLine(line, position, dummy); + } + + @Override + protected Vector2f getSize(List strings) { + if (NotEnoughUpdates.INSTANCE.config.mining.divanMinesIcons) + return super.getSize(strings).translate(12, 0); + return super.getSize(strings); + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java index a08eef1e..0aa0d273 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -17,6 +17,7 @@ public class OverlayManager { public static TimersOverlay timersOverlay; public static BonemerangOverlay bonemerangOverlay; public static AutomatonOverlay automatonOverlay; + public static DivanMinesOverlay divanMinesOverlay; public static final List textOverlays = new ArrayList<>(); static { @@ -135,13 +136,26 @@ public class OverlayManager { } return TextOverlayStyle.BACKGROUND; }); - + List divanMinesOverlayDummy = Lists.newArrayList( + "\u00a73Scavenged Lapis Sword: \u00a7aDone", + "\u00a73Scavenged Golden Hammer: \u00a7eIn Storage", + "\u00a73Scavenged Diamond Axe: \u00a7eIn Inventory", + "\u00a73Scavenged Emerald Hammer: \u00a7cMissing" + ); + divanMinesOverlay = new DivanMinesOverlay(NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlayPosition, () -> divanMinesOverlayDummy, () -> { + int style = NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlayStyle; + if(style >= 0 && style < TextOverlayStyle.values().length) { + return TextOverlayStyle.values()[style]; + } + return TextOverlayStyle.BACKGROUND; + }); textOverlays.add(miningOverlay); textOverlays.add(farmingOverlay); textOverlays.add(petInfoOverlay); textOverlays.add(bonemerangOverlay); textOverlays.add(automatonOverlay); + textOverlays.add(divanMinesOverlay); } } -- cgit From edaeda189cdad59fbb905a7c67d7b2350976b4eb Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 22 Aug 2021 16:40:43 +0200 Subject: fix --- .../notenoughupdates/overlays/DivanMinesOverlay.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java index d6ec1d98..c1a1d227 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java @@ -24,8 +24,9 @@ public class DivanMinesOverlay extends TextOverlay { private static final Minecraft mc = Minecraft.getMinecraft(); private final StorageManager storageManager = StorageManager.getInstance(); private final Pattern notFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Talk to me when you have found a (?[a-z-A-Z ]+)!"); - private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (Excellent! You have returned the|You have already restored this Dwarf's) (?[a-z-A-Z ]+)(!| to its rightful place!)"); + private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Excellent! You have returned the (?[a-z-A-Z ]+) to its rightful place!"); private final Pattern resetPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (You haven't placed the Jade Crystal yet!|You found all of the items! Behold\\.\\.\\. the Jade Crystal!|You have already placed the Jade Crystal!)"); + private final Pattern alreadyFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: You have already restored this Dwarf's (?[a-z-A-Z ]+)!"); static { items = new HashMap<>(); @@ -86,16 +87,18 @@ public class DivanMinesOverlay extends TextOverlay { public void message(String message) { Matcher foundMatcher = foundPattern.matcher(message); + Matcher alreadyFoundMatcher = alreadyFoundPattern.matcher(message); Matcher notFoundMatcher = notFoundPattern.matcher(message); Matcher resetMatcher = resetPattern.matcher(message); System.out.println(message); - if (foundMatcher.matches() && items.containsKey(foundMatcher.group("item"))) { + if (foundMatcher.matches() && items.containsKey(foundMatcher.group("item"))) items.put(foundMatcher.group("item"), true); - } else if (notFoundMatcher.matches() && items.containsKey(notFoundMatcher.group("item"))) { + else if (notFoundMatcher.matches() && items.containsKey(notFoundMatcher.group("item"))) items.put(notFoundMatcher.group("item"), false); - } else if (resetMatcher.matches()) { + else if (resetMatcher.matches()) items.replaceAll((k, v) -> false); - } + else if (alreadyFoundMatcher.matches() && items.containsKey(alreadyFoundMatcher.group("item"))) + items.put(alreadyFoundMatcher.group("item"), true); } @Override -- cgit From abcef8532470e4b39fd3ef0021495c3e40073ed8 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 22 Aug 2021 17:48:11 +0200 Subject: saving --- .../notenoughupdates/options/NEUConfig.java | 20 ++++++++++- .../overlays/AutomatonOverlay.java | 40 +++++++++------------- .../overlays/DivanMinesOverlay.java | 34 ++++++++---------- 3 files changed, 49 insertions(+), 45 deletions(-) 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 380ca674..25f4dcd2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -328,7 +328,7 @@ public class NEUConfig extends Config { public static class HiddenProfileSpecific { - @Expose public long godPotionDuration = 0l; + @Expose public long godPotionDuration = 0L; @Expose public long puzzlerCompleted = 0L; @Expose public long firstCakeAte = 0L; @Expose public long fetchurCompleted = 0L; @@ -337,6 +337,24 @@ public class NEUConfig extends Config { @Expose public long cookieBuffRemaining = 0L; @Expose public int commissionMilestone = 0; + + @Expose public HashMap automatonParts = new HashMap<>(); + + @Expose public HashMap divanMinesParts = new HashMap<>(); + + public HiddenProfileSpecific(){ + automatonParts.putIfAbsent("Electron Transmitter", false); + automatonParts.putIfAbsent("FTX 3070", false); + automatonParts.putIfAbsent("Robotron Reflector", false); + automatonParts.putIfAbsent("Superlite Motor", false); + automatonParts.putIfAbsent("Control Switch", false); + automatonParts.putIfAbsent("Synthetic Heart", false); + + divanMinesParts.putIfAbsent("Scavenged Lapis Sword", false); + divanMinesParts.putIfAbsent("Scavenged Golden Hammer", false); + divanMinesParts.putIfAbsent("Scavenged Diamond Axe", false); + divanMinesParts.putIfAbsent("Scavenged Emerald Hammer", false); + } } public static List createDefaultInventoryButtons() { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java index e214b1c0..878bbc44 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.overlays; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; +import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -20,28 +21,18 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class AutomatonOverlay extends TextOverlay { - private static final HashMap items; private static final Minecraft mc = Minecraft.getMinecraft(); private final StorageManager storageManager = StorageManager.getInstance(); private final Pattern givePattern = Pattern.compile("\\[NPC] Professor Robot: Thanks for bringing me the (?[a-zA-Z0-9 ]+)! Bring me (\\d+|one) more components? to fix the giant!"); private final Pattern notFinalPattern = Pattern.compile("\\[NPC] Professor Robot: That's not the final component! Bring me a (?[a-zA-Z0-9 ]+) to gain access to Automaton Prime's storage container!"); - static { - items = new HashMap<>(); - items.put("Electron Transmitter", false); - items.put("FTX 3070", false); - items.put("Robotron Reflector", false); - items.put("Superlite Motor", false); - items.put("Control Switch", false); - items.put("Synthetic Heart", false); - } - public AutomatonOverlay(Position position, Supplier> dummyStrings, Supplier styleSupplier) { super(position, dummyStrings, styleSupplier); } @Override public void update() { + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); overlayStrings = null; if (!NotEnoughUpdates.INSTANCE.config.mining.automatonOverlay || SBInfo.getInstance().getLocation() == null || !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Lost Precursor City")) @@ -49,8 +40,8 @@ public class AutomatonOverlay extends TextOverlay { overlayStrings = new ArrayList<>(); HashMap states = new HashMap<>(); - for (String key : items.keySet()) { - Boolean has = items.get(key); + for (String key : hidden.automatonParts.keySet()) { + Boolean has = hidden.automatonParts.get(key); if (has) states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonDoneColor] + "Done"); } @@ -76,8 +67,8 @@ public class AutomatonOverlay extends TextOverlay { } } } - for (String key : items.keySet()) { - if (!NotEnoughUpdates.INSTANCE.config.mining.automatonHideDone || !items.get(key)) { + for (String key : hidden.automatonParts.keySet()) { + if (!NotEnoughUpdates.INSTANCE.config.mining.automatonHideDone || !hidden.automatonParts.get(key)) { if (!states.containsKey(key)) states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonMissingColor] + "Missing"); overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonPartColor] + key + ": " + states.get(key)); @@ -86,34 +77,35 @@ public class AutomatonOverlay extends TextOverlay { } public void message(String message) { + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); if (message.startsWith(" ")) { String item = message.replace(" ", ""); - if (items.containsKey(item)) { - items.put(item, false); + if (hidden.automatonParts.containsKey(item)) { + hidden.automatonParts.put(item, false); } } else if (message.startsWith("[NPC] Professor Robot: ")) { switch (message) { case "[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:": - items.replaceAll((k, v) -> true); + hidden.automatonParts.replaceAll((k, v) -> true); break; case "[NPC] Professor Robot: You've brought me all of the components!": case "[NPC] Professor Robot: You haven't placed the Sapphire Crystal yet!": case "[NPC] Professor Robot: You have already placed the Sapphire Crystal!": - items.replaceAll((k, v) -> false); + hidden.automatonParts.replaceAll((k, v) -> false); break; default: Matcher giveMatcher = givePattern.matcher(message); Matcher notFinalMatcher = notFinalPattern.matcher(message); if (giveMatcher.matches()) { String item = giveMatcher.group("part"); - if (items.containsKey(item)) { - items.put(item, true); + if (hidden.automatonParts.containsKey(item)) { + hidden.automatonParts.put(item, true); } } else if (notFinalMatcher.matches()) { String item = notFinalMatcher.group("part"); - if (items.containsKey(item)) { - items.replaceAll((k, v) -> true); - items.put(item, false); + if (hidden.automatonParts.containsKey(item)) { + hidden.automatonParts.replaceAll((k, v) -> true); + hidden.automatonParts.put(item, false); } } break; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java index c1a1d227..7bf359c2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java @@ -3,6 +3,7 @@ package io.github.moulberry.notenoughupdates.overlays; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; +import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -20,7 +21,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class DivanMinesOverlay extends TextOverlay { - private static final HashMap items; private static final Minecraft mc = Minecraft.getMinecraft(); private final StorageManager storageManager = StorageManager.getInstance(); private final Pattern notFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Talk to me when you have found a (?[a-z-A-Z ]+)!"); @@ -28,14 +28,6 @@ public class DivanMinesOverlay extends TextOverlay { private final Pattern resetPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (You haven't placed the Jade Crystal yet!|You found all of the items! Behold\\.\\.\\. the Jade Crystal!|You have already placed the Jade Crystal!)"); private final Pattern alreadyFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: You have already restored this Dwarf's (?[a-z-A-Z ]+)!"); - static { - items = new HashMap<>(); - items.put("Scavenged Lapis Sword", false); - items.put("Scavenged Golden Hammer", false); - items.put("Scavenged Diamond Axe", false); - items.put("Scavenged Emerald Hammer", false); - } - public DivanMinesOverlay(Position position, Supplier> dummyStrings, Supplier styleSupplier) { super(position, dummyStrings, styleSupplier); } @@ -47,10 +39,11 @@ public class DivanMinesOverlay extends TextOverlay { !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Mines of Divan")) return; + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); overlayStrings = new ArrayList<>(); HashMap states = new HashMap<>(); - for (String key : items.keySet()) { - Boolean has = items.get(key); + for (String key : hidden.divanMinesParts.keySet()) { + Boolean has = hidden.divanMinesParts.get(key); if (has) states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesDoneColor] + "Done"); } @@ -76,8 +69,8 @@ public class DivanMinesOverlay extends TextOverlay { } } } - for (String key : items.keySet()) { - if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesHideDone || !items.get(key)) { + for (String key : hidden.divanMinesParts.keySet()) { + if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesHideDone || !hidden.divanMinesParts.get(key)) { if (!states.containsKey(key)) states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesMissingColor] + "Missing"); overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesPartColor] + key + ": " + states.get(key)); @@ -86,19 +79,20 @@ public class DivanMinesOverlay extends TextOverlay { } public void message(String message) { + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); Matcher foundMatcher = foundPattern.matcher(message); Matcher alreadyFoundMatcher = alreadyFoundPattern.matcher(message); Matcher notFoundMatcher = notFoundPattern.matcher(message); Matcher resetMatcher = resetPattern.matcher(message); System.out.println(message); - if (foundMatcher.matches() && items.containsKey(foundMatcher.group("item"))) - items.put(foundMatcher.group("item"), true); - else if (notFoundMatcher.matches() && items.containsKey(notFoundMatcher.group("item"))) - items.put(notFoundMatcher.group("item"), false); + if (foundMatcher.matches() && hidden.divanMinesParts.containsKey(foundMatcher.group("item"))) + hidden.divanMinesParts.put(foundMatcher.group("item"), true); + else if (notFoundMatcher.matches() && hidden.divanMinesParts.containsKey(notFoundMatcher.group("item"))) + hidden.divanMinesParts.put(notFoundMatcher.group("item"), false); else if (resetMatcher.matches()) - items.replaceAll((k, v) -> false); - else if (alreadyFoundMatcher.matches() && items.containsKey(alreadyFoundMatcher.group("item"))) - items.put(alreadyFoundMatcher.group("item"), true); + hidden.divanMinesParts.replaceAll((k, v) -> false); + else if (alreadyFoundMatcher.matches() && hidden.divanMinesParts.containsKey(alreadyFoundMatcher.group("item"))) + hidden.divanMinesParts.put(alreadyFoundMatcher.group("item"), true); } @Override -- cgit From 2ccf69ec446c51f4db1f3a25b4e031593e933048 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 22 Aug 2021 17:55:59 +0200 Subject: oops --- .../java/io/github/moulberry/notenoughupdates/options/NEUConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 25f4dcd2..ee24472f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -89,7 +89,7 @@ public class NEUConfig extends Config { editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.automatonOverlayPosition); return; case 11: - editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.divanMinesOverlayPosition); + editOverlay(activeConfigCategory, OverlayManager.divanMinesOverlay, mining.divanMinesOverlayPosition); } } -- cgit From b4f6ba2cffcf4c9e1a91e3923c4603b581980f29 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 22 Aug 2021 17:59:48 +0200 Subject: off by defualt --- .../moulberry/notenoughupdates/options/seperateSections/Mining.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index e8f06eca..b35704d0 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -179,7 +179,7 @@ public class Mining { ) @ConfigEditorBoolean @ConfigAccordionId(id = 4) - public boolean automatonOverlay = true; + public boolean automatonOverlay = false; @Expose @ConfigOption( @@ -305,7 +305,7 @@ public class Mining { ) @ConfigEditorBoolean @ConfigAccordionId(id = 6) - public boolean divanMinesOverlay = true; + public boolean divanMinesOverlay = false; @Expose @ConfigOption( -- cgit From c974622ac48bbe92621f6297e2eb7cec7df1e17a Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Sun, 22 Aug 2021 19:54:24 +0200 Subject: o no null --- .../github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java | 4 +++- .../github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java index 878bbc44..a0ef88b8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java @@ -32,12 +32,13 @@ public class AutomatonOverlay extends TextOverlay { @Override public void update() { - NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); overlayStrings = null; if (!NotEnoughUpdates.INSTANCE.config.mining.automatonOverlay || SBInfo.getInstance().getLocation() == null || !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Lost Precursor City")) return; + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); + if (hidden == null) return; overlayStrings = new ArrayList<>(); HashMap states = new HashMap<>(); for (String key : hidden.automatonParts.keySet()) { @@ -78,6 +79,7 @@ public class AutomatonOverlay extends TextOverlay { public void message(String message) { NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); + if (hidden == null) return; if (message.startsWith(" ")) { String item = message.replace(" ", ""); if (hidden.automatonParts.containsKey(item)) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java index 7bf359c2..85ac2f82 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java @@ -40,6 +40,7 @@ public class DivanMinesOverlay extends TextOverlay { return; NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); + if (hidden == null) return; overlayStrings = new ArrayList<>(); HashMap states = new HashMap<>(); for (String key : hidden.divanMinesParts.keySet()) { @@ -80,6 +81,7 @@ public class DivanMinesOverlay extends TextOverlay { public void message(String message) { NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); + if (hidden == null) return; Matcher foundMatcher = foundPattern.matcher(message); Matcher alreadyFoundMatcher = alreadyFoundPattern.matcher(message); Matcher notFoundMatcher = notFoundPattern.matcher(message); -- cgit From 97b19369c6cc26705c71e0c7697a1133f5246681 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 22 Aug 2021 22:42:53 +0200 Subject: Fix some text mistakes --- .../options/seperateSections/Mining.java | 38 +++++++++++----------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index b35704d0..0609f970 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -93,7 +93,7 @@ public class Mining { @Expose @ConfigOption( name = "Dwarven Overlay", - desc = "Show an overlay with useful information on the screen while in Dwarven Mines" + desc = "Show an Overlay with useful information on the screen while in Dwarven Mines" ) @ConfigEditorBoolean @ConfigAccordionId(id = 2) @@ -102,8 +102,8 @@ public class Mining { @Expose @ConfigOption( name = "Dwarven Text", - desc = "\u00a7eDrag text to change the appearance of the overlay\n" + - "\u00a7rGo to the Dwarven Mines to show this overlay with useful information" + desc = "\u00a7eDrag text to change the appearance of the Overlay\n" + + "\u00a7rGo to the Dwarven Mines to show this Overlay with useful information" ) @ConfigEditorDraggableList( exampleText = {"\u00a73Goblin Slayer: \u00a7626.5%\n\u00a73Lucky Raffle: \u00a7c0.0%", @@ -119,7 +119,7 @@ public class Mining { @Expose @ConfigOption( name = "Overlay Position", - desc = "Change the position of the Dwarven Mines information overlay (commisions, powder & forge statuses)" + desc = "Change the position of the Dwarven Mines information Overlay (commisions, powder & forge statuses)" ) @ConfigEditorButton( runnableId = 1, @@ -131,7 +131,7 @@ public class Mining { @Expose @ConfigOption( name = "Overlay Style", - desc = "Change the style of the Dwarven Mines information overlay" + desc = "Change the style of the Dwarven Mines information Overlay" ) @ConfigEditorDropdown( values = {"Background", "No Shadow", "Shadow", "Full Shadow"} @@ -148,7 +148,7 @@ public class Mining { @Expose @ConfigOption( - name = "Enabled", + name = "Enable Waypoints", desc = "Enabled the metal detector solver for Mines of Divan, to use this stand still to calculate possible blocks and then if required stand" + " still on another block." ) @@ -174,8 +174,8 @@ public class Mining { @Expose @ConfigOption( - name = "Enabled", - desc = "Enables the Automaton parts overlay." + name = "Enable Overlay", + desc = "Enables the Automaton parts Overlay." ) @ConfigEditorBoolean @ConfigAccordionId(id = 4) @@ -183,8 +183,8 @@ public class Mining { @Expose @ConfigOption( - name = "Position", - desc = "Change the position of the Automaton parts overlay." + name = "Overlay Position", + desc = "Change the position of the Automaton parts Overlay." ) @ConfigEditorButton( runnableId = 10, @@ -196,7 +196,7 @@ public class Mining { @Expose @ConfigOption( name = "Style", - desc = "Change the style of the Automaton parts overlay." + desc = "Change the style of the Automaton parts Overlay." ) @ConfigEditorDropdown( values = {"Background", "No Shadow", "Shadow", "Full Shadow"} @@ -207,7 +207,7 @@ public class Mining { @Expose @ConfigOption( name = "Show Icons", - desc = "Show icons in the overlay that represent the part." + desc = "Show icons in the Overlay that represent the part." ) @ConfigEditorBoolean @ConfigAccordionId(id = 4) @@ -292,7 +292,7 @@ public class Mining { public int automatonMissingColor = 12; @ConfigOption( - name = "Mines of Divan overlay", + name = "Mines of Divan Overlay", desc = "" ) @ConfigEditorAccordion(id = 6) @@ -300,8 +300,8 @@ public class Mining { @Expose @ConfigOption( - name = "Enabled", - desc = "Enables the Mines of Divan overlay." + name = "Enable Overlay", + desc = "Enables the Mines of Divan Overlay." ) @ConfigEditorBoolean @ConfigAccordionId(id = 6) @@ -309,8 +309,8 @@ public class Mining { @Expose @ConfigOption( - name = "Position", - desc = "Change the position of the AMines of Divan overlay." + name = "Overlay Position", + desc = "Change the position of the Mines of Divan Overlay." ) @ConfigEditorButton( runnableId = 11, @@ -322,7 +322,7 @@ public class Mining { @Expose @ConfigOption( name = "Style", - desc = "Change the style of the Mines of Divan overlay." + desc = "Change the style of the Mines of Divan Overlay." ) @ConfigEditorDropdown( values = {"Background", "No Shadow", "Shadow", "Full Shadow"} @@ -333,7 +333,7 @@ public class Mining { @Expose @ConfigOption( name = "Show Icons", - desc = "Show icons in the overlay that represent the part." + desc = "Show icons in the Overlay that represent the part." ) @ConfigEditorBoolean @ConfigAccordionId(id = 6) -- cgit From f85740988b8fe5ae8255a97eca2333e63937f96c Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 23 Aug 2021 14:13:19 +0200 Subject: First working version --- .../notenoughupdates/NEUEventListener.java | 89 +++++++++++++++++++++- .../moulberry/notenoughupdates/NEUOverlay.java | 1 + .../options/seperateSections/TooltipTweaks.java | 10 +++ .../moulberry/notenoughupdates/util/Utils.java | 81 ++++++++++++++++---- 4 files changed, 163 insertions(+), 18 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 4f565fa6..08fee4b2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1,10 +1,7 @@ package io.github.moulberry.notenoughupdates; import com.google.common.collect.Lists; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; +import com.google.gson.*; import com.mojang.authlib.GameProfile; import com.mojang.authlib.minecraft.MinecraftProfileTexture; import io.github.moulberry.notenoughupdates.auction.CustomAHGui; @@ -37,6 +34,7 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -61,6 +59,7 @@ import java.awt.*; import java.awt.datatransfer.StringSelection; import java.io.File; import java.io.IOException; +import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.List; import java.util.*; @@ -1723,6 +1722,7 @@ public class NEUEventListener { String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); if(internalname == null) { + onItemToolTipInternalNameNull(event); return; } @@ -1780,6 +1780,8 @@ public class NEUEventListener { boolean dungeonProfit = false; int index = 0; List newTooltip = new ArrayList<>(); + + for(String line : event.toolTip) { if(line.endsWith(EnumChatFormatting.DARK_GRAY+"Reforge Stone") && NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showReforgeStats) { JsonObject reforgeStones = Constants.REFORGESTONES; @@ -2118,6 +2120,7 @@ public class NEUEventListener { newTooltip.add(line); + if(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoAucItem) { if(line.contains(EnumChatFormatting.GRAY+"Buy it now: ") || line.contains(EnumChatFormatting.GRAY+"Bidder: ") || @@ -2302,8 +2305,86 @@ public class NEUEventListener { if(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoInvItem) { ItemPriceInformation.addToTooltip(event.toolTip, internalname, event.itemStack); } + + //petToolTipXPExtend(event, false); + + + + } + + private Pattern xpLevelPattern = Pattern.compile("(.*) (\\xA7e(.*)\\xA76/\\xA7e(.*))"); + + private void onItemToolTipInternalNameNull(ItemTooltipEvent event){ + petToolTipXPExtend(event, true); + } + private void petToolTipXPExtend(ItemTooltipEvent event, boolean xpBarExists) { + + if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.petExtendExp) { + + + //7 is just a random number i chose, prob no pets with less lines than 7 + if (event.toolTip.size() > 7) { + + if (Utils.cleanColour(event.toolTip.get(1)).matches("((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)).*")) { + + GuiProfileViewer.PetLevel petlevel = null; + + //This is in the pets menu + if (xpBarExists) { + PetInfoOverlay.Pet pet = PetInfoOverlay.getPetFromStack(event.itemStack.getDisplayName(), NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(event.itemStack.getTagCompound())); + if(pet == null){ + return; + } + Matcher matcher = xpLevelPattern.matcher(event.toolTip.get(event.toolTip.size() - 3)); + if(matcher.matches()) { + event.toolTip.set(event.toolTip.size() - 3, matcher.group(1)); + } + petlevel = pet.petLevel; + } else { + //this is the item itself + NBTTagCompound tag = event.itemStack.getTagCompound(); + if (tag.hasKey("ExtraAttributes")) { + if (tag.getCompoundTag("ExtraAttributes").hasKey("petInfo")) { + JsonObject petInfo = NotEnoughUpdates.INSTANCE.manager.gson.fromJson( + tag.getCompoundTag("ExtraAttributes").getString("petInfo"), JsonObject.class); + if (petInfo.has("exp") && petInfo.get("exp").isJsonPrimitive()) { + JsonPrimitive exp = petInfo.getAsJsonPrimitive("exp"); + int rarityOffset = Constants.PETS.get("pet_rarity_offset").getAsJsonObject().get( + Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip))).getAsInt(); + petlevel = GuiProfileViewer.getPetLevel(Constants.PETS.get("pet_levels").getAsJsonArray(), rarityOffset, exp.getAsLong()); + } + } + } + } + + if (petlevel == null) { + return; + } + if(petlevel.totalXp > petlevel.maxXP && !xpBarExists) { + event.toolTip.add(event.toolTip.size() - 2, EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD +"MAX LEVEL"); + } else { + if(!xpBarExists){ + int percentage = (int)Math.round(petlevel.levelPercentage*20); + + String bar = EnumChatFormatting.DARK_GREEN +String.join("", Collections.nCopies(percentage, "-"))+EnumChatFormatting.WHITE+String.join("", Collections.nCopies(20-percentage, "-")); + event.toolTip.add(event.toolTip.size() - 2, bar); + } + if(!xpBarExists || (xpBarExists && !Utils.cleanColour(event.toolTip.get(event.toolTip.size() - 3)).matches("MAX LEVEL"))) { + event.toolTip.add(event.toolTip.size() - 2, EnumChatFormatting.YELLOW + "" + myFormatter.format(petlevel.levelXp) + "/" + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); + } + } + } + } + } + } + + DecimalFormat myFormatter = new DecimalFormat("###,###.###"); + + + + /** * This makes it so that holding LCONTROL while hovering over an item with NBT will show the NBT of the item. * @param event diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index d196f75a..e2e582fa 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -2008,6 +2008,7 @@ public class NEUOverlay extends Gui { if(hasClick) text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"LMB/R : View recipe!"); if(hasInfo) text.add(EnumChatFormatting.YELLOW.toString()+EnumChatFormatting.BOLD+"RMB : View additional information!"); + textToDisplay = text; } if(textToDisplay != null) { 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 71508144..1bdbc84a 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 @@ -95,6 +95,16 @@ public class TooltipTweaks { @ConfigEditorBoolean public boolean missingEnchantList = true; + @Expose + @ConfigOption( + name = "Expand Pet Exp Requirement", + desc = "Show which the full amount of pet xp required" + ) + @ConfigEditorBoolean + public boolean petExtendExp = true; + + + @Expose @ConfigOption( name = "Tooltip Border Colours", 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 5ca9b316..8f373460 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -472,23 +472,74 @@ public class Utils { private static String[] rarityArr = new String[] { "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", }; + + public static String getRarityFromInt(int rarity){ + if(rarity < 0|| rarity >= rarityArr.length){ return rarityArr[0]; } + return rarityArr[rarity]; + } + + public static int checkItemTypePet(List lore){ + for(int i=lore.size()-1; i>=0; i--){ + String line = Utils.cleanColour(lore.get(i)); + for (int i1 = 0; i1 < rarityArr.length; i1++) { + if(line.equals(rarityArr[i1])){ + return i1; + } + } + } + return -1; + } + public static int checkItemType(JsonArray lore, boolean contains, String... typeMatches) { for(int i=lore.size()-1; i>=0; i--) { String line = lore.get(i).getAsString(); - for(String rarity : rarityArr) { - for(int j=0; j=0; i--) { + String line = lore[i]; + + int returnType = checkItemType(line, contains, typeMatches); + if(returnType != -1){ + return returnType; + } + } + return -1; + } + + public static int checkItemType(List lore, boolean contains, String... typeMatches) { + for(int i=lore.size()-1; i>=0; i--) { + String line = lore.get(i); + + int returnType = checkItemType(line, contains, typeMatches); + if(returnType != -1){ + return returnType; + } + } + return -1; + } + + private static int checkItemType(String line, boolean contains, String... typeMatches) { + for (String rarity : rarityArr) { + for (int j = 0; j < typeMatches.length; j++) { + if (contains) { + if (line.trim().contains(rarity + " " + typeMatches[j])) { + return j; + } else if (line.trim().contains(rarity + " DUNGEON " + typeMatches[j])) { + return j; + } + } else { + if (line.trim().endsWith(rarity + " " + typeMatches[j])) { + return j; + } else if (line.trim().endsWith(rarity + " DUNGEON " + typeMatches[j])) { + return j; } } } @@ -496,6 +547,8 @@ public class Utils { return -1; } + + public static void playPressSound() { playSound(new ResourceLocation("gui.button.press"), true); } -- cgit From 752e77d7407bfa7a0355677cd15d205fccf8d8f1 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 23 Aug 2021 15:15:15 +0200 Subject: Fix some pet xp tooltip bugs --- .../notenoughupdates/NEUEventListener.java | 120 ++++++++++++++------- .../moulberry/notenoughupdates/util/Utils.java | 7 +- 2 files changed, 85 insertions(+), 42 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 08fee4b2..29013ea5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2286,6 +2286,19 @@ public class NEUEventListener { index++; } + for (int i = newTooltip.size()-1; i >=0; i--) { + String line = Utils.cleanColour(newTooltip.get(i)); + for (int i1 = 0; i1 < Utils.rarityArr.length; i1++) { + if(line.equals(Utils.rarityArr[i1])){ + if(i-2 <0){ + break; + } + newTooltip.addAll(i-1, petToolTipXPExtend(event)); + break; + } + } + } + pressedShiftLast = Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT); pressedArrowLast = Keyboard.isKeyDown(Keyboard.KEY_LEFT) || Keyboard.isKeyDown(Keyboard.KEY_RIGHT); @@ -2306,7 +2319,7 @@ public class NEUEventListener { ItemPriceInformation.addToTooltip(event.toolTip, internalname, event.itemStack); } - //petToolTipXPExtend(event, false); + @@ -2315,15 +2328,13 @@ public class NEUEventListener { private Pattern xpLevelPattern = Pattern.compile("(.*) (\\xA7e(.*)\\xA76/\\xA7e(.*))"); private void onItemToolTipInternalNameNull(ItemTooltipEvent event){ - petToolTipXPExtend(event, true); + petToolTipXPExtendPetMenu(event); } - private void petToolTipXPExtend(ItemTooltipEvent event, boolean xpBarExists) { - + private List petToolTipXPExtend(ItemTooltipEvent event) { + List tooltipText = new ArrayList(); if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.petExtendExp) { - - //7 is just a random number i chose, prob no pets with less lines than 7 if (event.toolTip.size() > 7) { @@ -2331,49 +2342,76 @@ public class NEUEventListener { GuiProfileViewer.PetLevel petlevel = null; - //This is in the pets menu - if (xpBarExists) { - PetInfoOverlay.Pet pet = PetInfoOverlay.getPetFromStack(event.itemStack.getDisplayName(), NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(event.itemStack.getTagCompound())); - if(pet == null){ - return; + //this is the item itself + NBTTagCompound tag = event.itemStack.getTagCompound(); + if (tag.hasKey("ExtraAttributes")) { + if (tag.getCompoundTag("ExtraAttributes").hasKey("petInfo")) { + JsonObject petInfo = NotEnoughUpdates.INSTANCE.manager.gson.fromJson( + tag.getCompoundTag("ExtraAttributes").getString("petInfo"), JsonObject.class); + if (petInfo.has("exp") && petInfo.get("exp").isJsonPrimitive()) { + JsonPrimitive exp = petInfo.getAsJsonPrimitive("exp"); + int rarityOffset = Constants.PETS.get("pet_rarity_offset").getAsJsonObject().get( + Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip))).getAsInt(); + petlevel = GuiProfileViewer.getPetLevel(Constants.PETS.get("pet_levels").getAsJsonArray(), rarityOffset, exp.getAsLong()); + } } - Matcher matcher = xpLevelPattern.matcher(event.toolTip.get(event.toolTip.size() - 3)); - if(matcher.matches()) { - event.toolTip.set(event.toolTip.size() - 3, matcher.group(1)); + } + + + + if (petlevel != null) { + tooltipText.add(""); + if(petlevel.totalXp > petlevel.maxXP) { + tooltipText.add(EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD +"MAX LEVEL"); + } else { + tooltipText.add(EnumChatFormatting.GRAY+"Progress to Level "+(int)Math.floor(petlevel.level+1)+": "+EnumChatFormatting.YELLOW+Utils.round(petlevel.levelPercentage*100, 1)+"%"); + int levelpercentage = Math.round(petlevel.levelPercentage*20); + tooltipText.add(EnumChatFormatting.DARK_GREEN+String.join("", Collections.nCopies(levelpercentage, "-"))+EnumChatFormatting.WHITE+String.join("", Collections.nCopies(20-levelpercentage, "-"))); + tooltipText.add(EnumChatFormatting.YELLOW + "" + myFormatter.format(petlevel.levelXp) + "/" + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); } - petlevel = pet.petLevel; - } else { - //this is the item itself - NBTTagCompound tag = event.itemStack.getTagCompound(); - if (tag.hasKey("ExtraAttributes")) { - if (tag.getCompoundTag("ExtraAttributes").hasKey("petInfo")) { - JsonObject petInfo = NotEnoughUpdates.INSTANCE.manager.gson.fromJson( - tag.getCompoundTag("ExtraAttributes").getString("petInfo"), JsonObject.class); - if (petInfo.has("exp") && petInfo.get("exp").isJsonPrimitive()) { - JsonPrimitive exp = petInfo.getAsJsonPrimitive("exp"); - int rarityOffset = Constants.PETS.get("pet_rarity_offset").getAsJsonObject().get( - Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip))).getAsInt(); - petlevel = GuiProfileViewer.getPetLevel(Constants.PETS.get("pet_levels").getAsJsonArray(), rarityOffset, exp.getAsLong()); - } - } + } + } + } + } + return tooltipText; + } + + + private void petToolTipXPExtendPetMenu(ItemTooltipEvent event) { + + if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.petExtendExp) { + //7 is just a random number i chose, prob no pets with less lines than 7 + if (event.toolTip.size() > 7) { + if (Utils.cleanColour(event.toolTip.get(1)).matches("((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)).*")) { + GuiProfileViewer.PetLevel petlevel = null; + + PetInfoOverlay.Pet pet = PetInfoOverlay.getPetFromStack(event.itemStack.getDisplayName(), NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(event.itemStack.getTagCompound())); + if (pet == null) { + return; + } + petlevel = pet.petLevel; + + boolean maxLevel = false; + int xpLine = -1; + for (int i = event.toolTip.size() - 1; i >= 0; i--) { + Matcher matcher = xpLevelPattern.matcher(event.toolTip.get(i)); + if (matcher.matches()) { + xpLine = i; + event.toolTip.set(xpLine, matcher.group(1)); + break; + } else if (event.toolTip.get(i).matches("MAX LEVEL")) { + xpLine = i; + maxLevel = true; } } - if (petlevel == null) { + if (petlevel == null||xpLine==-1) { return; } - if(petlevel.totalXp > petlevel.maxXP && !xpBarExists) { - event.toolTip.add(event.toolTip.size() - 2, EnumChatFormatting.AQUA + "" + EnumChatFormatting.BOLD +"MAX LEVEL"); - } else { - if(!xpBarExists){ - int percentage = (int)Math.round(petlevel.levelPercentage*20); - String bar = EnumChatFormatting.DARK_GREEN +String.join("", Collections.nCopies(percentage, "-"))+EnumChatFormatting.WHITE+String.join("", Collections.nCopies(20-percentage, "-")); - event.toolTip.add(event.toolTip.size() - 2, bar); - } - if(!xpBarExists || (xpBarExists && !Utils.cleanColour(event.toolTip.get(event.toolTip.size() - 3)).matches("MAX LEVEL"))) { - event.toolTip.add(event.toolTip.size() - 2, EnumChatFormatting.YELLOW + "" + myFormatter.format(petlevel.levelXp) + "/" + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); - } + + if (!maxLevel) { + event.toolTip.add(event.toolTip.size() - 2, EnumChatFormatting.YELLOW + "" + myFormatter.format(petlevel.levelXp) + "/" + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); } } } 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 8f373460..3e84261c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -469,7 +469,7 @@ public class Utils { return str.substring(0, 1).toUpperCase() + str.substring(1).toLowerCase(); } - private static String[] rarityArr = new String[] { + public static String[] rarityArr = new String[] { "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", }; @@ -547,6 +547,11 @@ public class Utils { return -1; } + public static float round (float value, int precision) { + int scale = (int) Math.pow(10, precision); + return (float) Math.round(value * scale) / scale; + } + public static void playPressSound() { -- cgit From c8a7dfb175a667ba2a3aef5bfa1cafeb5df9ae8d Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 23 Aug 2021 15:49:18 +0200 Subject: Stop pet exp display showing on itemlist pet --- .../io/github/moulberry/notenoughupdates/NEUEventListener.java | 5 +++++ src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 29013ea5..c499ce0f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2335,6 +2335,11 @@ public class NEUEventListener { private List petToolTipXPExtend(ItemTooltipEvent event) { List tooltipText = new ArrayList(); if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.petExtendExp) { + if(event.itemStack.getTagCompound().hasKey("ItemList")){ + if(event.itemStack.getTagCompound().getBoolean("ItemList")){ + return tooltipText; + } + } //7 is just a random number i chose, prob no pets with less lines than 7 if (event.toolTip.size() > 7) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index e2e582fa..2208b53c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -1987,7 +1987,14 @@ public class NEUOverlay extends Gui { //Render tooltip JsonObject json = tooltipToDisplay.get(); if(json != null) { + ItemStack stack = manager.jsonToStack(json); + { + NBTTagCompound tag = stack.getTagCompound(); + tag.setBoolean("ItemList", true); + stack.setTagCompound(tag); + } + List text = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false); String internalname = json.get("internalname").getAsString(); -- cgit From 3ff239d48b8b45e86efae37b8e9b1963927a6d8c Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 23 Aug 2021 17:58:53 +0200 Subject: fix a small bug and some code clean up in pet exp extender --- .../moulberry/notenoughupdates/NEUEventListener.java | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index c499ce0f..fbf51fca 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2390,13 +2390,6 @@ public class NEUEventListener { if (Utils.cleanColour(event.toolTip.get(1)).matches("((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)).*")) { GuiProfileViewer.PetLevel petlevel = null; - PetInfoOverlay.Pet pet = PetInfoOverlay.getPetFromStack(event.itemStack.getDisplayName(), NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(event.itemStack.getTagCompound())); - if (pet == null) { - return; - } - petlevel = pet.petLevel; - - boolean maxLevel = false; int xpLine = -1; for (int i = event.toolTip.size() - 1; i >= 0; i--) { Matcher matcher = xpLevelPattern.matcher(event.toolTip.get(i)); @@ -2405,19 +2398,22 @@ public class NEUEventListener { event.toolTip.set(xpLine, matcher.group(1)); break; } else if (event.toolTip.get(i).matches("MAX LEVEL")) { - xpLine = i; - maxLevel = true; + return; } } + PetInfoOverlay.Pet pet = PetInfoOverlay.getPetFromStack(event.itemStack.getDisplayName(), NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(event.itemStack.getTagCompound())); + if (pet == null) { + return; + } + petlevel = pet.petLevel; + if (petlevel == null||xpLine==-1) { return; } + event.toolTip.add(xpLine+1, EnumChatFormatting.YELLOW + "" + myFormatter.format(petlevel.levelXp) + "/" + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); - if (!maxLevel) { - event.toolTip.add(event.toolTip.size() - 2, EnumChatFormatting.YELLOW + "" + myFormatter.format(petlevel.levelXp) + "/" + myFormatter.format(petlevel.currentLevelRequirement) + " EXP"); - } } } } -- cgit From 6d0e71699f4ec29c444aa867748ecb408756a01d Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 24 Aug 2021 10:40:18 +0200 Subject: semi finished crystal hollow overlay --- .../notenoughupdates/NEUEventListener.java | 8 +- .../notenoughupdates/options/NEUConfig.java | 46 +-- .../options/seperateSections/Mining.java | 204 ++++------- .../overlays/AutomatonOverlay.java | 166 --------- .../overlays/CrystalHollowOverlay.java | 403 +++++++++++++++++++++ .../overlays/DivanMinesOverlay.java | 142 -------- .../notenoughupdates/overlays/OverlayManager.java | 95 +++-- 7 files changed, 560 insertions(+), 504 deletions(-) delete mode 100644 src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java delete mode 100644 src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 4f565fa6..62a94ab8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -836,10 +836,10 @@ public class NEUEventListener { if (unformatted.startsWith("You found ") && SBInfo.getInstance().getLocation() != null && SBInfo.getInstance().getLocation().equals("crystal_hollows")){ CrystalMetalDetectorSolver.reset(); } - if(unformatted.startsWith("[NPC] Professor Robot: ") || unformatted.startsWith(" ")) - OverlayManager.automatonOverlay.message(unformatted); - else if(unformatted.startsWith("[NPC] Keeper of ")) - OverlayManager.divanMinesOverlay.message(unformatted); + if(unformatted.startsWith("[NPC] Keeper of ") | unformatted.startsWith("[NPC] Professor Robot: ") || unformatted.startsWith(" ") || unformatted.startsWith("✦") || + unformatted.equals(" You've earned a Crystal Loot Bundle!")) + OverlayManager.crystalHollowOverlay.message(unformatted); + System.out.println(unformatted); } public static boolean drawingGuiScreen = 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 ee24472f..9327636a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -16,6 +16,7 @@ import io.github.moulberry.notenoughupdates.overlays.*; import io.github.moulberry.notenoughupdates.util.SBInfo; import net.minecraft.client.Minecraft; import net.minecraftforge.client.ClientCommandHandler; +import org.luaj.vm2.ast.Str; import org.lwjgl.util.vector.Vector2f; import java.util.ArrayList; @@ -86,10 +87,7 @@ public class NEUConfig extends Config { editOverlay(activeConfigCategory, OverlayManager.bonemerangOverlay, itemOverlays.bonemerangPosition); return; case 10: - editOverlay(activeConfigCategory, OverlayManager.automatonOverlay, mining.automatonOverlayPosition); - return; - case 11: - editOverlay(activeConfigCategory, OverlayManager.divanMinesOverlay, mining.divanMinesOverlayPosition); + editOverlay(activeConfigCategory, OverlayManager.crystalHollowOverlay, mining.crystalHollowOverlayPosition); } } @@ -338,23 +336,29 @@ public class NEUConfig extends Config { @Expose public int commissionMilestone = 0; - @Expose public HashMap automatonParts = new HashMap<>(); - - @Expose public HashMap divanMinesParts = new HashMap<>(); - - public HiddenProfileSpecific(){ - automatonParts.putIfAbsent("Electron Transmitter", false); - automatonParts.putIfAbsent("FTX 3070", false); - automatonParts.putIfAbsent("Robotron Reflector", false); - automatonParts.putIfAbsent("Superlite Motor", false); - automatonParts.putIfAbsent("Control Switch", false); - automatonParts.putIfAbsent("Synthetic Heart", false); - - divanMinesParts.putIfAbsent("Scavenged Lapis Sword", false); - divanMinesParts.putIfAbsent("Scavenged Golden Hammer", false); - divanMinesParts.putIfAbsent("Scavenged Diamond Axe", false); - divanMinesParts.putIfAbsent("Scavenged Emerald Hammer", false); - } + @Expose public HashMap automatonParts = new HashMap(){{ + put("Electron Transmitter", false); + put("FTX 3070", false); + put("Robotron Reflector", false); + put("Superlite Motor", false); + put("Control Switch", false); + put("Synthetic Heart", false); + }}; + + @Expose public HashMap divanMinesParts = new HashMap(){{ + put("Scavenged Lapis Sword", false); + put("Scavenged Golden Hammer", false); + put("Scavenged Diamond Axe", false); + put("Scavenged Emerald Hammer", false); + }}; + + @Expose public HashMap crystals = new HashMap(){{ + put("Jade", 0); + put("Amber", 0); + put("Amethyst", 0); + put("Sapphire", 0); + put("Topaz", 0); + }}; } public static List createDefaultInventoryButtons() { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index b35704d0..4a4d5e23 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -166,169 +166,109 @@ public class Mining { public boolean metalDetectorShowPossible = false; @ConfigOption( - name = "Automaton Parts Overlay", + name = "Crystal Hollows Overlay", desc = "" ) - @ConfigEditorAccordion(id = 4) - public boolean automatonOverlayAccordion = false; + @ConfigEditorAccordion(id = 6) + public boolean crystalHollowOverlayAccordion = false; @Expose @ConfigOption( name = "Enabled", - desc = "Enables the Automaton parts overlay." + desc = "Enables the Crystal Hollows Overlay." ) @ConfigEditorBoolean - @ConfigAccordionId(id = 4) - public boolean automatonOverlay = false; + @ConfigAccordionId(id = 6) + public boolean crystalHollowOverlay = false; @Expose @ConfigOption( name = "Position", - desc = "Change the position of the Automaton parts overlay." + desc = "Change the position of the Crystal Hollows Overlay overlay." ) @ConfigEditorButton( runnableId = 10, buttonText = "Edit" ) - @ConfigAccordionId(id = 4) - public Position automatonOverlayPosition = new Position(200, 0); - - @Expose - @ConfigOption( - name = "Style", - desc = "Change the style of the Automaton parts overlay." - ) - @ConfigEditorDropdown( - values = {"Background", "No Shadow", "Shadow", "Full Shadow"} - ) - @ConfigAccordionId(id = 4) - public int automatonOverlayStyle = 0; - - @Expose - @ConfigOption( - name = "Show Icons", - desc = "Show icons in the overlay that represent the part." - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 4) - public boolean automatonIcons = true; - - - @Expose - @ConfigOption( - name = "Hide Done", - desc = "Don't show parts you've given to Professor Robot." - ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 4) - public boolean automatonHideDone = false; - - @ConfigOption( - name = "Colours", - desc = "" - ) - @ConfigEditorAccordion(id = 5) - @ConfigAccordionId(id = 4) - public boolean AutomatonColourAccordion = false; - - @Expose - @ConfigOption( - name = "Part colour", - desc = "Change the colour of the part text." - - ) - @ConfigEditorDropdown( - values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} - ) - @ConfigAccordionId(id = 5) - public int automatonPartColor = 3; - - @Expose - @ConfigOption( - name = "Ready colour", - desc = "Change the colour when the part is given to Professor Robot." - - ) - @ConfigEditorDropdown( - values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} - ) - @ConfigAccordionId(id = 5) - public int automatonDoneColor = 10; - - @Expose - @ConfigOption( - name = "In Inventory Color", - desc = "Change the colour when the part is in the inventory." - - ) - @ConfigEditorDropdown( - values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} - ) - @ConfigAccordionId(id = 5) - public int automatonInventoryColor = 14; + @ConfigAccordionId(id = 6) + public Position crystalHollowOverlayPosition = new Position(200, 0); @Expose @ConfigOption( - name = "In Storage Color", - desc = "Change the colour when the part is in the storage." - + name = "Text", + desc = "\u00a7eDrag text to change the appearance of the overlay" ) - @ConfigEditorDropdown( - values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + @ConfigEditorDraggableList( + exampleText = { + "\u00a73Amber Crystal: \u00a7aPlaced\n" + + "\u00a73Sapphire Crystal: \u00a7eCollected\n" + + "\u00a73Jade Crystal: \u00a7eMissing\n" + + "\u00a73Amethyst Crystal: \u00a7cMissing\n" + + "\u00a73Topaz Crystal: \u00a7cMissing\n", + "\u00a73Crystals: \u00a7a4/5", + "\u00a73Crystals: \u00a7a80%", + "\u00a73Electron Transmitter: \u00a7aDone\n" + + "\u00a73Robotron Reflector: \u00a7eIn Storage\n" + + "\u00a73Superlite Motor: \u00a7eIn Inventory\n" + + "\u00a73Synthetic Hearth: \u00a7cMissing\n" + + "\u00a73Control Switch: \u00a7cMissing\n" + + "\u00a73FTX 3070: \u00a7cMissing", + "\u00a73Electron Transmitter: \u00a7a3\n" + + "\u00a73Robotron Reflector: \u00a7e2\n" + + "\u00a73Superlite Motor: \u00a7e1\n" + + "\u00a73Synthetic Hearth: \u00a7c0\n" + + "\u00a73Control Switch: \u00a7c0\n" + + "\u00a73FTX 3070: \u00a7c0", + "\u00a73Automaton parts: \u00a7a5/6", + "\u00a73Automaton parts: \u00a7a83%", + "\u00a73Scavenged Lapis Sword: \u00a7aDone\n" + + "\u00a73Scavenged Golden Hammer: \u00a7eIn Storage\n" + + "\u00a73Scavenged Diamond Axe: \u00a7eIn Inventory\n" + + "\u00a73Scavenged Emerald Hammer: \u00a7cMissing\n", + "\u00a73Scavenged Lapis Sword: \u00a7a3\n" + + "\u00a73Scavenged Golden Hammer: \u00a7e2\n" + + "\u00a73Scavenged Diamond Axe: \u00a7e1\n" + + "\u00a73Scavenged Emerald Hammer: \u00a7c0\n", + "\u00a73Mines of Divan parts: \u00a7a3/4", + "\u00a73Mines of Divan parts: \u00a7a75%" + } ) - @ConfigAccordionId(id = 5) - public int automatonStorageColor = 14; + @ConfigAccordionId(id = 6) + public List crystalHollowText = new ArrayList<>(Arrays.asList(0, 3, 7)); @Expose @ConfigOption( - name = "Missing Color", - desc = "Change the colour when the part is missing." - + name = "Style", + desc = "Change the style of the Crystal Hollows Overlay overlay." ) @ConfigEditorDropdown( - values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} - ) - @ConfigAccordionId(id = 5) - public int automatonMissingColor = 12; - - @ConfigOption( - name = "Mines of Divan overlay", - desc = "" - ) - @ConfigEditorAccordion(id = 6) - public boolean divanMinesOverlayAccordion = false; - - @Expose - @ConfigOption( - name = "Enabled", - desc = "Enables the Mines of Divan overlay." + values = {"Background", "No Shadow", "Shadow", "Full Shadow"} ) - @ConfigEditorBoolean @ConfigAccordionId(id = 6) - public boolean divanMinesOverlay = false; + public int crystalHollowOverlayStyle = 0; @Expose @ConfigOption( - name = "Position", - desc = "Change the position of the AMines of Divan overlay." + name = "Show Automaton", + desc = "Change where to show Automaton parts." ) - @ConfigEditorButton( - runnableId = 11, - buttonText = "Edit" + @ConfigEditorDropdown( + values = {"Crystal Hollows", "Precursor Remnants", "Lost Precursor City"} ) @ConfigAccordionId(id = 6) - public Position divanMinesOverlayPosition = new Position(200, 0); + public int crystalHollowAutomatonLocation = 2; @Expose @ConfigOption( - name = "Style", - desc = "Change the style of the Mines of Divan overlay." + name = "Show Automaton", + desc = "Change where to show Automaton parts." ) @ConfigEditorDropdown( - values = {"Background", "No Shadow", "Shadow", "Full Shadow"} + values = {"Crystal Hollows", "Mithril Deposits", "Mines of Divan"} ) @ConfigAccordionId(id = 6) - public int divanMinesOverlayStyle = 0; + public int crystalHollowDivanLocation = 2; + @Expose @ConfigOption( @@ -337,17 +277,17 @@ public class Mining { ) @ConfigEditorBoolean @ConfigAccordionId(id = 6) - public boolean divanMinesIcons = true; + public boolean crystalHollowIcons = true; @Expose @ConfigOption( name = "Hide Done", - desc = "Don't show parts you've given to the Keepers." + desc = "Don't show parts you've given to the NPC." ) @ConfigEditorBoolean @ConfigAccordionId(id = 6) - public boolean divanMinesHideDone = false; + public boolean crystalHollowHideDone = false; @ConfigOption( name = "Colours", @@ -355,7 +295,7 @@ public class Mining { ) @ConfigEditorAccordion(id = 7) @ConfigAccordionId(id = 6) - public boolean divanMinesColourAccordion = false; + public boolean crystalHollowColourAccordion = false; @Expose @ConfigOption( @@ -367,19 +307,19 @@ public class Mining { values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) @ConfigAccordionId(id = 7) - public int divanMinesPartColor = 3; + public int crystalHollowPartColor = 3; @Expose @ConfigOption( - name = "Ready colour", - desc = "Change the colour when the part is given to the Keepers." + name = "Done colour", + desc = "Change the colour when the part is given to the NPC." ) @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) @ConfigAccordionId(id = 7) - public int divanMinesDoneColor = 10; + public int crystalHollowDoneColor = 10; @Expose @ConfigOption( @@ -391,7 +331,7 @@ public class Mining { values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) @ConfigAccordionId(id = 7) - public int divanMinesInventoryColor = 14; + public int crystalHollowInventoryColor = 14; @Expose @ConfigOption( @@ -403,7 +343,7 @@ public class Mining { values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) @ConfigAccordionId(id = 7) - public int divanMinesStorageColor = 14; + public int crystalHollowStorageColor = 14; @Expose @ConfigOption( @@ -415,7 +355,7 @@ public class Mining { values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) @ConfigAccordionId(id = 7) - public int divanMinesMissingColor = 12; + public int crystalHollowMissingColor = 12; @Expose @ConfigOption( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java deleted file mode 100644 index a0ef88b8..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/AutomatonOverlay.java +++ /dev/null @@ -1,166 +0,0 @@ -package io.github.moulberry.notenoughupdates.overlays; - -import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.core.config.Position; -import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; -import io.github.moulberry.notenoughupdates.options.NEUConfig; -import io.github.moulberry.notenoughupdates.util.SBInfo; -import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import org.lwjgl.util.vector.Vector2f; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class AutomatonOverlay extends TextOverlay { - private static final Minecraft mc = Minecraft.getMinecraft(); - private final StorageManager storageManager = StorageManager.getInstance(); - private final Pattern givePattern = Pattern.compile("\\[NPC] Professor Robot: Thanks for bringing me the (?[a-zA-Z0-9 ]+)! Bring me (\\d+|one) more components? to fix the giant!"); - private final Pattern notFinalPattern = Pattern.compile("\\[NPC] Professor Robot: That's not the final component! Bring me a (?[a-zA-Z0-9 ]+) to gain access to Automaton Prime's storage container!"); - - public AutomatonOverlay(Position position, Supplier> dummyStrings, Supplier styleSupplier) { - super(position, dummyStrings, styleSupplier); - } - - @Override - public void update() { - overlayStrings = null; - if (!NotEnoughUpdates.INSTANCE.config.mining.automatonOverlay || SBInfo.getInstance().getLocation() == null || - !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Lost Precursor City")) - return; - - NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); - if (hidden == null) return; - overlayStrings = new ArrayList<>(); - HashMap states = new HashMap<>(); - for (String key : hidden.automatonParts.keySet()) { - Boolean has = hidden.automatonParts.get(key); - if (has) - states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonDoneColor] + "Done"); - } - for (ItemStack item : mc.thePlayer.inventory.mainInventory) { - if (item != null) { - String name = Utils.cleanColour(item.getDisplayName()); - if (!states.containsKey(name)) { - states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonInventoryColor] + "In Inventory"); - } - } - } - for (Map.Entry entry : storageManager.storageConfig.displayToStorageIdMap.entrySet()) { - int storageId = entry.getValue(); - StorageManager.StoragePage page = storageManager.getPage(storageId, false); - if (page != null && page.rows > 0) { - for (ItemStack item : page.items) { - if (item != null) { - String name = Utils.cleanColour(item.getDisplayName()); - if (!states.containsKey(name)) { - states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonStorageColor] + "In Storage"); - } - } - } - } - } - for (String key : hidden.automatonParts.keySet()) { - if (!NotEnoughUpdates.INSTANCE.config.mining.automatonHideDone || !hidden.automatonParts.get(key)) { - if (!states.containsKey(key)) - states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonMissingColor] + "Missing"); - overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.automatonPartColor] + key + ": " + states.get(key)); - } - } - } - - public void message(String message) { - NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); - if (hidden == null) return; - if (message.startsWith(" ")) { - String item = message.replace(" ", ""); - if (hidden.automatonParts.containsKey(item)) { - hidden.automatonParts.put(item, false); - } - } else if (message.startsWith("[NPC] Professor Robot: ")) { - switch (message) { - case "[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:": - hidden.automatonParts.replaceAll((k, v) -> true); - break; - case "[NPC] Professor Robot: You've brought me all of the components!": - case "[NPC] Professor Robot: You haven't placed the Sapphire Crystal yet!": - case "[NPC] Professor Robot: You have already placed the Sapphire Crystal!": - hidden.automatonParts.replaceAll((k, v) -> false); - break; - default: - Matcher giveMatcher = givePattern.matcher(message); - Matcher notFinalMatcher = notFinalPattern.matcher(message); - if (giveMatcher.matches()) { - String item = giveMatcher.group("part"); - if (hidden.automatonParts.containsKey(item)) { - hidden.automatonParts.put(item, true); - } - } else if (notFinalMatcher.matches()) { - String item = notFinalMatcher.group("part"); - if (hidden.automatonParts.containsKey(item)) { - hidden.automatonParts.replaceAll((k, v) -> true); - hidden.automatonParts.put(item, false); - } - } - break; - } - } - } - - @Override - protected void renderLine(String line, Vector2f position, boolean dummy) { - if (!NotEnoughUpdates.INSTANCE.config.mining.automatonIcons) return; - GlStateManager.enableDepth(); - - ItemStack icon = null; - String cleaned = Utils.cleanColour(line); - String beforeColon = cleaned.split(":")[0]; - switch (beforeColon) { - case "Electron Transmitter": - icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ELECTRON_TRANSMITTER")); - break; - case "FTX 3070": - icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("FTX_3070")); - break; - case "Robotron Reflector": - icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ROBOTRON_REFLECTOR")); - break; - case "Superlite Motor": - icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SUPERLITE_MOTOR")); - break; - case "Control Switch": - icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("CONTROL_SWITCH")); - break; - case "Synthetic Heart": - icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SYNTHETIC_HEART")); - break; - } - - if (icon != null) { - GlStateManager.pushMatrix(); - GlStateManager.translate(position.x - 2, position.y - 2, 0); - GlStateManager.scale(0.7f, 0.7f, 1f); - Utils.drawItemStack(icon, 0, 0); - GlStateManager.popMatrix(); - - position.x += 12; - } - - super.renderLine(line, position, dummy); - } - - @Override - protected Vector2f getSize(List strings) { - if (NotEnoughUpdates.INSTANCE.config.mining.automatonIcons) - return super.getSize(strings).translate(12, 0); - return super.getSize(strings); - } -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java new file mode 100644 index 00000000..3dadca29 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java @@ -0,0 +1,403 @@ +package io.github.moulberry.notenoughupdates.overlays; + +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.core.config.Position; +import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; +import io.github.moulberry.notenoughupdates.options.NEUConfig; +import io.github.moulberry.notenoughupdates.util.SBInfo; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import org.lwjgl.util.vector.Vector2f; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Supplier; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class CrystalHollowOverlay extends TextOverlay { + private static final Minecraft mc = Minecraft.getMinecraft(); + private final StorageManager storageManager = StorageManager.getInstance(); + private final Pattern notFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Talk to me when you have found a (?[a-z-A-Z ]+)!"); + private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Excellent! You have returned the (?[a-z-A-Z ]+) to its rightful place!"); + private final Pattern resetPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (You found all of the items! Behold\\.\\.\\. the Jade Crystal!)"); + private final Pattern alreadyFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: You have already restored this Dwarf's (?[a-z-A-Z ]+)!"); + private final Pattern givePattern = Pattern.compile("\\[NPC] Professor Robot: Thanks for bringing me the (?[a-zA-Z0-9 ]+)! Bring me (\\d+|one) more components? to fix the giant!"); + private final Pattern notFinalPattern = Pattern.compile("\\[NPC] Professor Robot: That's not the final component! Bring me a (?[a-zA-Z0-9 ]+) to gain access to Automaton Prime's storage container!"); + private final Pattern obtainCrystalPattern = Pattern.compile(" +(?[a-zA-Z]+) Crystal"); + private final Pattern crystalNotPlacedPattern = Pattern.compile(".*: You haven't placed the (?[a-zA-Z]+) Crystal yet!"); + private final Pattern crystalPlacedPattern = Pattern.compile(".*: You have already placed the (?[a-zA-Z]+) Crystal!"); + private final Pattern crystalPlacePattern = Pattern.compile("✦ You placed the (?[a-zA-Z]+) Crystal!"); + private final Pattern crystalReclaimPattern = Pattern.compile("✦ You reclaimed the (?[a-zA-Z]+) Crystal!"); + + public CrystalHollowOverlay(Position position, Supplier> dummyStrings, Supplier styleSupplier) { + super(position, dummyStrings, styleSupplier); + } + + @Override + public void update() { + overlayStrings = null; + if (!NotEnoughUpdates.INSTANCE.config.mining.crystalHollowOverlay || SBInfo.getInstance().getLocation() == null || + !SBInfo.getInstance().getLocation().equals("crystal_hollows")) + return; + + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); + if (hidden == null) return; + overlayStrings = new ArrayList<>(); + HashMap inventoryData = new HashMap<>(); + for (String key : hidden.automatonParts.keySet()) + inventoryData.put(key, 0); + for (String key : hidden.divanMinesParts.keySet()) + inventoryData.put(key, 0); + HashMap storageData = new HashMap<>(inventoryData); + for (ItemStack item : mc.thePlayer.inventory.mainInventory) + if (item != null) { + String name = Utils.cleanColour(item.getDisplayName()); + if (inventoryData.containsKey(name)) + inventoryData.put(name, inventoryData.get(name) + item.stackSize); + } + for (Map.Entry entry : storageManager.storageConfig.displayToStorageIdMap.entrySet()) { + int storageId = entry.getValue(); + StorageManager.StoragePage page = storageManager.getPage(storageId, false); + if (page != null && page.rows > 0) + for (ItemStack item : page.items) + if (item != null) { + String name = Utils.cleanColour(item.getDisplayName()); + if (storageData.containsKey(name)) + storageData.put(name, storageData.get(name) + item.stackSize); + } + } + + for (int i : NotEnoughUpdates.INSTANCE.config.mining.crystalHollowText) { + switch (i) { + case 0: + if (crystalCheck()) { + for (String part : hidden.crystals.keySet()) { + switch (hidden.crystals.get(part)) { + case 2: + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDoneColor] + "Placed"); + break; + case 1: + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowInventoryColor] + "Collected"); + break; + case 0: + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMissingColor] + "Missing"); + break; + } + } + } + break; + case 1: + if (crystalCheck()) { + int count = getCountCrystal(hidden.crystals); + float percent = (float) count / hidden.crystals.size() * 100; + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + "Crystals: " + getColor(percent) + count + + "/" + hidden.crystals.size()); + } + break; + case 2: + if (crystalCheck()) { + int count = getCountCrystal(hidden.crystals); + float percent = (float) count / hidden.crystals.size() * 100; + DecimalFormat df = new DecimalFormat("#.#"); + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + "Crystals: " + getColor(percent) + + df.format(percent) + "%"); + } + break; + case 3: + if (automatonCheck()) + renderParts(hidden.automatonParts, inventoryData, storageData); + break; + case 4: + if (automatonCheck()) + renderPartsNumbers(hidden.automatonParts, inventoryData, storageData); + break; + case 5: + if (automatonCheck()) + renderCount("Automaton parts", hidden.automatonParts, inventoryData, storageData); + break; + case 6: + if (automatonCheck()) + renderPercent("Automaton parts", hidden.automatonParts, inventoryData, storageData); + break; + case 7: + if (divanCheck()) + renderParts(hidden.divanMinesParts, inventoryData, storageData); + break; + case 8: + if (divanCheck()) + renderPartsNumbers(hidden.divanMinesParts, inventoryData, storageData); + break; + case 9: + if (divanCheck()) + renderCount("Mines of Divan parts", hidden.divanMinesParts, inventoryData, storageData); + break; + case 10: + if (divanCheck()) + renderPercent("Mines of Divan parts", hidden.divanMinesParts, inventoryData, storageData); + break; + } + } + } + + private void renderParts(HashMap parts, HashMap inventoryData, HashMap storageData) { + for (String part : parts.keySet()) { + if (parts.get(part)) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDoneColor] + "Done"); + else if (inventoryData.get(part) >= 1) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowInventoryColor] + "In Inventory"); + else if (storageData.get(part) >= 1) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowStorageColor] + "In Storage"); + else + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMissingColor] + "Missing"); + } + } + + private void renderPartsNumbers(HashMap parts, HashMap inventoryData, HashMap storageData) { + for (String part : parts.keySet()) { + if (parts.get(part)) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDoneColor] + (inventoryData.get(part) + storageData.get(part))); + else if (inventoryData.get(part) >= 1) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowInventoryColor] + (inventoryData.get(part) + storageData.get(part))); + else if (storageData.get(part) >= 1) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowStorageColor] + (inventoryData.get(part) + storageData.get(part))); + else + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMissingColor] + (inventoryData.get(part) + storageData.get(part))); + } + } + + private void renderCount(String text, HashMap parts, HashMap inventoryData, HashMap storageData) { + int count = getCount(parts, inventoryData, storageData); + float percent = (float) count / parts.size() * 100; + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + text + ": " + getColor(percent) + count + + "/" + parts.size()); + } + + private void renderPercent(String text, HashMap parts, HashMap inventoryData, HashMap storageData) { + int count = getCount(parts, inventoryData, storageData); + float percent = (float) count / parts.size() * 100; + DecimalFormat df = new DecimalFormat("#.#"); + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + text + ": " + getColor(percent) + + df.format(percent) + "%"); + } + + private EnumChatFormatting getColor(float percent) { + if (percent >= 66) + return EnumChatFormatting.GREEN; + else if (percent >= 33) + return EnumChatFormatting.YELLOW; + else + return EnumChatFormatting.RED; + } + + private int getCount(HashMap parts, HashMap inventoryData, HashMap storageData) { + int count = 0; + for (String part : parts.keySet()) + if (parts.get(part) || inventoryData.get(part) > 0 || storageData.get(part) > 0) + count++; + return count; + } + + private int getCountCrystal(HashMap parts) { + int count = 0; + for (String part : parts.keySet()) + if (parts.get(part) > 0) + count++; + return count; + } + + private boolean automatonCheck() { + return NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAutomatonLocation == 0 || + NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAutomatonLocation == 1 && + SBInfo.getInstance().location.equals("Precursor Remnants") || + NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAutomatonLocation >= 1 && + SBInfo.getInstance().location.equals("Lost Precursor City"); + } + + private boolean divanCheck() { + return NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDivanLocation == 0 || + NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDivanLocation == 1 && + SBInfo.getInstance().location.equals("Mithril Deposits") || + NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDivanLocation >= 1 && + SBInfo.getInstance().location.equals("Mines of Divan"); + } + + private boolean crystalCheck() { + return true; + } + + public void message(String message) { + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); + if (hidden == null) return; + + Matcher crystalNotPlacedMatcher = crystalNotPlacedPattern.matcher(message); + Matcher crystalPlacedMatcher = crystalPlacedPattern.matcher(message); + Matcher crystalPlaceMatcher = crystalPlacePattern.matcher(message); + Matcher crystalReclaimMatcher = crystalReclaimPattern.matcher(message); + if(message.equals(" You've earned a Crystal Loot Bundle!")) + hidden.crystals.replaceAll((k,v) -> 0); + if (crystalNotPlacedMatcher.matches() && hidden.crystals.containsKey(crystalNotPlacedMatcher.group("crystal"))) { + hidden.crystals.put(crystalNotPlacedMatcher.group("crystal"), 1); + resetCrystal(hidden, crystalNotPlacedMatcher.group("crystal")); + } else if (crystalPlacedMatcher.matches() && hidden.crystals.containsKey(crystalPlacedMatcher.group("crystal"))) { + hidden.crystals.put(crystalPlacedMatcher.group("crystal"), 2); + resetCrystal(hidden, crystalPlacedMatcher.group("crystal")); + } else if (crystalPlaceMatcher.matches() && hidden.crystals.containsKey(crystalPlaceMatcher.group("crystal"))) + hidden.crystals.put(crystalPlaceMatcher.group("crystal"), 2); + else if (crystalReclaimMatcher.matches() && hidden.crystals.containsKey(crystalReclaimMatcher.group("crystal"))) + hidden.crystals.put(crystalReclaimMatcher.group("crystal"), 1); + else if (message.startsWith("[NPC] Keeper of ")) { + Matcher foundMatcher = foundPattern.matcher(message); + Matcher alreadyFoundMatcher = alreadyFoundPattern.matcher(message); + Matcher notFoundMatcher = notFoundPattern.matcher(message); + Matcher resetMatcher = resetPattern.matcher(message); + if (foundMatcher.matches() && hidden.divanMinesParts.containsKey(foundMatcher.group("item"))) + hidden.divanMinesParts.put(foundMatcher.group("item"), true); + else if (notFoundMatcher.matches() && hidden.divanMinesParts.containsKey(notFoundMatcher.group("item"))) + hidden.divanMinesParts.put(notFoundMatcher.group("item"), false); + else if (resetMatcher.matches()) + hidden.divanMinesParts.replaceAll((k, v) -> false); + else if (alreadyFoundMatcher.matches() && hidden.divanMinesParts.containsKey(alreadyFoundMatcher.group("item"))) + hidden.divanMinesParts.put(alreadyFoundMatcher.group("item"), true); + } else if (message.startsWith(" ")) { + Matcher crystalMatcher = obtainCrystalPattern.matcher(message); + if (crystalMatcher.matches()) + if (hidden.crystals.containsKey(crystalMatcher.group("crystal"))) + hidden.crystals.put(crystalMatcher.group("crystal"), 1); + else { + String item = message.replace(" ", ""); + if (hidden.divanMinesParts.containsKey(item)) + hidden.divanMinesParts.put(item, false); + } + } else if (message.startsWith("[NPC] Professor Robot: ")) { + switch (message) { + case "[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:": + hidden.automatonParts.replaceAll((k, v) -> true); + break; + case "[NPC] Professor Robot: You've brought me all of the components!": + hidden.automatonParts.replaceAll((k, v) -> false); + break; + default: + Matcher giveMatcher = givePattern.matcher(message); + Matcher notFinalMatcher = notFinalPattern.matcher(message); + if (giveMatcher.matches()) { + String item = giveMatcher.group("part"); + if (hidden.automatonParts.containsKey(item)) { + hidden.automatonParts.put(item, true); + } + } else if (notFinalMatcher.matches()) { + String item = notFinalMatcher.group("part"); + if (hidden.automatonParts.containsKey(item)) { + hidden.automatonParts.replaceAll((k, v) -> true); + hidden.automatonParts.put(item, false); + } + } + break; + } + } + } + + private void resetCrystal(NEUConfig.HiddenProfileSpecific hidden, String crystal) { + switch (crystal) { + case "Sapphire": + hidden.automatonParts.replaceAll((k, v) -> false); + break; + case "Jade": + hidden.divanMinesParts.replaceAll((k, v) -> false); + break; + } + } + + @Override + protected void renderLine(String line, Vector2f position, boolean dummy) { + if (!NotEnoughUpdates.INSTANCE.config.mining.crystalHollowIcons) return; + GlStateManager.enableDepth(); + + ItemStack icon = null; + String cleaned = Utils.cleanColour(line); + String beforeColon = cleaned.split(":")[0]; + switch (beforeColon) { + case "Scavenged Lapis Sword": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_LAPIS_SWORD")); + break; + case "Scavenged Golden Hammer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_GOLD_HAMMER")); + break; + case "Scavenged Diamond Axe": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_DIAMOND_AXE")); + break; + case "Scavenged Emerald Hammer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_EMERALD_HAMMER")); + break; + case "Electron Transmitter": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ELECTRON_TRANSMITTER")); + break; + case "FTX 3070": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("FTX_3070")); + break; + case "Robotron Reflector": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ROBOTRON_REFLECTOR")); + break; + case "Superlite Motor": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SUPERLITE_MOTOR")); + break; + case "Control Switch": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("CONTROL_SWITCH")); + break; + case "Synthetic Heart": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SYNTHETIC_HEART")); + break; + case "Amber": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_AMBER_GEM")); + break; + case "Sapphire": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_SAPPHIRE_GEM")); + break; + case "Jade": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_JADE_GEM")); + break; + case "Amethyst": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_AMETHYST_GEM")); + break; + case "Topaz": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_TOPAZ_GEM")); + break; + } + + if (icon != null) { + GlStateManager.pushMatrix(); + GlStateManager.translate(position.x, position.y, 0); + GlStateManager.scale(0.5f, 0.5f, 1f); + Utils.drawItemStack(icon, 0, 0); + GlStateManager.popMatrix(); + + position.x += 12; + } + + super.renderLine(line, position, dummy); + } + + @Override + protected Vector2f getSize(List strings) { + if (NotEnoughUpdates.INSTANCE.config.mining.crystalHollowIcons) + return super.getSize(strings).translate(12, 0); + return super.getSize(strings); + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java deleted file mode 100644 index 85ac2f82..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/DivanMinesOverlay.java +++ /dev/null @@ -1,142 +0,0 @@ -package io.github.moulberry.notenoughupdates.overlays; - -import io.github.moulberry.notenoughupdates.NotEnoughUpdates; -import io.github.moulberry.notenoughupdates.core.config.Position; -import io.github.moulberry.notenoughupdates.miscfeatures.StorageManager; -import io.github.moulberry.notenoughupdates.options.NEUConfig; -import io.github.moulberry.notenoughupdates.util.SBInfo; -import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import org.lwjgl.util.vector.Vector2f; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Supplier; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class DivanMinesOverlay extends TextOverlay { - private static final Minecraft mc = Minecraft.getMinecraft(); - private final StorageManager storageManager = StorageManager.getInstance(); - private final Pattern notFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Talk to me when you have found a (?[a-z-A-Z ]+)!"); - private final Pattern foundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: Excellent! You have returned the (?[a-z-A-Z ]+) to its rightful place!"); - private final Pattern resetPattern = Pattern.compile("\\[NPC] Keeper of \\w+: (You haven't placed the Jade Crystal yet!|You found all of the items! Behold\\.\\.\\. the Jade Crystal!|You have already placed the Jade Crystal!)"); - private final Pattern alreadyFoundPattern = Pattern.compile("\\[NPC] Keeper of \\w+: You have already restored this Dwarf's (?[a-z-A-Z ]+)!"); - - public DivanMinesOverlay(Position position, Supplier> dummyStrings, Supplier styleSupplier) { - super(position, dummyStrings, styleSupplier); - } - - @Override - public void update() { - overlayStrings = null; - if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlay || SBInfo.getInstance().getLocation() == null || - !SBInfo.getInstance().getLocation().equals("crystal_hollows") || !SBInfo.getInstance().location.equals("Mines of Divan")) - return; - - NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); - if (hidden == null) return; - overlayStrings = new ArrayList<>(); - HashMap states = new HashMap<>(); - for (String key : hidden.divanMinesParts.keySet()) { - Boolean has = hidden.divanMinesParts.get(key); - if (has) - states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesDoneColor] + "Done"); - } - for (ItemStack item : mc.thePlayer.inventory.mainInventory) { - if (item != null) { - String name = Utils.cleanColour(item.getDisplayName()); - if (!states.containsKey(name)) { - states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesInventoryColor] + "In Inventory"); - } - } - } - for (Map.Entry entry : storageManager.storageConfig.displayToStorageIdMap.entrySet()) { - int storageId = entry.getValue(); - StorageManager.StoragePage page = storageManager.getPage(storageId, false); - if (page != null && page.rows > 0) { - for (ItemStack item : page.items) { - if (item != null) { - String name = Utils.cleanColour(item.getDisplayName()); - if (!states.containsKey(name)) { - states.put(name, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesStorageColor] + "In Storage"); - } - } - } - } - } - for (String key : hidden.divanMinesParts.keySet()) { - if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesHideDone || !hidden.divanMinesParts.get(key)) { - if (!states.containsKey(key)) - states.put(key, EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesMissingColor] + "Missing"); - overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.divanMinesPartColor] + key + ": " + states.get(key)); - } - } - } - - public void message(String message) { - NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); - if (hidden == null) return; - Matcher foundMatcher = foundPattern.matcher(message); - Matcher alreadyFoundMatcher = alreadyFoundPattern.matcher(message); - Matcher notFoundMatcher = notFoundPattern.matcher(message); - Matcher resetMatcher = resetPattern.matcher(message); - System.out.println(message); - if (foundMatcher.matches() && hidden.divanMinesParts.containsKey(foundMatcher.group("item"))) - hidden.divanMinesParts.put(foundMatcher.group("item"), true); - else if (notFoundMatcher.matches() && hidden.divanMinesParts.containsKey(notFoundMatcher.group("item"))) - hidden.divanMinesParts.put(notFoundMatcher.group("item"), false); - else if (resetMatcher.matches()) - hidden.divanMinesParts.replaceAll((k, v) -> false); - else if (alreadyFoundMatcher.matches() && hidden.divanMinesParts.containsKey(alreadyFoundMatcher.group("item"))) - hidden.divanMinesParts.put(alreadyFoundMatcher.group("item"), true); - } - - @Override - protected void renderLine(String line, Vector2f position, boolean dummy) { - if (!NotEnoughUpdates.INSTANCE.config.mining.divanMinesIcons) return; - GlStateManager.enableDepth(); - - ItemStack icon = null; - String cleaned = Utils.cleanColour(line); - String beforeColon = cleaned.split(":")[0]; - switch (beforeColon) { - case "Scavenged Lapis Sword": - icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_LAPIS_SWORD")); - break; - case "Scavenged Golden Hammer": - icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_GOLD_HAMMER")); - break; - case "Scavenged Diamond Axe": - icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_DIAMOND_AXE")); - break; - case "Scavenged Emerald Hammer": - icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DWARVEN_EMERALD_HAMMER")); - break; - } - - if (icon != null) { - GlStateManager.pushMatrix(); - GlStateManager.translate(position.x, position.y, 0); - GlStateManager.scale(0.5f, 0.5f, 1f); - Utils.drawItemStack(icon, 0, 0); - GlStateManager.popMatrix(); - - position.x += 12; - } - - super.renderLine(line, position, dummy); - } - - @Override - protected Vector2f getSize(List strings) { - if (NotEnoughUpdates.INSTANCE.config.mining.divanMinesIcons) - return super.getSize(strings).translate(12, 0); - return super.getSize(strings); - } -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java index 0aa0d273..8ff0bff2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -16,8 +16,7 @@ public class OverlayManager { public static PetInfoOverlay petInfoOverlay; public static TimersOverlay timersOverlay; public static BonemerangOverlay bonemerangOverlay; - public static AutomatonOverlay automatonOverlay; - public static DivanMinesOverlay divanMinesOverlay; + public static CrystalHollowOverlay crystalHollowOverlay; public static final List textOverlays = new ArrayList<>(); static { @@ -38,13 +37,13 @@ public class OverlayManager { "\u00a73Experiments: \u00a7e3h38m"); textOverlays.add(timersOverlay = new TimersOverlay(NotEnoughUpdates.INSTANCE.config.miscOverlays.todoPosition, () -> { List strings = new ArrayList<>(); - for(int i : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText2) { - if(i >= 0 && i < todoDummy.size()) strings.add(todoDummy.get(i)); + for (int i : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText2) { + if (i >= 0 && i < todoDummy.size()) strings.add(todoDummy.get(i)); } return strings; }, () -> { int style = NotEnoughUpdates.INSTANCE.config.miscOverlays.todoStyle; - if(style >= 0 && style < TextOverlayStyle.values().length) { + if (style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } return TextOverlayStyle.BACKGROUND; @@ -56,13 +55,13 @@ public class OverlayManager { "\u00a73Forge 2) \u00a77EMPTY\n\u00a73Forge 3) \u00a77EMPTY\n\u00a73Forge 4) \u00a77EMPTY"); miningOverlay = new MiningOverlay(NotEnoughUpdates.INSTANCE.config.mining.overlayPosition, () -> { List strings = new ArrayList<>(); - for(int i : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText) { - if(i >= 0 && i < miningDummy.size()) strings.add(miningDummy.get(i)); + for (int i : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText) { + if (i >= 0 && i < miningDummy.size()) strings.add(miningDummy.get(i)); } return strings; }, () -> { int style = NotEnoughUpdates.INSTANCE.config.mining.overlayStyle; - if(style >= 0 && style < TextOverlayStyle.values().length) { + if (style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } return TextOverlayStyle.BACKGROUND; @@ -77,13 +76,13 @@ public class OverlayManager { "\u00a7bYaw: \u00a7e68.25\u00a7l\u1D52"); farmingOverlay = new FarmingOverlay(NotEnoughUpdates.INSTANCE.config.skillOverlays.farmingPosition, () -> { List strings = new ArrayList<>(); - for(int i : NotEnoughUpdates.INSTANCE.config.skillOverlays.farmingText) { - if(i >= 0 && i < farmingDummy.size()) strings.add(farmingDummy.get(i)); + for (int i : NotEnoughUpdates.INSTANCE.config.skillOverlays.farmingText) { + if (i >= 0 && i < farmingDummy.size()) strings.add(farmingDummy.get(i)); } return strings; }, () -> { int style = NotEnoughUpdates.INSTANCE.config.skillOverlays.farmingStyle; - if(style >= 0 && style < TextOverlayStyle.values().length) { + if (style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } return TextOverlayStyle.BACKGROUND; @@ -99,13 +98,13 @@ public class OverlayManager { "\u00a7bUntil L100: \u00a7e2d13h"); petInfoOverlay = new PetInfoOverlay(NotEnoughUpdates.INSTANCE.config.petOverlay.petInfoPosition, () -> { List strings = new ArrayList<>(); - for(int i : NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText) { - if(i >= 0 && i < petInfoDummy.size()) strings.add(petInfoDummy.get(i)); + for (int i : NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText) { + if (i >= 0 && i < petInfoDummy.size()) strings.add(petInfoDummy.get(i)); } return strings; }, () -> { int style = NotEnoughUpdates.INSTANCE.config.petOverlay.petInfoOverlayStyle; - if(style >= 0 && style < TextOverlayStyle.values().length) { + if (style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } return TextOverlayStyle.BACKGROUND; @@ -117,34 +116,53 @@ public class OverlayManager { ); bonemerangOverlay = new BonemerangOverlay(NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangPosition, () -> bonemerangDummy, () -> { int style = NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangOverlayStyle; - if(style >= 0 && style < TextOverlayStyle.values().length) { + if (style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } return TextOverlayStyle.BACKGROUND; }); - List automatonOverlayDummy = Lists.newArrayList( - "\u00a73Electron Transmitter: \u00a7aDone", - "\u00a73Robotron Reflector: \u00a7eIn Storage", - "\u00a73Superlite Motor: \u00a7eIn Inventory", - "\u00a73Synthetic Hearth: \u00a7cMissing", - "\u00a73Control Switch: \u00a7cMissing", - "\u00a73FTX 3070: \u00a7cMissing"); - automatonOverlay = new AutomatonOverlay(NotEnoughUpdates.INSTANCE.config.mining.automatonOverlayPosition, () -> automatonOverlayDummy, () -> { - int style = NotEnoughUpdates.INSTANCE.config.mining.automatonOverlayStyle; - if(style >= 0 && style < TextOverlayStyle.values().length) { - return TextOverlayStyle.values()[style]; - } - return TextOverlayStyle.BACKGROUND; - }); - List divanMinesOverlayDummy = Lists.newArrayList( - "\u00a73Scavenged Lapis Sword: \u00a7aDone", - "\u00a73Scavenged Golden Hammer: \u00a7eIn Storage", - "\u00a73Scavenged Diamond Axe: \u00a7eIn Inventory", - "\u00a73Scavenged Emerald Hammer: \u00a7cMissing" + List crystalHollowOverlayDummy = Lists.newArrayList( + "\u00a73Amber Crystal: \u00a7aPlaced\n" + + "\u00a73Sapphire Crystal: \u00a7eCollected\n" + + "\u00a73Jade Crystal: \u00a7eMissing\n" + + "\u00a73Amethyst Crystal: \u00a7cMissing\n" + + "\u00a73Topaz Crystal: \u00a7cMissing\n", + "\u00a73Crystals: \u00a7a4/5", + "\u00a73Crystals: \u00a7a80%", + "\u00a73Electron Transmitter: \u00a7aDone\n" + + "\u00a73Robotron Reflector: \u00a7eIn Storage\n" + + "\u00a73Superlite Motor: \u00a7eIn Inventory\n" + + "\u00a73Synthetic Hearth: \u00a7cMissing\n" + + "\u00a73Control Switch: \u00a7cMissing\n" + + "\u00a73FTX 3070: \u00a7cMissing", + "\u00a73Electron Transmitter: \u00a7a3\n" + + "\u00a73Robotron Reflector: \u00a7e2\n" + + "\u00a73Superlite Motor: \u00a7e1\n" + + "\u00a73Synthetic Hearth: \u00a7c0\n" + + "\u00a73Control Switch: \u00a7c0\n" + + "\u00a73FTX 3070: \u00a7c0", + "\u00a73Automaton parts: \u00a7a5/6", + "\u00a73Automaton parts: \u00a7a83%", + "\u00a73Scavenged Lapis Sword: \u00a7aDone\n" + + "\u00a73Scavenged Golden Hammer: \u00a7eIn Storage\n" + + "\u00a73Scavenged Diamond Axe: \u00a7eIn Inventory\n" + + "\u00a73Scavenged Emerald Hammer: \u00a7cMissing\n", + "\u00a73Scavenged Lapis Sword: \u00a7a3\n" + + "\u00a73Scavenged Golden Hammer: \u00a7e2\n" + + "\u00a73Scavenged Diamond Axe: \u00a7e1\n" + + "\u00a73Scavenged Emerald Hammer: \u00a7c0\n", + "\u00a73Mines of Divan parts: \u00a7a3/4", + "\u00a73Mines of Divan parts: \u00a7a75%" ); - divanMinesOverlay = new DivanMinesOverlay(NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlayPosition, () -> divanMinesOverlayDummy, () -> { - int style = NotEnoughUpdates.INSTANCE.config.mining.divanMinesOverlayStyle; - if(style >= 0 && style < TextOverlayStyle.values().length) { + crystalHollowOverlay = new CrystalHollowOverlay(NotEnoughUpdates.INSTANCE.config.mining.crystalHollowOverlayPosition, () -> { + List strings = new ArrayList<>(); + for (int i : NotEnoughUpdates.INSTANCE.config.mining.crystalHollowText) { + if (i >= 0 && i < crystalHollowOverlayDummy.size()) strings.add(crystalHollowOverlayDummy.get(i)); + } + return strings; + }, () -> { + int style = NotEnoughUpdates.INSTANCE.config.mining.crystalHollowOverlayStyle; + if (style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } return TextOverlayStyle.BACKGROUND; @@ -154,8 +172,7 @@ public class OverlayManager { textOverlays.add(farmingOverlay); textOverlays.add(petInfoOverlay); textOverlays.add(bonemerangOverlay); - textOverlays.add(automatonOverlay); - textOverlays.add(divanMinesOverlay); + textOverlays.add(crystalHollowOverlay); } } -- cgit From 3328e7a98404b1968b6e1c76495b449969518414 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 24 Aug 2021 11:05:07 +0200 Subject: Update CrystalHollowOverlay.java --- .../overlays/CrystalHollowOverlay.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java index 3dadca29..87d0d8fe 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java @@ -251,8 +251,8 @@ public class CrystalHollowOverlay extends TextOverlay { Matcher crystalPlacedMatcher = crystalPlacedPattern.matcher(message); Matcher crystalPlaceMatcher = crystalPlacePattern.matcher(message); Matcher crystalReclaimMatcher = crystalReclaimPattern.matcher(message); - if(message.equals(" You've earned a Crystal Loot Bundle!")) - hidden.crystals.replaceAll((k,v) -> 0); + if (message.equals(" You've earned a Crystal Loot Bundle!")) + hidden.crystals.replaceAll((k, v) -> 0); if (crystalNotPlacedMatcher.matches() && hidden.crystals.containsKey(crystalNotPlacedMatcher.group("crystal"))) { hidden.crystals.put(crystalNotPlacedMatcher.group("crystal"), 1); resetCrystal(hidden, crystalNotPlacedMatcher.group("crystal")); @@ -278,14 +278,13 @@ public class CrystalHollowOverlay extends TextOverlay { hidden.divanMinesParts.put(alreadyFoundMatcher.group("item"), true); } else if (message.startsWith(" ")) { Matcher crystalMatcher = obtainCrystalPattern.matcher(message); - if (crystalMatcher.matches()) - if (hidden.crystals.containsKey(crystalMatcher.group("crystal"))) - hidden.crystals.put(crystalMatcher.group("crystal"), 1); - else { - String item = message.replace(" ", ""); - if (hidden.divanMinesParts.containsKey(item)) - hidden.divanMinesParts.put(item, false); - } + if (crystalMatcher.matches() && hidden.crystals.containsKey(crystalMatcher.group("crystal"))) + hidden.crystals.put(crystalMatcher.group("crystal"), 1); + else { + String item = message.replace(" ", ""); + if (hidden.divanMinesParts.containsKey(item)) + hidden.divanMinesParts.put(item, false); + } } else if (message.startsWith("[NPC] Professor Robot: ")) { switch (message) { case "[NPC] Professor Robot: That's not one of the components I need! Bring me one of the missing components:": -- cgit From c2406f7c5477a8e221fc8bd93de1a872671c46ae Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 24 Aug 2021 11:43:37 +0200 Subject: I am idiot --- .../moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java index 87d0d8fe..3d65b762 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java @@ -282,8 +282,8 @@ public class CrystalHollowOverlay extends TextOverlay { hidden.crystals.put(crystalMatcher.group("crystal"), 1); else { String item = message.replace(" ", ""); - if (hidden.divanMinesParts.containsKey(item)) - hidden.divanMinesParts.put(item, false); + if (hidden.automatonParts.containsKey(item)) + hidden.automatonParts.put(item, false); } } else if (message.startsWith("[NPC] Professor Robot: ")) { switch (message) { -- cgit From a48012a509a3733d908fc0a23ce07335ccb4493e Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 24 Aug 2021 14:23:13 +0200 Subject: Very cool forge display test --- .../notenoughupdates/options/NEUConfig.java | 1 + .../options/seperateSections/Mining.java | 24 ++ .../notenoughupdates/overlays/MiningOverlay.java | 246 ++++++++++++++++++++- .../notenoughupdates/overlays/TimersOverlay.java | 1 - 4 files changed, 262 insertions(+), 10 deletions(-) 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 ee24472f..cbf92fb2 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -335,6 +335,7 @@ public class NEUConfig extends Config { @Expose public long commissionsCompleted = 0L; @Expose public long experimentsCompleted = 0L; @Expose public long cookieBuffRemaining = 0L; + @Expose public List forgeItems = new ArrayList(); @Expose public int commissionMilestone = 0; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index 0609f970..57db90c6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -139,6 +139,30 @@ public class Mining { @ConfigAccordionId(id = 2) public int overlayStyle = 0; + + @Expose + @ConfigOption( + name = "Forge Display", + desc = "Change what gets shown in the Forge Display" + ) + @ConfigEditorDropdown( + values = {"Only Done", "Only Working", "Everything Except Locked", "Everything"} + ) + @ConfigAccordionId(id = 2) + public int forgeDisplay = 1; + + @Expose + @ConfigOption( + name = "Forge Location", + desc = "Change when the forge display gets shown" + ) + @ConfigEditorDropdown( + values = {"Dwarven mines", "DM+Crystal Hollows", "Everywhere except dungeons", "Everywhere"} + ) + @ConfigAccordionId(id = 2) + public int forgeDisplayLocation = 0; + + @ConfigOption( name = "Metal Detector Solver", desc = "" diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index e6bc90ad..bc435ad9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -3,12 +3,14 @@ package io.github.moulberry.notenoughupdates.overlays; import com.google.common.collect.ComparisonChain; import com.google.common.collect.Ordering; import com.google.gson.JsonObject; +import com.google.gson.annotations.Expose; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils; import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; import io.github.moulberry.notenoughupdates.miscfeatures.ItemCooldowns; +import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -22,6 +24,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.WorldSettings; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.Sys; import java.util.*; import java.util.function.Supplier; @@ -85,9 +88,12 @@ public class MiningOverlay extends TextOverlay { } } + private static final Pattern timeRemainingForge = Pattern.compile("\\xA77Time Remaining: \\xA7a((?Completed!)|(((?[0-9]+)d)? ?((?[0-9]+)h)? ?((?[0-9]+)m)? ?((?[0-9]+)s)?))"); + private static final Pattern timeRemainingTab = Pattern.compile(".*[1-5]\\) (?.*): ((?Ready!)|(((?[0-9]+)d)? ?((?[0-9]+)h)? ?((?[0-9]+)m)? ?((?[0-9]+)s)?))"); @Override public void update() { overlayStrings = null; + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); /*if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; @@ -155,20 +161,86 @@ public class MiningOverlay extends TextOverlay { } }*/ + if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) { + GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; + ContainerChest container = (ContainerChest) chest.inventorySlots; + IInventory lower = container.getLowerChestInventory(); + String containerName = lower.getDisplayName().getUnformattedText(); + if(containerName.equals("Forge") && lower.getSizeInventory() >= 36 && hidden != null){ + + itemLoop: + for (int i = 0; i < 5; i++) { + ItemStack stack = lower.getStackInSlot(i+11); + if(stack != null) { + + String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); + + + for (int i1 = 0; i1 < lore.length; i1++) { + String line = lore[i1]; + Matcher matcher = timeRemainingForge.matcher(line); + if (stack.getDisplayName().matches("\\xA7cSlot #([1-5])")){ + ForgeItem newForgeItem = new ForgeItem("Locked", 0,1, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + //empty Slot + } else if(stack.getDisplayName().matches("\\xA7aSlot #([1-5])")){ + ForgeItem newForgeItem = new ForgeItem("Empty", 0,0, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + } else if(matcher.matches()){ + String timeremainingString = matcher.group(1); + + long duration = 0; + + if(matcher.group("Completed")!= null && !matcher.group("Completed").equals("")){ + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), 0, 2, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + } else { + + try { + if (matcher.group("days") != null && !matcher.group("days").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("days")) * 24 * 60 * 60 * 1000; + } + if (matcher.group("hours") != null && !matcher.group("hours").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("hours")) * 60 * 60 * 1000; + } + if (matcher.group("minutes") != null && !matcher.group("minutes").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("minutes")) * 60 * 1000; + } + if (matcher.group("seconds") != null && !matcher.group("seconds").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("seconds")) * 1000; + } + } catch (Exception ignored) { + } + if (duration > 0) { + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), System.currentTimeMillis() + duration, 2, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + } + } + + continue itemLoop; + } + } + //Locked Slot + + } + } + } + } + if(!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay && NotEnoughUpdates.INSTANCE.config.mining.emissaryWaypoints == 0) return; if(SBInfo.getInstance().getLocation() == null) return; if(!SBInfo.getInstance().getLocation().equals("mining_3") && !SBInfo.getInstance().getLocation().equals("crystal_hollows")) return; overlayStrings = new ArrayList<>(); commissionProgress.clear(); - List forgeStrings = new ArrayList<>(); - List forgeStringsEmpty = new ArrayList<>(); + String mithrilPowder = null; String gemstonePowder = null; - + int forgeInt = 0; boolean commissions = false; boolean forges = false; List players = playerOrdering.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); + for(NetworkPlayerInfo info : players) { String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info); if(name.contains("Mithril Powder:")) { @@ -188,16 +260,57 @@ public class MiningOverlay extends TextOverlay { } String clean = StringUtils.cleanColour(name); if(forges && clean.startsWith(" ")) { + char firstChar = clean.trim().charAt(0); if(firstChar < '0' || firstChar > '9') { forges = false; } else { - if(name.contains("LOCKED")) continue; - if(name.contains("EMPTY")) { - forgeStringsEmpty.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); + + if(name.contains("LOCKED")) { + ForgeItem item = new ForgeItem("Locked", 0,1, forgeInt, true); + replaceForgeOrAdd(item, hidden.forgeItems, true); + } else if(name.contains("EMPTY")) { + ForgeItem item = new ForgeItem("Empty", 0,0, forgeInt, true); + replaceForgeOrAdd(item, hidden.forgeItems, true); + //forgeStringsEmpty.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); } else { - forgeStrings.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); + String cleanName = Utils.cleanColour(name); + + Matcher matcher = timeRemainingTab.matcher(cleanName); + + if(matcher.matches()){ + + String itemName = matcher.group(1); + + if(matcher.group("Ready") != null && !matcher.group("Ready").equals("")){ + ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), 0, 2, forgeInt, true); + replaceForgeOrAdd(item, hidden.forgeItems, true); + } else { + long duration = 0; + try { + if (matcher.group("days") != null && !matcher.group("days").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("days")) * 24 * 60 * 60 * 1000; + } + if (matcher.group("hours") != null && !matcher.group("hours").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("hours")) * 60 * 60 * 1000; + } + if (matcher.group("minutes") != null && !matcher.group("minutes").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("minutes")) * 60 * 1000; + } + if (matcher.group("seconds") != null && !matcher.group("seconds").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("seconds")) * 1000; + } + } catch (Exception ignored) { + } + if (duration > 0) { + duration = duration + 4000; + ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), System.currentTimeMillis() + duration, 2, forgeInt, true); + replaceForgeOrAdd(item, hidden.forgeItems, false); + } + } + } } + forgeInt++; } } else if(commissions && clean.startsWith(" ")) { String[] split = clean.trim().split(": "); @@ -269,6 +382,8 @@ public class MiningOverlay extends TextOverlay { pickaxeCooldown = DARK_AQUA+"Pickaxe CD: \u00a7a" + (ItemCooldowns.pickaxeUseCooldownMillisRemaining/1000) + "s"; } + + for(int index : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText) { switch(index) { case 0: @@ -278,9 +393,9 @@ public class MiningOverlay extends TextOverlay { case 2: overlayStrings.add(gemstonePowder); break; case 3: - overlayStrings.addAll(forgeStrings); break; + overlayStrings.addAll(getForgeStrings(hidden.forgeItems)); break; case 4: - overlayStrings.addAll(forgeStringsEmpty); break; + //overlayStrings.addAll(forgeStringsEmpty); break; case 5: overlayStrings.add(pickaxeCooldown); break; } @@ -289,6 +404,119 @@ public class MiningOverlay extends TextOverlay { if(overlayStrings.isEmpty()) overlayStrings = null; } + private static List getForgeStrings(List forgeItems){ + List forgeString = new ArrayList<>(); + long currentTimeMillis = System.currentTimeMillis(); + forgeIDLabel: + for (int i = 0; i < 5; i++) { + for (int y = 0; y < forgeItems.size(); y++) { + if (forgeItems.get(y).forgeID == i) { + ForgeItem item = forgeItems.get(y); + if (NotEnoughUpdates.INSTANCE.config.mining.forgeDisplay == 0) { + if (item.status == 2 && item.finishTime < currentTimeMillis) { + + forgeString.add(item.getFormattedString(currentTimeMillis)); + continue forgeIDLabel; + } + } else if (NotEnoughUpdates.INSTANCE.config.mining.forgeDisplay == 1) { + if (item.status == 2) { + + forgeString.add(item.getFormattedString(currentTimeMillis)); + continue forgeIDLabel; + } + } else if (NotEnoughUpdates.INSTANCE.config.mining.forgeDisplay == 2) { + if (item.status == 2 || item.status ==0) { + + forgeString.add(item.getFormattedString(currentTimeMillis)); + continue forgeIDLabel; + } + } else if (NotEnoughUpdates.INSTANCE.config.mining.forgeDisplay == 3) { + + forgeString.add(item.getFormattedString(currentTimeMillis)); + continue forgeIDLabel; + } + } + } + } + return forgeString; + } + + private static void replaceForgeOrAdd(ForgeItem item, List forgeItems, boolean overwrite){ + for (int i = 0; i < forgeItems.size(); i++) { + if (forgeItems.get(i).forgeID == item.forgeID) { + if (overwrite) { + forgeItems.set(i, item); + return; + } else { + ForgeItem currentItem = forgeItems.get(i); + if (!(currentItem.status == 2 && item.status ==2)) { + forgeItems.set(i, item); + return; + } else if(currentItem.fromScoreBoard){ + forgeItems.set(i, item); + return; + } + } + return; + } + } + forgeItems.add(item); + return; + } + + public static class ForgeItem{ + public ForgeItem(String itemName, long finishTime, int status, int forgeID, boolean fromScoreBoard){ + this.itemName = itemName; + this.finishTime = finishTime; + this.status = status; + this.forgeID = forgeID; + this.fromScoreBoard = fromScoreBoard; + } + + + @Expose public final String itemName; + @Expose public final long finishTime; + @Expose public final int status; + @Expose public final int forgeID; + @Expose public final boolean fromScoreBoard; + + + + public String getFormattedString(long currentTimeMillis){ + String returnText = EnumChatFormatting.AQUA+"Forge "+(this.forgeID+1)+": "; + if(status == 0){ + return returnText +EnumChatFormatting.GRAY +"Empty"; + } else if(status == 1){ + return returnText+ EnumChatFormatting.DARK_RED+"Locked"; + } + + long timeDuration = finishTime - currentTimeMillis; + returnText = returnText+ EnumChatFormatting.DARK_PURPLE +this.itemName+" : "; + + int days = (int) (timeDuration / (1000*60*60*24)); + timeDuration = timeDuration-(days*(1000*60*60*24)); + int hours = (int) ((timeDuration / (1000*60*60)) % 24); + + if(days > 0){ + return returnText+EnumChatFormatting.AQUA+days+"d "+hours+"h"; + } + timeDuration = timeDuration-(hours*(1000*60*60)); + int minutes = (int) ((timeDuration / (1000*60)) % 60); + if(hours > 0){ + return returnText+EnumChatFormatting.AQUA+hours+"h "+minutes+"m"; + } + timeDuration = timeDuration-(minutes*(1000*60)); + int seconds = (int) (timeDuration / 1000) % 60 ; + if(minutes > 0){ + return returnText+EnumChatFormatting.AQUA+minutes+"m "+seconds+"s"; + } else if(seconds > 0){ + return returnText+EnumChatFormatting.AQUA+seconds+"s"; + } else { + return returnText+ EnumChatFormatting.DARK_GREEN+"Done"; + } + } + } + private static final Ordering playerOrdering = Ordering.from(new PlayerComparator()); @SideOnly(Side.CLIENT) 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 c3e33a83..728703ad 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -243,7 +243,6 @@ public class TimersOverlay extends TextOverlay { } if (godpotRemaingTimeUnformatted.length >= 1) { godPotDuration = godPotDuration + (long) Integer.parseInt(godpotRemaingTimeUnformatted[i]) * 1000; - } } catch (Exception ignored) { } -- cgit From 1a142aa574191488b7a4e0af6170bea8ed98ec3f Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 24 Aug 2021 14:56:39 +0200 Subject: finished --- .../options/seperateSections/Mining.java | 146 ++++++++++++++++----- .../overlays/CrystalHollowOverlay.java | 21 +-- 2 files changed, 124 insertions(+), 43 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index 4a4d5e23..e464fd37 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -179,12 +179,12 @@ public class Mining { ) @ConfigEditorBoolean @ConfigAccordionId(id = 6) - public boolean crystalHollowOverlay = false; + public boolean crystalHollowOverlay = true; @Expose @ConfigOption( name = "Position", - desc = "Change the position of the Crystal Hollows Overlay overlay." + desc = "Change the position of the Crystal Hollows Overlay." ) @ConfigEditorButton( runnableId = 10, @@ -195,8 +195,9 @@ public class Mining { @Expose @ConfigOption( - name = "Text", - desc = "\u00a7eDrag text to change the appearance of the overlay" + name = "Options", + desc = "Drag text to change the appearance of the overlay!\n" + + "Click add to add extra things!" ) @ConfigEditorDraggableList( exampleText = { @@ -239,7 +240,7 @@ public class Mining { @Expose @ConfigOption( name = "Style", - desc = "Change the style of the Crystal Hollows Overlay overlay." + desc = "Change the style of the Crystal Hollows Overlay." ) @ConfigEditorDropdown( values = {"Background", "No Shadow", "Shadow", "Full Shadow"} @@ -247,6 +248,34 @@ public class Mining { @ConfigAccordionId(id = 6) public int crystalHollowOverlayStyle = 0; + + @Expose + @ConfigOption( + name = "Show Icons", + desc = "Show icons in the overlay that represent the part." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 6) + public boolean crystalHollowIcons = true; + + + @Expose + @ConfigOption( + name = "Hide Done", + desc = "Don't show parts you've given to the NPC." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 6) + public boolean crystalHollowHideDone = false; + + @ConfigOption( + name = "Locations", + desc = "" + ) + @ConfigEditorAccordion(id = 7) + @ConfigAccordionId(id = 6) + public boolean crystalHollowLocationAccordion = false; + @Expose @ConfigOption( name = "Show Automaton", @@ -255,70 +284,61 @@ public class Mining { @ConfigEditorDropdown( values = {"Crystal Hollows", "Precursor Remnants", "Lost Precursor City"} ) - @ConfigAccordionId(id = 6) + @ConfigAccordionId(id = 7) public int crystalHollowAutomatonLocation = 2; @Expose @ConfigOption( - name = "Show Automaton", - desc = "Change where to show Automaton parts." + name = "Show Divan", + desc = "Change where to show Mines of Divan parts." ) @ConfigEditorDropdown( values = {"Crystal Hollows", "Mithril Deposits", "Mines of Divan"} ) - @ConfigAccordionId(id = 6) + @ConfigAccordionId(id = 7) public int crystalHollowDivanLocation = 2; - @Expose @ConfigOption( - name = "Show Icons", - desc = "Show icons in the overlay that represent the part." + name = "Show Crystal", + desc = "Change where to show Collected Crystals." ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 6) - public boolean crystalHollowIcons = true; - - - @Expose - @ConfigOption( - name = "Hide Done", - desc = "Don't show parts you've given to the NPC." + @ConfigEditorDropdown( + values = {"Crystal Hollows", "When No Other Overlays"} ) - @ConfigEditorBoolean - @ConfigAccordionId(id = 6) - public boolean crystalHollowHideDone = false; + @ConfigAccordionId(id = 7) + public int crystalHollowCrystalLocation = 1; @ConfigOption( name = "Colours", desc = "" ) - @ConfigEditorAccordion(id = 7) + @ConfigEditorAccordion(id = 8) @ConfigAccordionId(id = 6) public boolean crystalHollowColourAccordion = false; @Expose @ConfigOption( - name = "Part colour", - desc = "Change the colour of the part text." + name = "Main Color", + desc = "Change the main color of the overlay." ) @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 7) + @ConfigAccordionId(id = 8) public int crystalHollowPartColor = 3; @Expose @ConfigOption( - name = "Done colour", + name = "Done Color", desc = "Change the colour when the part is given to the NPC." ) @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 7) + @ConfigAccordionId(id = 8) public int crystalHollowDoneColor = 10; @Expose @@ -330,7 +350,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 7) + @ConfigAccordionId(id = 8) public int crystalHollowInventoryColor = 14; @Expose @@ -342,7 +362,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 7) + @ConfigAccordionId(id = 8) public int crystalHollowStorageColor = 14; @Expose @@ -354,9 +374,69 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 7) + @ConfigAccordionId(id = 8) public int crystalHollowMissingColor = 12; + @Expose + @ConfigOption( + name = "Placed Color", + desc = "Change the colour when the crystal is placed." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 8) + public int crystalHollowPlacedColor = 10; + + @Expose + @ConfigOption( + name = "Collected Color", + desc = "Change the colour when the crystal is collected" + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 8) + public int crystalHollowCollectedColor = 14; + + @Expose + @ConfigOption( + name = "All Color", + desc = "Change the colour when you have 2/3-all of the parts collected in the count overlay." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 8) + public int crystalHollowAllColor = 10; + + @Expose + @ConfigOption( + name = "1/3 Color", + desc = "Change the colour when you have 1/3-2/3 of the parts collected in the count overlay." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 8) + public int crystalHollowMiddleColor = 14; + + @Expose + @ConfigOption( + name = "0 Color", + desc = "Change the colour when you have 0-1/3 of the parts collected in the count overlay." + + ) + @ConfigEditorDropdown( + values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} + ) + @ConfigAccordionId(id = 8) + public int crystalHollowNoneColor = 12; + @Expose @ConfigOption( name = "Puzzler Solver", diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java index 3d65b762..f3dfa242 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/CrystalHollowOverlay.java @@ -81,12 +81,13 @@ public class CrystalHollowOverlay extends TextOverlay { for (String part : hidden.crystals.keySet()) { switch (hidden.crystals.get(part)) { case 2: - overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + - EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDoneColor] + "Placed"); + if (!NotEnoughUpdates.INSTANCE.config.mining.crystalHollowHideDone) + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPlacedColor] + "Placed"); break; case 1: overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + - EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowInventoryColor] + "Collected"); + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowCollectedColor] + "Collected"); break; case 0: overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + @@ -100,8 +101,8 @@ public class CrystalHollowOverlay extends TextOverlay { if (crystalCheck()) { int count = getCountCrystal(hidden.crystals); float percent = (float) count / hidden.crystals.size() * 100; - overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + "Crystals: " + getColor(percent) + count - + "/" + hidden.crystals.size()); + overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + "Crystals: " + getColor(percent) + + count + "/" + hidden.crystals.size()); } break; case 2: @@ -151,7 +152,7 @@ public class CrystalHollowOverlay extends TextOverlay { private void renderParts(HashMap parts, HashMap inventoryData, HashMap storageData) { for (String part : parts.keySet()) { - if (parts.get(part)) + if (parts.get(part) && !NotEnoughUpdates.INSTANCE.config.mining.crystalHollowHideDone) overlayStrings.add(EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowPartColor] + part + ": " + EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowDoneColor] + "Done"); else if (inventoryData.get(part) >= 1) @@ -200,11 +201,11 @@ public class CrystalHollowOverlay extends TextOverlay { private EnumChatFormatting getColor(float percent) { if (percent >= 66) - return EnumChatFormatting.GREEN; + return EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowAllColor]; else if (percent >= 33) - return EnumChatFormatting.YELLOW; + return EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowMiddleColor]; else - return EnumChatFormatting.RED; + return EnumChatFormatting.values()[NotEnoughUpdates.INSTANCE.config.mining.crystalHollowNoneColor]; } private int getCount(HashMap parts, HashMap inventoryData, HashMap storageData) { @@ -240,7 +241,7 @@ public class CrystalHollowOverlay extends TextOverlay { } private boolean crystalCheck() { - return true; + return NotEnoughUpdates.INSTANCE.config.mining.crystalHollowCrystalLocation == 0 || !divanCheck() && !automatonCheck(); } public void message(String message) { -- cgit From b95c2fe1fbec500d611f710988ed7452d86e19a8 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 24 Aug 2021 14:58:16 +0200 Subject: imports --- .../io/github/moulberry/notenoughupdates/options/NEUConfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 9327636a..c838c314 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -6,17 +6,17 @@ import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.GuiScreenElementWrapper; import io.github.moulberry.notenoughupdates.core.config.Config; import io.github.moulberry.notenoughupdates.core.config.Position; -import io.github.moulberry.notenoughupdates.core.config.annotations.*; +import io.github.moulberry.notenoughupdates.core.config.annotations.Category; import io.github.moulberry.notenoughupdates.core.config.gui.GuiPositionEditor; import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour; import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor; import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements; import io.github.moulberry.notenoughupdates.options.seperateSections.*; -import io.github.moulberry.notenoughupdates.overlays.*; +import io.github.moulberry.notenoughupdates.overlays.OverlayManager; +import io.github.moulberry.notenoughupdates.overlays.TextOverlay; import io.github.moulberry.notenoughupdates.util.SBInfo; import net.minecraft.client.Minecraft; import net.minecraftforge.client.ClientCommandHandler; -import org.luaj.vm2.ast.Str; import org.lwjgl.util.vector.Vector2f; import java.util.ArrayList; -- cgit From dcd6317f47fbc68aa9340aeafb75f044f0eb25bb Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 24 Aug 2021 15:01:21 +0200 Subject: update ids --- .../options/seperateSections/Mining.java | 48 +++++++++++----------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index e464fd37..0a680b0c 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -169,7 +169,7 @@ public class Mining { name = "Crystal Hollows Overlay", desc = "" ) - @ConfigEditorAccordion(id = 6) + @ConfigEditorAccordion(id = 4) public boolean crystalHollowOverlayAccordion = false; @Expose @@ -178,7 +178,7 @@ public class Mining { desc = "Enables the Crystal Hollows Overlay." ) @ConfigEditorBoolean - @ConfigAccordionId(id = 6) + @ConfigAccordionId(id = 4) public boolean crystalHollowOverlay = true; @Expose @@ -190,7 +190,7 @@ public class Mining { runnableId = 10, buttonText = "Edit" ) - @ConfigAccordionId(id = 6) + @ConfigAccordionId(id = 4) public Position crystalHollowOverlayPosition = new Position(200, 0); @Expose @@ -234,7 +234,7 @@ public class Mining { "\u00a73Mines of Divan parts: \u00a7a75%" } ) - @ConfigAccordionId(id = 6) + @ConfigAccordionId(id = 4) public List crystalHollowText = new ArrayList<>(Arrays.asList(0, 3, 7)); @Expose @@ -245,7 +245,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Background", "No Shadow", "Shadow", "Full Shadow"} ) - @ConfigAccordionId(id = 6) + @ConfigAccordionId(id = 4) public int crystalHollowOverlayStyle = 0; @@ -255,7 +255,7 @@ public class Mining { desc = "Show icons in the overlay that represent the part." ) @ConfigEditorBoolean - @ConfigAccordionId(id = 6) + @ConfigAccordionId(id = 4) public boolean crystalHollowIcons = true; @@ -265,15 +265,15 @@ public class Mining { desc = "Don't show parts you've given to the NPC." ) @ConfigEditorBoolean - @ConfigAccordionId(id = 6) + @ConfigAccordionId(id = 4) public boolean crystalHollowHideDone = false; @ConfigOption( name = "Locations", desc = "" ) - @ConfigEditorAccordion(id = 7) - @ConfigAccordionId(id = 6) + @ConfigEditorAccordion(id = 5) + @ConfigAccordionId(id = 4) public boolean crystalHollowLocationAccordion = false; @Expose @@ -284,7 +284,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Crystal Hollows", "Precursor Remnants", "Lost Precursor City"} ) - @ConfigAccordionId(id = 7) + @ConfigAccordionId(id = 5) public int crystalHollowAutomatonLocation = 2; @Expose @@ -295,7 +295,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Crystal Hollows", "Mithril Deposits", "Mines of Divan"} ) - @ConfigAccordionId(id = 7) + @ConfigAccordionId(id = 5) public int crystalHollowDivanLocation = 2; @Expose @@ -306,15 +306,15 @@ public class Mining { @ConfigEditorDropdown( values = {"Crystal Hollows", "When No Other Overlays"} ) - @ConfigAccordionId(id = 7) + @ConfigAccordionId(id = 5) public int crystalHollowCrystalLocation = 1; @ConfigOption( name = "Colours", desc = "" ) - @ConfigEditorAccordion(id = 8) - @ConfigAccordionId(id = 6) + @ConfigEditorAccordion(id = 6) + @ConfigAccordionId(id = 4) public boolean crystalHollowColourAccordion = false; @Expose @@ -326,7 +326,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 8) + @ConfigAccordionId(id = 6) public int crystalHollowPartColor = 3; @Expose @@ -338,7 +338,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 8) + @ConfigAccordionId(id = 6) public int crystalHollowDoneColor = 10; @Expose @@ -350,7 +350,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 8) + @ConfigAccordionId(id = 6) public int crystalHollowInventoryColor = 14; @Expose @@ -362,7 +362,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 8) + @ConfigAccordionId(id = 6) public int crystalHollowStorageColor = 14; @Expose @@ -374,7 +374,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 8) + @ConfigAccordionId(id = 6) public int crystalHollowMissingColor = 12; @Expose @@ -386,7 +386,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 8) + @ConfigAccordionId(id = 6) public int crystalHollowPlacedColor = 10; @Expose @@ -398,7 +398,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 8) + @ConfigAccordionId(id = 6) public int crystalHollowCollectedColor = 14; @Expose @@ -410,7 +410,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 8) + @ConfigAccordionId(id = 6) public int crystalHollowAllColor = 10; @Expose @@ -422,7 +422,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 8) + @ConfigAccordionId(id = 6) public int crystalHollowMiddleColor = 14; @Expose @@ -434,7 +434,7 @@ public class Mining { @ConfigEditorDropdown( values = {"Black", "Dark Blue", "Dark Green", "Dark Aqua", "Dark Red", "Dark Purple", "Gold", "Gray", "Dark Gray", "Blue", "Green", "Aqua", "Red", "Light Purple", "Yellow", "White"} ) - @ConfigAccordionId(id = 8) + @ConfigAccordionId(id = 6) public int crystalHollowNoneColor = 12; @Expose -- cgit From 10d64cd33c0c86be95952f94783950bfedd912ba Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 24 Aug 2021 15:06:42 +0200 Subject: undid auto format --- .../notenoughupdates/overlays/OverlayManager.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java index 8ff0bff2..0d15574f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -37,13 +37,13 @@ public class OverlayManager { "\u00a73Experiments: \u00a7e3h38m"); textOverlays.add(timersOverlay = new TimersOverlay(NotEnoughUpdates.INSTANCE.config.miscOverlays.todoPosition, () -> { List strings = new ArrayList<>(); - for (int i : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText2) { - if (i >= 0 && i < todoDummy.size()) strings.add(todoDummy.get(i)); + for(int i : NotEnoughUpdates.INSTANCE.config.miscOverlays.todoText2) { + if(i >= 0 && i < todoDummy.size()) strings.add(todoDummy.get(i)); } return strings; }, () -> { int style = NotEnoughUpdates.INSTANCE.config.miscOverlays.todoStyle; - if (style >= 0 && style < TextOverlayStyle.values().length) { + if(style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } return TextOverlayStyle.BACKGROUND; @@ -55,13 +55,13 @@ public class OverlayManager { "\u00a73Forge 2) \u00a77EMPTY\n\u00a73Forge 3) \u00a77EMPTY\n\u00a73Forge 4) \u00a77EMPTY"); miningOverlay = new MiningOverlay(NotEnoughUpdates.INSTANCE.config.mining.overlayPosition, () -> { List strings = new ArrayList<>(); - for (int i : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText) { - if (i >= 0 && i < miningDummy.size()) strings.add(miningDummy.get(i)); + for(int i : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText) { + if(i >= 0 && i < miningDummy.size()) strings.add(miningDummy.get(i)); } return strings; }, () -> { int style = NotEnoughUpdates.INSTANCE.config.mining.overlayStyle; - if (style >= 0 && style < TextOverlayStyle.values().length) { + if(style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } return TextOverlayStyle.BACKGROUND; @@ -76,13 +76,13 @@ public class OverlayManager { "\u00a7bYaw: \u00a7e68.25\u00a7l\u1D52"); farmingOverlay = new FarmingOverlay(NotEnoughUpdates.INSTANCE.config.skillOverlays.farmingPosition, () -> { List strings = new ArrayList<>(); - for (int i : NotEnoughUpdates.INSTANCE.config.skillOverlays.farmingText) { - if (i >= 0 && i < farmingDummy.size()) strings.add(farmingDummy.get(i)); + for(int i : NotEnoughUpdates.INSTANCE.config.skillOverlays.farmingText) { + if(i >= 0 && i < farmingDummy.size()) strings.add(farmingDummy.get(i)); } return strings; }, () -> { int style = NotEnoughUpdates.INSTANCE.config.skillOverlays.farmingStyle; - if (style >= 0 && style < TextOverlayStyle.values().length) { + if(style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } return TextOverlayStyle.BACKGROUND; @@ -98,13 +98,13 @@ public class OverlayManager { "\u00a7bUntil L100: \u00a7e2d13h"); petInfoOverlay = new PetInfoOverlay(NotEnoughUpdates.INSTANCE.config.petOverlay.petInfoPosition, () -> { List strings = new ArrayList<>(); - for (int i : NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText) { - if (i >= 0 && i < petInfoDummy.size()) strings.add(petInfoDummy.get(i)); + for(int i : NotEnoughUpdates.INSTANCE.config.petOverlay.petOverlayText) { + if(i >= 0 && i < petInfoDummy.size()) strings.add(petInfoDummy.get(i)); } return strings; }, () -> { int style = NotEnoughUpdates.INSTANCE.config.petOverlay.petInfoOverlayStyle; - if (style >= 0 && style < TextOverlayStyle.values().length) { + if(style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } return TextOverlayStyle.BACKGROUND; @@ -116,7 +116,7 @@ public class OverlayManager { ); bonemerangOverlay = new BonemerangOverlay(NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangPosition, () -> bonemerangDummy, () -> { int style = NotEnoughUpdates.INSTANCE.config.itemOverlays.bonemerangOverlayStyle; - if (style >= 0 && style < TextOverlayStyle.values().length) { + if(style >= 0 && style < TextOverlayStyle.values().length) { return TextOverlayStyle.values()[style]; } return TextOverlayStyle.BACKGROUND; -- cgit From e9f5c3c4547fd83fbfbfd64d4bf0437a7c0b0969 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 24 Aug 2021 15:31:47 +0200 Subject: Overhaul Dwarven overlay's forge display --- .../options/seperateSections/Mining.java | 7 +- .../notenoughupdates/overlays/MiningOverlay.java | 381 +++++++++++---------- .../notenoughupdates/overlays/OverlayManager.java | 2 +- 3 files changed, 202 insertions(+), 188 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index 57db90c6..af0eab2e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -110,11 +110,10 @@ public class Mining { "\u00a73Mithril Powder: \u00a726,243", "\u00a73Gemstone Powder: \u00a7d6,243", "\u00a73Forge 1) \u00a79Diamonite\u00a77: \u00a7aReady!", - "\u00a73Forge 2) \u00a77EMPTY\n\u00a73Forge 3) \u00a77EMPTY\n\u00a73Forge 4) \u00a77EMPTY", "\u00a73Pickaxe CD: \u00a7a78s"} ) @ConfigAccordionId(id = 2) - public List dwarvenText = new ArrayList<>(Arrays.asList(0, 1, 4, 2, 3, 5)); + public List dwarvenText2 = new ArrayList<>(Arrays.asList(0, 1, 2, 3, 4)); @Expose @ConfigOption( @@ -157,10 +156,10 @@ public class Mining { desc = "Change when the forge display gets shown" ) @ConfigEditorDropdown( - values = {"Dwarven mines", "DM+Crystal Hollows", "Everywhere except dungeons", "Everywhere"} + values = {"Dwarven Mines+Crystal Hollows", "Everywhere except dungeons", "Everywhere"} ) @ConfigAccordionId(id = 2) - public int forgeDisplayLocation = 0; + public int forgeDisplayEnabledLocations = 0; @ConfigOption( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index bc435ad9..82b1338e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -2,13 +2,11 @@ package io.github.moulberry.notenoughupdates.overlays; import com.google.common.collect.ComparisonChain; import com.google.common.collect.Ordering; -import com.google.gson.JsonObject; import com.google.gson.annotations.Expose; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.config.Position; import io.github.moulberry.notenoughupdates.core.util.StringUtils; import io.github.moulberry.notenoughupdates.core.util.lerp.LerpUtils; -import io.github.moulberry.notenoughupdates.cosmetics.CapeManager; import io.github.moulberry.notenoughupdates.miscfeatures.ItemCooldowns; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.util.SBInfo; @@ -24,7 +22,6 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.WorldSettings; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import org.lwjgl.Sys; import java.util.*; import java.util.function.Supplier; @@ -45,6 +42,7 @@ public class MiningOverlay extends TextOverlay { @Override public void updateFrequent() { + NEUConfig.HiddenProfileSpecific hidden = NotEnoughUpdates.INSTANCE.config.getProfileSpecific(); if(Minecraft.getMinecraft().currentScreen instanceof GuiChest) { GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; ContainerChest container = (ContainerChest) chest.inventorySlots; @@ -84,6 +82,64 @@ public class MiningOverlay extends TextOverlay { } } } + } else if(containerName.equals("Forge") && lower.getSizeInventory() >= 36 && hidden != null) { + + itemLoop: + for (int i = 0; i < 5; i++) { + ItemStack stack = lower.getStackInSlot(i + 11); + if (stack != null) { + + String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); + + + for (int i1 = 0; i1 < lore.length; i1++) { + String line = lore[i1]; + Matcher matcher = timeRemainingForge.matcher(line); + if (stack.getDisplayName().matches("\\xA7cSlot #([1-5])")) { + ForgeItem newForgeItem = new ForgeItem("Locked", 0, 1, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + //empty Slot + } else if (stack.getDisplayName().matches("\\xA7aSlot #([1-5])")) { + ForgeItem newForgeItem = new ForgeItem("Empty", 0, 0, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + } else if (matcher.matches()) { + String timeremainingString = matcher.group(1); + + long duration = 0; + + if (matcher.group("Completed") != null && !matcher.group("Completed").equals("")) { + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), 0, 2, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + } else { + + try { + if (matcher.group("days") != null && !matcher.group("days").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("days")) * 24 * 60 * 60 * 1000; + } + if (matcher.group("hours") != null && !matcher.group("hours").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("hours")) * 60 * 60 * 1000; + } + if (matcher.group("minutes") != null && !matcher.group("minutes").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("minutes")) * 60 * 1000; + } + if (matcher.group("seconds") != null && !matcher.group("seconds").equals("")) { + duration = duration + (long) Integer.parseInt(matcher.group("seconds")) * 1000; + } + } catch (Exception ignored) { + } + if (duration > 0) { + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), System.currentTimeMillis() + duration, 2, i, false); + replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + } + } + + continue itemLoop; + } + } + //Locked Slot + + } + } } } } @@ -161,41 +217,66 @@ public class MiningOverlay extends TextOverlay { } }*/ - if (Minecraft.getMinecraft().currentScreen instanceof GuiChest) { - GuiChest chest = (GuiChest) Minecraft.getMinecraft().currentScreen; - ContainerChest container = (ContainerChest) chest.inventorySlots; - IInventory lower = container.getLowerChestInventory(); - String containerName = lower.getDisplayName().getUnformattedText(); - if(containerName.equals("Forge") && lower.getSizeInventory() >= 36 && hidden != null){ + if(!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay && NotEnoughUpdates.INSTANCE.config.mining.emissaryWaypoints == 0) return; + if(SBInfo.getInstance().getLocation() == null) return; + if(SBInfo.getInstance().getLocation().equals("mining_3") || SBInfo.getInstance().getLocation().equals("crystal_hollows")) { + + overlayStrings = new ArrayList<>(); + commissionProgress.clear(); + + String mithrilPowder = null; + String gemstonePowder = null; + int forgeInt = 0; + boolean commissions = false; + boolean forges = false; + List players = playerOrdering.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); + + for (NetworkPlayerInfo info : players) { + String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info); + if (name.contains("Mithril Powder:")) { + mithrilPowder = DARK_AQUA + Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); + } + if (name.contains("Gemstone Powder:")) { + gemstonePowder = DARK_AQUA + Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); + } + if (name.equals(RESET.toString() + BLUE + BOLD + "Forges " + RESET)) { + commissions = false; + forges = true; + continue; + } else if (name.equals(RESET.toString() + BLUE + BOLD + "Commissions" + RESET)) { + commissions = true; + forges = false; + continue; + } + String clean = StringUtils.cleanColour(name); + if (forges && clean.startsWith(" ")) { - itemLoop: - for (int i = 0; i < 5; i++) { - ItemStack stack = lower.getStackInSlot(i+11); - if(stack != null) { + char firstChar = clean.trim().charAt(0); + if (firstChar < '0' || firstChar > '9') { + forges = false; + } else { - String[] lore = NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(stack.getTagCompound()); + if (name.contains("LOCKED")) { + ForgeItem item = new ForgeItem("Locked", 0, 1, forgeInt, true); + replaceForgeOrAdd(item, hidden.forgeItems, true); + } else if (name.contains("EMPTY")) { + ForgeItem item = new ForgeItem("Empty", 0, 0, forgeInt, true); + replaceForgeOrAdd(item, hidden.forgeItems, true); + //forgeStringsEmpty.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); + } else { + String cleanName = Utils.cleanColour(name); + Matcher matcher = timeRemainingTab.matcher(cleanName); - for (int i1 = 0; i1 < lore.length; i1++) { - String line = lore[i1]; - Matcher matcher = timeRemainingForge.matcher(line); - if (stack.getDisplayName().matches("\\xA7cSlot #([1-5])")){ - ForgeItem newForgeItem = new ForgeItem("Locked", 0,1, i, false); - replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); - //empty Slot - } else if(stack.getDisplayName().matches("\\xA7aSlot #([1-5])")){ - ForgeItem newForgeItem = new ForgeItem("Empty", 0,0, i, false); - replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); - } else if(matcher.matches()){ - String timeremainingString = matcher.group(1); + if (matcher.matches()) { - long duration = 0; + String itemName = matcher.group(1); - if(matcher.group("Completed")!= null && !matcher.group("Completed").equals("")){ - ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), 0, 2, i, false); - replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + if (matcher.group("Ready") != null && !matcher.group("Ready").equals("")) { + ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), 0, 2, forgeInt, true); + replaceForgeOrAdd(item, hidden.forgeItems, true); } else { - + long duration = 0; try { if (matcher.group("days") != null && !matcher.group("days").equals("")) { duration = duration + (long) Integer.parseInt(matcher.group("days")) * 24 * 60 * 60 * 1000; @@ -212,152 +293,62 @@ public class MiningOverlay extends TextOverlay { } catch (Exception ignored) { } if (duration > 0) { - ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), System.currentTimeMillis() + duration, 2, i, false); - replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); + duration = duration + 4000; + ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), System.currentTimeMillis() + duration, 2, forgeInt, true); + replaceForgeOrAdd(item, hidden.forgeItems, false); } } - - continue itemLoop; } } - //Locked Slot - + forgeInt++; } - } - } - } - - if(!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay && NotEnoughUpdates.INSTANCE.config.mining.emissaryWaypoints == 0) return; - if(SBInfo.getInstance().getLocation() == null) return; - if(!SBInfo.getInstance().getLocation().equals("mining_3") && !SBInfo.getInstance().getLocation().equals("crystal_hollows")) return; - - overlayStrings = new ArrayList<>(); - commissionProgress.clear(); - - String mithrilPowder = null; - String gemstonePowder = null; - int forgeInt = 0; - boolean commissions = false; - boolean forges = false; - List players = playerOrdering.sortedCopy(Minecraft.getMinecraft().thePlayer.sendQueue.getPlayerInfoMap()); - - for(NetworkPlayerInfo info : players) { - String name = Minecraft.getMinecraft().ingameGUI.getTabList().getPlayerName(info); - if(name.contains("Mithril Powder:")) { - mithrilPowder = DARK_AQUA+Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); - } - if(name.contains("Gemstone Powder:")) { - gemstonePowder = DARK_AQUA+Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); - } - if(name.equals(RESET.toString()+BLUE+BOLD+"Forges "+RESET)) { - commissions = false; - forges = true; - continue; - } else if(name.equals(RESET.toString()+BLUE+BOLD+"Commissions"+RESET)) { - commissions = true; - forges = false; - continue; - } - String clean = StringUtils.cleanColour(name); - if(forges && clean.startsWith(" ")) { - - char firstChar = clean.trim().charAt(0); - if(firstChar < '0' || firstChar > '9') { - forges = false; - } else { - - if(name.contains("LOCKED")) { - ForgeItem item = new ForgeItem("Locked", 0,1, forgeInt, true); - replaceForgeOrAdd(item, hidden.forgeItems, true); - } else if(name.contains("EMPTY")) { - ForgeItem item = new ForgeItem("Empty", 0,0, forgeInt, true); - replaceForgeOrAdd(item, hidden.forgeItems, true); - //forgeStringsEmpty.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); - } else { - String cleanName = Utils.cleanColour(name); - - Matcher matcher = timeRemainingTab.matcher(cleanName); - - if(matcher.matches()){ - - String itemName = matcher.group(1); - - if(matcher.group("Ready") != null && !matcher.group("Ready").equals("")){ - ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), 0, 2, forgeInt, true); - replaceForgeOrAdd(item, hidden.forgeItems, true); - } else { - long duration = 0; - try { - if (matcher.group("days") != null && !matcher.group("days").equals("")) { - duration = duration + (long) Integer.parseInt(matcher.group("days")) * 24 * 60 * 60 * 1000; - } - if (matcher.group("hours") != null && !matcher.group("hours").equals("")) { - duration = duration + (long) Integer.parseInt(matcher.group("hours")) * 60 * 60 * 1000; - } - if (matcher.group("minutes") != null && !matcher.group("minutes").equals("")) { - duration = duration + (long) Integer.parseInt(matcher.group("minutes")) * 60 * 1000; - } - if (matcher.group("seconds") != null && !matcher.group("seconds").equals("")) { - duration = duration + (long) Integer.parseInt(matcher.group("seconds")) * 1000; - } - } catch (Exception ignored) { - } - if (duration > 0) { - duration = duration + 4000; - ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), System.currentTimeMillis() + duration, 2, forgeInt, true); - replaceForgeOrAdd(item, hidden.forgeItems, false); - } + } else if (commissions && clean.startsWith(" ")) { + String[] split = clean.trim().split(": "); + if (split.length == 2) { + if (split[1].endsWith("%")) { + try { + float progress = Float.parseFloat(split[1].replace("%", "")) / 100; + progress = LerpUtils.clampZeroOne(progress); + commissionProgress.put(split[0], progress); + } catch (Exception ignored) { } + } else { + commissionProgress.put(split[0], 1.0f); } } - forgeInt++; - } - } else if(commissions && clean.startsWith(" ")) { - String[] split = clean.trim().split(": "); - if(split.length == 2) { - if(split[1].endsWith("%")) { - try { - float progress = Float.parseFloat(split[1].replace("%", ""))/100; - progress = LerpUtils.clampZeroOne(progress); - commissionProgress.put(split[0], progress); - } catch(Exception ignored) {} - } else { - commissionProgress.put(split[0], 1.0f); - } + } else { + commissions = false; + forges = false; } - } else { - commissions = false; - forges = false; } - } - if(!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay){ - overlayStrings = null; - return; - } + if (!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay) { + overlayStrings = null; + return; + } - List commissionsStrings = new ArrayList<>(); - for(Map.Entry entry : commissionProgress.entrySet()) { - if(entry.getValue() >= 1) { - commissionsStrings.add(DARK_AQUA+entry.getKey() + ": " + GREEN + "DONE"); - } else { - EnumChatFormatting col = RED; - if(entry.getValue() >= 0.75) { - col = GREEN; - } else if(entry.getValue() >= 0.5) { - col = YELLOW; - } else if(entry.getValue() >= 0.25) { - col = GOLD; - } - if(true && commissionMaxes.containsKey(entry.getKey())) { - int max = commissionMaxes.get(entry.getKey()); - commissionsStrings.add(DARK_AQUA+entry.getKey() + ": " + col+Math.round(entry.getValue()*max)+"/"+max); + List commissionsStrings = new ArrayList<>(); + for (Map.Entry entry : commissionProgress.entrySet()) { + if (entry.getValue() >= 1) { + commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + GREEN + "DONE"); } else { - String valS = Utils.floatToString(entry.getValue()*100, 1); + EnumChatFormatting col = RED; + if (entry.getValue() >= 0.75) { + col = GREEN; + } else if (entry.getValue() >= 0.5) { + col = YELLOW; + } else if (entry.getValue() >= 0.25) { + col = GOLD; + } + if (true && commissionMaxes.containsKey(entry.getKey())) { + int max = commissionMaxes.get(entry.getKey()); + commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + col + Math.round(entry.getValue() * max) + "/" + max); + } else { + String valS = Utils.floatToString(entry.getValue() * 100, 1); - commissionsStrings.add(DARK_AQUA+entry.getKey() + ": " + col+valS+"%"); + commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + col + valS + "%"); + } } } - } /*boolean hasAny = false; if(NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlay) { overlayStrings.addAll(commissionsStrings); @@ -375,29 +366,53 @@ public class MiningOverlay extends TextOverlay { overlayStrings.addAll(forgeStrings); }*/ - String pickaxeCooldown; - if(ItemCooldowns.pickaxeUseCooldownMillisRemaining <= 0) { - pickaxeCooldown = DARK_AQUA+"Pickaxe CD: \u00a7aReady"; - } else { - pickaxeCooldown = DARK_AQUA+"Pickaxe CD: \u00a7a" + (ItemCooldowns.pickaxeUseCooldownMillisRemaining/1000) + "s"; - } + String pickaxeCooldown; + if (ItemCooldowns.pickaxeUseCooldownMillisRemaining <= 0) { + pickaxeCooldown = DARK_AQUA + "Pickaxe CD: \u00a7aReady"; + } else { + pickaxeCooldown = DARK_AQUA + "Pickaxe CD: \u00a7a" + (ItemCooldowns.pickaxeUseCooldownMillisRemaining / 1000) + "s"; + } - for(int index : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText) { - switch(index) { - case 0: - overlayStrings.addAll(commissionsStrings); break; - case 1: - overlayStrings.add(mithrilPowder); break; - case 2: - overlayStrings.add(gemstonePowder); break; - case 3: - overlayStrings.addAll(getForgeStrings(hidden.forgeItems)); break; - case 4: - //overlayStrings.addAll(forgeStringsEmpty); break; - case 5: - overlayStrings.add(pickaxeCooldown); break; + for (int index : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText2) { + switch (index) { + case 0: + overlayStrings.addAll(commissionsStrings); + break; + case 1: + overlayStrings.add(mithrilPowder); + break; + case 2: + overlayStrings.add(gemstonePowder); + break; + case 3: + overlayStrings.addAll(getForgeStrings(hidden.forgeItems)); + break; + case 4: + //overlayStrings.addAll(forgeStringsEmpty); break; + case 5: + overlayStrings.add(pickaxeCooldown); + break; + } + } + } else { + overlayStrings = new ArrayList<>(); + if(hidden == null){ + return; + } + boolean forgeDisplay = false; + for (int i = 0; i < NotEnoughUpdates.INSTANCE.config.mining.dwarvenText2.size(); i++) { + if(NotEnoughUpdates.INSTANCE.config.mining.dwarvenText2.get(i) == 3){ + forgeDisplay = true; + } + } + if(forgeDisplay){ + if(NotEnoughUpdates.INSTANCE.config.mining.forgeDisplayEnabledLocations == 1 && !SBInfo.getInstance().isInDungeon){ + overlayStrings.addAll(getForgeStrings(hidden.forgeItems)); + } else if(NotEnoughUpdates.INSTANCE.config.mining.forgeDisplayEnabledLocations == 2){ + overlayStrings.addAll(getForgeStrings(hidden.forgeItems)); + } } } @@ -483,7 +498,7 @@ public class MiningOverlay extends TextOverlay { public String getFormattedString(long currentTimeMillis){ - String returnText = EnumChatFormatting.AQUA+"Forge "+(this.forgeID+1)+": "; + String returnText = EnumChatFormatting.DARK_AQUA+"Forge "+(this.forgeID+1)+": "; if(status == 0){ return returnText +EnumChatFormatting.GRAY +"Empty"; } else if(status == 1){ diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java index 0aa0d273..f82f482e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/OverlayManager.java @@ -56,7 +56,7 @@ public class OverlayManager { "\u00a73Forge 2) \u00a77EMPTY\n\u00a73Forge 3) \u00a77EMPTY\n\u00a73Forge 4) \u00a77EMPTY"); miningOverlay = new MiningOverlay(NotEnoughUpdates.INSTANCE.config.mining.overlayPosition, () -> { List strings = new ArrayList<>(); - for(int i : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText) { + for(int i : NotEnoughUpdates.INSTANCE.config.mining.dwarvenText2) { if(i >= 0 && i < miningDummy.size()) strings.add(miningDummy.get(i)); } return strings; -- cgit From 5fa06410754c7c69ec4690a3f12883f4e2db93d6 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 24 Aug 2021 15:47:53 +0200 Subject: fix imports --- .../java/io/github/moulberry/notenoughupdates/options/NEUConfig.java | 1 + 1 file changed, 1 insertion(+) 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 324f6744..22d3f6ff 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -12,6 +12,7 @@ import io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour; import io.github.moulberry.notenoughupdates.miscgui.GuiInvButtonEditor; import io.github.moulberry.notenoughupdates.miscgui.NEUOverlayPlacements; import io.github.moulberry.notenoughupdates.options.seperateSections.*; +import io.github.moulberry.notenoughupdates.overlays.MiningOverlay; import io.github.moulberry.notenoughupdates.overlays.OverlayManager; import io.github.moulberry.notenoughupdates.overlays.TextOverlay; import io.github.moulberry.notenoughupdates.util.SBInfo; -- cgit From 1ec8a4ebb6165b2e2983eb880b9ec0afc81ce57c Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 24 Aug 2021 16:50:03 +0200 Subject: Update Changelog --- Update Notes/2.0-Pre31.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index fb452773..60e1f60f 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -5,6 +5,13 @@ - Added divan's mines metal detector waypoints (DeDiamondPro) - Added divan's mines required items overlay (DeDiamondPro) - Added lost precusor city required items overlay (DeDiamondPro) +- Added "extended pet exp" tooltip tweak which. +- Overhauled the dwarven overlay's forge display. +- Added load from/copy to clipboard and reset config buttons to neuec gui. +- Added load from/copy to clipboard to neu inventory buttons gui. +- Added a crafting recipe overlay when looking up a recipe while in the crafting menu (to more easily craft items like the Soul Esoward recipe) (DeDiamondPro) +- Added mastermode support to /pv (basically done, just needs mastermode xp) + ### **New Features:** - Added Ferocity, Magic find, Mining speed and mining fortune to Accessory bag (and ferocity and magic find to /pv). @@ -22,14 +29,10 @@ - Added explenation to search highlight feature. - Added fast render warning to storage gui. - Added info about how to get neu capes to the cosmetics gui. +- Added SBA chroma support to neuec. - Redid bonemerang overlay - Moveable and a bit more info. - Added /neuhelp (neu command list with bit of explenation) - Added toggle to prismapump overlay. -- Added load from/copy to clipboard and reset config buttons to neuec gui. -- Added load from/copy to clipboard to neu inventory buttons gui. -- Added SBA chroma support to neuec. -- Added a crafting recipe overlay when looking up a recipe while in the crafting menu (to more easily craft items like the Soul Esoward recipe) (DeDiamondPro) -- Added mastermode support to /pv (basically done, just needs mastermode xp) - Added ability to toggle the pickaxe's ability cooldown showing up as the pickaxe durability. - Added alternative command for "/neusouls" "/fairysouls". -- cgit From 019f3630776c6f4b4eedd41c25aa4f36b99ccf5b Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 24 Aug 2021 18:41:42 +0200 Subject: Fix show pet exp on tooltip in pv --- .../io/github/moulberry/notenoughupdates/NEUEventListener.java | 4 ++-- src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java | 2 +- .../moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java | 7 +++++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 4f3b6187..6aa292eb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2335,8 +2335,8 @@ public class NEUEventListener { private List petToolTipXPExtend(ItemTooltipEvent event) { List tooltipText = new ArrayList(); if (NotEnoughUpdates.INSTANCE.config.tooltipTweaks.petExtendExp) { - if(event.itemStack.getTagCompound().hasKey("ItemList")){ - if(event.itemStack.getTagCompound().getBoolean("ItemList")){ + if(event.itemStack.getTagCompound().hasKey("DisablePetExp")){ + if(event.itemStack.getTagCompound().getBoolean("DisablePetExp")){ return tooltipText; } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 2208b53c..79a822d8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -1991,7 +1991,7 @@ public class NEUOverlay extends Gui { ItemStack stack = manager.jsonToStack(json); { NBTTagCompound tag = stack.getTagCompound(); - tag.setBoolean("ItemList", true); + tag.setBoolean("DisablePetExp", true); stack.setTagCompound(tag); } 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 22cbf04d..51810c2d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1496,7 +1496,14 @@ public class GuiProfileViewer extends GuiScreen { for(int i=petsPage*20; i Date: Tue, 24 Aug 2021 20:02:25 +0200 Subject: fixes --- .../notenoughupdates/NEUEventListener.java | 1 - .../miscfeatures/CustomItemEffects.java | 60 +++++++++++------- .../profileviewer/GuiProfileViewer.java | 72 ++++++++++++++-------- 3 files changed, 83 insertions(+), 50 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 6aa292eb..08ef97a9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -838,7 +838,6 @@ public class NEUEventListener { if(unformatted.startsWith("[NPC] Keeper of ") | unformatted.startsWith("[NPC] Professor Robot: ") || unformatted.startsWith(" ") || unformatted.startsWith("✦") || unformatted.equals(" You've earned a Crystal Loot Bundle!")) OverlayManager.crystalHollowOverlay.message(unformatted); - System.out.println(unformatted); } public static boolean drawingGuiScreen = false; 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 3ca05dea..0f4e2f4d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -45,6 +45,8 @@ import java.awt.*; import java.io.ByteArrayInputStream; import java.util.*; import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; public class CustomItemEffects { @@ -59,7 +61,7 @@ public class CustomItemEffects { public long lastUsedHyperion = 0; - + private final Pattern etherwarpDistancePattern = Pattern.compile("up to (?\\d{2}) blocks away\\."); public int aoteTeleportationMillis = 0; public Vector3f aoteTeleportationCurr = null; @@ -262,7 +264,10 @@ public class CustomItemEffects { denyTpReason = "Not solid!"; } else { WorldClient world = Minecraft.getMinecraft().theWorld; - if(world.getBlockState(pos.add(0, 1, 0)).getBlock() != Blocks.air || + Block above = world.getBlockState(pos.add(0, 1, 0)).getBlock(); + if(above != Blocks.air && above.isCollidable() && + above.getCollisionBoundingBox(Minecraft.getMinecraft().theWorld, pos.add(0, 1, 0), + world.getBlockState(pos.add(0, 1, 0))) != null || world.getBlockState(pos.add(0, 2, 0)).getBlock() != Blocks.air) { denyTpReason = "No air above!"; } @@ -543,34 +548,45 @@ public class CustomItemEffects { } if(usingEtherwarp) { - etherwarpRaycast = raycast(Minecraft.getMinecraft().thePlayer, 1f, 60, 0.1f); + int dist = 0; + for (String line : NotEnoughUpdates.INSTANCE.manager.getLoreFromNBT(held.getTagCompound())) { + String cleaned = Utils.cleanColour(line); + Matcher matcher = etherwarpDistancePattern.matcher(cleaned); + if (matcher.matches()) { + dist = Integer.parseInt(matcher.group("distance")); + break; + } + } + if (dist != 0) { + etherwarpRaycast = raycast(Minecraft.getMinecraft().thePlayer, 1f, dist, 0.1f); - if(etherwarpRaycast != null) { - AxisAlignedBB bb = etherwarpRaycast.state.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, etherwarpRaycast.pos) - .expand(0.01D, 0.01D, 0.01D).offset(-d0, -d1, -d2); - drawFilledBoundingBox(bb, 1f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); + if (etherwarpRaycast != null) { + AxisAlignedBB bb = etherwarpRaycast.state.getBlock().getSelectedBoundingBox(Minecraft.getMinecraft().theWorld, etherwarpRaycast.pos) + .expand(0.01D, 0.01D, 0.01D).offset(-d0, -d1, -d2); + drawFilledBoundingBox(bb, 1f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); - GlStateManager.disableDepth(); - drawOutlineBoundingBox(bb, 2f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); - GlStateManager.enableDepth(); + GlStateManager.disableDepth(); + drawOutlineBoundingBox(bb, 2f, NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpHighlightColour); + GlStateManager.enableDepth(); - GlStateManager.depthMask(true); - GlStateManager.enableTexture2D(); - GlStateManager.disableBlend(); + GlStateManager.depthMask(true); + GlStateManager.enableTexture2D(); + GlStateManager.disableBlend(); - if(NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { - float distFactor = 1 - (float)Math.sqrt(etherwarpRaycast.pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition()))/60; + if (NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { + float distFactor = 1 - (float) Math.sqrt(etherwarpRaycast.pos.distanceSq(Minecraft.getMinecraft().thePlayer.getPosition())) / 60; - targetFOVMult = distFactor*distFactor*distFactor*0.75f + 0.25f; - if(targetFOVMult < 0.25f) targetFOVMult = 0.25f; + targetFOVMult = distFactor * distFactor * distFactor * 0.75f + 0.25f; + if (targetFOVMult < 0.25f) targetFOVMult = 0.25f; - targetSensMult = distFactor*0.76f + 0.25f; + targetSensMult = distFactor * 0.76f + 0.25f; + } + } else if (NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { + targetFOVMult = lastFOVMult; } - } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.etherwarpZoom) { - targetFOVMult = lastFOVMult; - } - return; + return; + } } } } 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 51810c2d..11a5574d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -11,15 +11,17 @@ import com.mojang.authlib.minecraft.MinecraftProfileTexture; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.cosmetics.ShaderManager; import io.github.moulberry.notenoughupdates.itemeditor.GuiElementTextField; -import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Constants; +import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityOtherPlayerMP; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.OpenGlHelper; +import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.resources.DefaultPlayerSkin; import net.minecraft.client.resources.SkinManager; @@ -32,7 +34,9 @@ import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.*; -import net.minecraft.util.*; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.Matrix4f; +import net.minecraft.util.ResourceLocation; import org.apache.commons.lang3.text.WordUtils; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; @@ -49,8 +53,8 @@ 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.*; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadPoolExecutor; @@ -1340,6 +1344,8 @@ public class GuiProfileViewer extends GuiScreen { String petname = pet.get("type").getAsString(); String tier = pet.get("tier").getAsString(); String heldItem = Utils.getElementAsString(pet.get("heldItem"), null); + String skin = Utils.getElementAsString(pet.get("skin"), null); + int candy = pet.get("candyUsed").getAsInt(); JsonObject heldItemJson = heldItem==null?null:NotEnoughUpdates.INSTANCE.manager.getItemInformation().get(heldItem); String tierNum = MINION_RARITY_TO_NUM.get(tier); float exp = pet.get("exp").getAsFloat(); @@ -1407,6 +1413,22 @@ public class GuiProfileViewer extends GuiScreen { newLore.appendTag(new NBTTagString(line)); } Integer secondLastBlank = blankLocations.get(blankLocations.size()-2); + if(skin != null){ + JsonObject petSkin = NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PET_SKIN_" + skin); + if(petSkin != null){ + try { + NBTTagCompound nbt = JsonToNBT.getTagFromJson(petSkin.get("nbttag").getAsString()); + tag.setTag("SkullOwner", nbt.getTag("SkullOwner")); + String name = petSkin.get("displayname").getAsString(); + if(name != null){ + name = Utils.cleanColour(name); + newLore.set(0, new NBTTagString(newLore.get(0).toString().replace("\"" , "") + ", " + name)); + } + } catch (NBTException e) { + e.printStackTrace(); + } + } + } if(heldItemJson != null && secondLastBlank != null) { for(int j=0; j minions = ProfileViewer.getCollectionCatToMinionMap().get(selectedCollectionCategory); if(minions != null) { for(int i=0; i Date: Tue, 24 Aug 2021 20:37:30 +0200 Subject: Add another check for if the experimentation table is done This check runs when you're on the rewards page --- .../io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java | 5 +++++ 1 file changed, 5 insertions(+) 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 728703ad..429a3c60 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -214,6 +214,11 @@ public class TimersOverlay extends TextOverlay { } hidden.experimentsCompleted = 0; return; + } else if(containerName.equals("Superpairs Rewards") && lower.getSizeInventory() >= 27){ + ItemStack stack = lower.getStackInSlot(13); + if(Utils.cleanColour(stack.getDisplayName()).equals("Superpairs")){ + hidden.experimentsCompleted = currentTime; + } } } -- cgit From 9dfff3e4db5b77a720d624ad5febda44f287e838 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 24 Aug 2021 21:23:11 +0200 Subject: Update GuiProfileViewer.java --- .../profileviewer/GuiProfileViewer.java | 51 ++++++++++++---------- 1 file changed, 29 insertions(+), 22 deletions(-) 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 11a5574d..115660c7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1398,7 +1398,6 @@ public class GuiProfileViewer extends GuiScreen { if(tag.hasKey("display", 10)) { NBTTagCompound display = tag.getCompoundTag("display"); if(display.hasKey("Lore", 9)) { - NBTTagList newNewLore = new NBTTagList(); NBTTagList newLore = new NBTTagList(); NBTTagList lore = display.getTagList("Lore", 8); HashMap blankLocations = new HashMap<>(); @@ -1429,37 +1428,45 @@ public class GuiProfileViewer extends GuiScreen { } } } - if(heldItemJson != null && secondLastBlank != null) { - for(int j=0; j2) { + } else if (blanks == 2) { + System.out.println(heldItemLine); + temp.appendTag(new NBTTagString(heldItemLine)); + } else if (blanks > 2) { break; } } + temp.appendTag(new NBTTagString()); } - - newNewLore.appendTag(new NBTTagString(line)); + if (candy != 0) { + temp.appendTag(new NBTTagString(EnumChatFormatting.GREEN + "(" + candy + "/10) Pet Candy Used")); + temp.appendTag(new NBTTagString()); + } + temp.removeTag(temp.tagCount() - 1); } - display.setTag("Lore", newNewLore); - } else { - display.setTag("Lore", newLore); - } - if(candy != 0){ - newLore.appendTag(new NBTTagString()); - newLore.appendTag(new NBTTagString(EnumChatFormatting.GREEN + "(" + candy + "/10) Pet Candy Used")); } + newLore = temp; + display.setTag("Lore", newLore); } if(display.hasKey("Name", 8)) { String displayName = display.getString("Name"); -- cgit From 1036d7c1bb3176ee4addd669c90b7b68edc1fd34 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Tue, 24 Aug 2021 21:24:25 +0200 Subject: Update GuiProfileViewer.java --- .../moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java | 1 - 1 file changed, 1 deletion(-) 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 115660c7..3c448cda 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1450,7 +1450,6 @@ public class GuiProfileViewer extends GuiScreen { if (heldItemLine.trim().isEmpty()) { blanks++; } else if (blanks == 2) { - System.out.println(heldItemLine); temp.appendTag(new NBTTagString(heldItemLine)); } else if (blanks > 2) { break; -- cgit From 0671b644762f8db0da3e749331df7dd33e1124a6 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 24 Aug 2021 22:30:34 +0200 Subject: Update Changelog --- Update Notes/2.0-Pre31.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 60e1f60f..59008c11 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -66,6 +66,8 @@ - Fix being able to hotkey slotlocked items in a chest gui. - (Hopefully) Fix storage overlay nullpointer crash. - Fix not being able to dye undyed leather armour. +- Added pet skins to /pv. (DeDiamondPro) +- Added pet candy to /pv. ### **Other** - Code clean up by Ironm00n. @@ -84,6 +86,8 @@ - Disabled tutorial command. - Disabled gamemodes command. - Changed first time message to open /neuhelp instead of tutorial. +- AOTV Etherwarp fixes. (DeDiamondPro) +- ### **Notes for texturepack creators** -- cgit From d7c31c78fe6cf41de8f0140f00a94d57fbea22be Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 25 Aug 2021 09:51:17 +0200 Subject: Fix fetchur crash/disable BuilderW/BZ/Prisma overlay when not on Pisland --- .../notenoughupdates/miscfeatures/CustomItemEffects.java | 15 +++++++++------ .../notenoughupdates/overlays/TimersOverlay.java | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) 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 0f4e2f4d..d7d27f99 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java @@ -283,10 +283,12 @@ public class CustomItemEffects { } } + boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); + if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay && Minecraft.getMinecraft().objectMouseOver != null && - Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { + Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && onPrivateIsland) { IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState( Minecraft.getMinecraft().objectMouseOver.getBlockPos().offset( @@ -528,6 +530,7 @@ public class CustomItemEffects { ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem(); String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held); if(heldInternal != null) { + boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); EntityPlayer player = event.player; double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double)event.partialTicks; double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double)event.partialTicks; @@ -592,8 +595,8 @@ public class CustomItemEffects { } if(heldInternal.equals("BLOCK_ZAPPER")) { - boolean privateIs = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals("dynamic"); - if (!privateIs || !NotEnoughUpdates.INSTANCE.config.itemOverlays.enableZapperOverlay || + + if (!onPrivateIsland || !NotEnoughUpdates.INSTANCE.config.itemOverlays.enableZapperOverlay || event.target.typeOfHit != MovingObjectPosition.MovingObjectType.BLOCK) { zapperBlocks.clear(); return; @@ -729,7 +732,7 @@ public class CustomItemEffects { GlStateManager.disableBlend(); } } else if(NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay) { - if(heldInternal.equals("BUILDERS_WAND")) { + if(heldInternal.equals("BUILDERS_WAND") && onPrivateIsland) { int maxBlocks = MAX_BUILDERS_BLOCKS; if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState(event.target.getBlockPos().offset(event.target.sideHit, 1)); @@ -811,7 +814,7 @@ public class CustomItemEffects { GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); } - } else if((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET") && NotEnoughUpdates.INSTANCE.config.itemOverlays.enablePrismapumpOverlay) && + } else if((heldInternal.equals("WATER_BUCKET") || heldInternal.equals("MAGICAL_WATER_BUCKET") && NotEnoughUpdates.INSTANCE.config.itemOverlays.enablePrismapumpOverlay && onPrivateIsland) && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { BlockPos hover = event.target.getBlockPos().offset(event.target.sideHit, 1); @@ -893,7 +896,7 @@ public class CustomItemEffects { GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); GlStateManager.disableBlend(); - } else if((heldInternal.equals("HOE_OF_GREAT_TILLING") || heldInternal.equals("HOE_OF_GREATER_TILLING")) && + } else if((heldInternal.equals("HOE_OF_GREAT_TILLING") || heldInternal.equals("HOE_OF_GREATER_TILLING") && onPrivateIsland) && event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { BlockPos target = event.target.getBlockPos(); IBlockState targetState = Minecraft.getMinecraft().theWorld.getBlockState(target); 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 429a3c60..5c0c5ddd 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -134,10 +134,10 @@ public class TimersOverlay extends TextOverlay { ZonedDateTime currentTimeEST = ZonedDateTime.now(ZoneId.of("America/Atikokan")); - long fetchurIndex = (currentTimeEST.getDayOfMonth() % 13)-1; + long fetchurIndex = ((currentTimeEST.getDayOfMonth()+3) % 13)-1; //Added because disabled fetchur and enabled it again but it was showing the wrong item //Lets see if this stays correct - fetchurIndex+=2; + if(fetchurIndex < 0) fetchurIndex += 13; icon = FETCHUR_ICONS[(int)fetchurIndex]; -- cgit From 310e3401adcbaa09485b2a7919932f38948bce51 Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 25 Aug 2021 15:36:23 +0200 Subject: some change log changes --- Update Notes/2.0-Pre31.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 59008c11..b1a37ccc 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -35,6 +35,8 @@ - Added toggle to prismapump overlay. - Added ability to toggle the pickaxe's ability cooldown showing up as the pickaxe durability. - Added alternative command for "/neusouls" "/fairysouls". +- Added pet skins to /pv. (DeDiamondPro) +- Added pet candy to /pv. (DeDiamondPro) ### **Bug Fixes** @@ -66,8 +68,7 @@ - Fix being able to hotkey slotlocked items in a chest gui. - (Hopefully) Fix storage overlay nullpointer crash. - Fix not being able to dye undyed leather armour. -- Added pet skins to /pv. (DeDiamondPro) -- Added pet candy to /pv. + ### **Other** - Code clean up by Ironm00n. @@ -87,7 +88,8 @@ - Disabled gamemodes command. - Changed first time message to open /neuhelp instead of tutorial. - AOTV Etherwarp fixes. (DeDiamondPro) -- +- Disabled Builders wand, block zapper and prismapump overlays on non private islands. + ### **Notes for texturepack creators** -- cgit From 25206150fc9ab860cdf6928acdc5869d96821c5a Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 26 Aug 2021 10:06:48 +0200 Subject: Finish mining overlay --- .../io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index 82b1338e..f85ee646 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -239,7 +239,9 @@ public class MiningOverlay extends TextOverlay { if (name.contains("Gemstone Powder:")) { gemstonePowder = DARK_AQUA + Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", ""); } - if (name.equals(RESET.toString() + BLUE + BOLD + "Forges " + RESET)) { + + + if (name.matches("\\xa7r\\xa79\\xa7lForges \\xa7r(?:\\xa7f\\(\\+1 more\\)\\xa7r)?")) { commissions = false; forges = true; continue; -- cgit From 0ac1e432c21a430bc67543ae2b6978d8a41c1e67 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 26 Aug 2021 14:06:54 +0200 Subject: ICONS --- .../options/seperateSections/Mining.java | 8 ++ .../notenoughupdates/overlays/MiningOverlay.java | 101 ++++++++++++++++++++- 2 files changed, 108 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java index a80e587d..90c4dc8a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java @@ -138,6 +138,14 @@ public class Mining { @ConfigAccordionId(id = 2) public int overlayStyle = 0; + @Expose + @ConfigOption( + name = "Show Icons", + desc = "Show Icons representing the part of the overlay." + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 2) + public boolean dwarvenOverlayIcons = true; @Expose @ConfigOption( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index f85ee646..0ef6de52 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -14,6 +14,7 @@ import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.client.renderer.GlStateManager; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -22,6 +23,7 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.world.WorldSettings; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; +import org.lwjgl.util.vector.Vector2f; import java.util.*; import java.util.function.Supplier; @@ -508,7 +510,7 @@ public class MiningOverlay extends TextOverlay { } long timeDuration = finishTime - currentTimeMillis; - returnText = returnText+ EnumChatFormatting.DARK_PURPLE +this.itemName+" : "; + returnText = returnText+ EnumChatFormatting.DARK_PURPLE +this.itemName+": "; int days = (int) (timeDuration / (1000*60*60*24)); timeDuration = timeDuration-(days*(1000*60*60*24)); @@ -551,5 +553,102 @@ public class MiningOverlay extends TextOverlay { } } + @Override + protected Vector2f getSize(List strings) { + if (NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlayIcons) + return super.getSize(strings).translate(12, 0); + return super.getSize(strings); + } + @Override + protected void renderLine(String line, Vector2f position, boolean dummy) { + if (!NotEnoughUpdates.INSTANCE.config.mining.dwarvenOverlayIcons) return; + GlStateManager.enableDepth(); + + ItemStack icon = null; + String cleaned = Utils.cleanColour(line); + String beforeColon = cleaned.split(":")[0]; + switch (beforeColon) { + case "Mithril Powder": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("INK_SACK-10")); + break; + case "Gemstone Powder": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("INK_SACK-9")); + break; + case "Lucky Raffle": + case "Raffle": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("MINING_RAFFLE_TICKET")); + break; + case "Pickaxe CD": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("DIAMOND_PICKAXE")); + break; + case "Thyst Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("THYST_MONSTER")); + break; + case "Hard Stone Miner": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("HARD_STONE")); + break; + case "Ice Walker Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ENCHANTED_ICE")); + break; + case "Goblin Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("GOBLIN_MONSTER")); + break; + case "Star Sentry Puncher": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("NETHER_STAR")); + break; + case "Goblin Raid": + case "Goblin Raid Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ENCHANTED_GOLD")); + break; + case "2x Mithril Powder Collector": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ENCHANTED_GLOWSTONE_DUST")); + break; + case "Automaton Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("AUTOMATON_MONSTER")); + break; + case "Sludge Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("SLUDGE_MONSTER")); + break; + case "Team Treasurite Member Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("EXECUTIVE_WENDY_MONSTER")); + break; + case "Yog Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("YOG_MONSTER")); + break; + case "Boss Corleone Slayer": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("BOSS_CORLEONE_BOSS")); + break; + case "Chest Looter": + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("CHEST")); + break; + } + if (icon == null) { + if(beforeColon.startsWith("Forge")){ + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ANVIL")); + } else if (beforeColon.contains("Mithril")) { + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("MITHRIL_ORE")); + } else if(beforeColon.endsWith(" Gemstone Collector")){ + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("ROUGH_" + + beforeColon.replace(" Gemstone Collector", "").toUpperCase() + "_GEM")); + } else if (beforeColon.endsWith(" Crystal Hunter")){ + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("PERFECT_" + + beforeColon.replace(" Crystal Hunter", "").toUpperCase() + "_GEM")); + } else if (beforeColon.contains("Titanium")) { + icon = NotEnoughUpdates.INSTANCE.manager.jsonToStack(NotEnoughUpdates.INSTANCE.manager.getItemInformation().get("TITANIUM_ORE")); + } + } + + if (icon != null) { + GlStateManager.pushMatrix(); + GlStateManager.translate(position.x, position.y, 0); + GlStateManager.scale(0.5f, 0.5f, 1f); + Utils.drawItemStack(icon, 0, 0); + GlStateManager.popMatrix(); + + position.x += 12; + } + + super.renderLine(line, position, dummy); + } } -- cgit From b1fa15a4b7fc857f68b08d4ca6ba0b5a8ad21d99 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 26 Aug 2021 14:54:16 +0200 Subject: fix max + save max to config --- .../moulberry/notenoughupdates/options/NEUConfig.java | 2 ++ .../notenoughupdates/overlays/MiningOverlay.java | 15 ++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) 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 22d3f6ff..98816714 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -23,6 +23,7 @@ import org.lwjgl.util.vector.Vector2f; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Map; public class NEUConfig extends Config { @@ -285,6 +286,7 @@ public class NEUConfig extends Config { @Expose public ArrayList enchantColours = createDefaultEnchantColours(); @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"; + @Expose public Map commissionMaxes = new HashMap<>(); @Expose public boolean firstTimeSearchFocus = true; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index 0ef6de52..dfc12246 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -38,8 +38,7 @@ public class MiningOverlay extends TextOverlay { super(position, dummyStrings, styleSupplier); } - private static final Pattern NUMBER_PATTERN = Pattern.compile("\\d+(?: |$)"); - private static Map commissionMaxes = new HashMap<>(); + private static final Pattern NUMBER_PATTERN = Pattern.compile("(?\\d*,?\\d+)(?: |$)"); public static Map commissionProgress = new LinkedHashMap<>(); @Override @@ -67,8 +66,10 @@ public class MiningOverlay extends TextOverlay { Matcher matcher = NUMBER_PATTERN.matcher(clean); if(matcher.find()) { try { - numberValue = Integer.parseInt(matcher.group()); - } catch(NumberFormatException ignored) {} + numberValue = Integer.parseInt(matcher.group("number").replace(",", "")); + } catch(NumberFormatException ignored) { + ignored.printStackTrace(); + } } } } @@ -80,7 +81,7 @@ public class MiningOverlay extends TextOverlay { } } if(name != null && numberValue > 0) { - commissionMaxes.put(name, numberValue); + NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.put(name, numberValue); } } } @@ -343,8 +344,8 @@ public class MiningOverlay extends TextOverlay { } else if (entry.getValue() >= 0.25) { col = GOLD; } - if (true && commissionMaxes.containsKey(entry.getKey())) { - int max = commissionMaxes.get(entry.getKey()); + if (NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.containsKey(entry.getKey())) { + int max = NotEnoughUpdates.INSTANCE.config.hidden.commissionMaxes.get(entry.getKey()); commissionsStrings.add(DARK_AQUA + entry.getKey() + ": " + col + Math.round(entry.getValue() * max) + "/" + max); } else { String valS = Utils.floatToString(entry.getValue() * 100, 1); -- cgit From 6911f81fe51a1e0b61ac099638e9ce2039b100de Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 26 Aug 2021 18:14:38 +0200 Subject: command block to open pv --- .../moulberry/notenoughupdates/NEUEventListener.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 08ef97a9..ea9994a7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -937,6 +937,16 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if(containerName.endsWith(" Profile")){ + Slot slot = new Slot(cc.getLowerChestInventory(), 34, cc.inventorySlots.get(34).xDisplayPosition, cc.inventorySlots.get(34).yDisplayPosition); + slot.putStack(Utils.createItemStack(Item.getItemFromBlock(Blocks.command_block), EnumChatFormatting.GREEN + "Profile Viewer", + EnumChatFormatting.YELLOW + "Click to open NEU profile viewer!")); + cc.inventorySlots.replaceAll(e -> { + if(e.getSlotIndex() == 34) + return slot; + return e; + }); + } } if(GuiCustomEnchant.getInstance().shouldOverride(containerName)) { @@ -1386,6 +1396,12 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); + if(containerName.endsWith(" Profile") && eventGui.getSlotUnderMouse() != null && eventGui.getSlotUnderMouse().getSlotIndex() == 34 && + Mouse.getEventButton() >= 0) { + event.setCanceled(true); + Utils.playPressSound(); + NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{containerName.replaceAll("'s? Profile", "")}); + } } if(GuiCustomEnchant.getInstance().shouldOverride(containerName) && -- cgit From d6d24db17354c116276a1dae86f4a65d590d206b Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 26 Aug 2021 18:16:56 +0200 Subject: make ignored ignored again --- .../io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index dfc12246..c338c9a5 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -67,9 +67,7 @@ public class MiningOverlay extends TextOverlay { if(matcher.find()) { try { numberValue = Integer.parseInt(matcher.group("number").replace(",", "")); - } catch(NumberFormatException ignored) { - ignored.printStackTrace(); - } + } catch(NumberFormatException ignored) {} } } } -- cgit From aa02a5289fde79009bb2fb19daf95721c909e349 Mon Sep 17 00:00:00 2001 From: DoKM Date: Thu, 26 Aug 2021 20:42:15 +0200 Subject: Make print stacktrace only in dev mode --- .../java/io/github/moulberry/notenoughupdates/util/HypixelApi.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java b/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java index f7d5157f..e75eaebb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/HypixelApi.java @@ -2,6 +2,7 @@ package io.github.moulberry.notenoughupdates.util; import com.google.gson.Gson; import com.google.gson.JsonObject; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import org.apache.commons.io.IOUtils; import java.io.BufferedReader; @@ -80,7 +81,9 @@ public class HypixelApi { try { consumer.accept(getApiSync(getMyApiURL()+urlS)); } catch(Exception e) { - e.printStackTrace(); + if(NotEnoughUpdates.INSTANCE.config.hidden.dev) { + e.printStackTrace(); + } myApiError(current); error.run(); } -- cgit From 076bdfd4b862b73a671b80c5502cd5ef2cff19ef Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 27 Aug 2021 15:05:38 +0200 Subject: Bit of code cleanup --- .../notenoughupdates/overlays/MiningOverlay.java | 30 +++++++++++++--------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index c338c9a5..8a4c697e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -97,11 +97,11 @@ public class MiningOverlay extends TextOverlay { String line = lore[i1]; Matcher matcher = timeRemainingForge.matcher(line); if (stack.getDisplayName().matches("\\xA7cSlot #([1-5])")) { - ForgeItem newForgeItem = new ForgeItem("Locked", 0, 1, i, false); + ForgeItem newForgeItem = new ForgeItem(i, 1, false); replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); //empty Slot } else if (stack.getDisplayName().matches("\\xA7aSlot #([1-5])")) { - ForgeItem newForgeItem = new ForgeItem("Empty", 0, 0, i, false); + ForgeItem newForgeItem = new ForgeItem(i, 0, false); replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); } else if (matcher.matches()) { String timeremainingString = matcher.group(1); @@ -109,7 +109,7 @@ public class MiningOverlay extends TextOverlay { long duration = 0; if (matcher.group("Completed") != null && !matcher.group("Completed").equals("")) { - ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), 0, 2, i, false); + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), 0, i, false); replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); } else { @@ -129,7 +129,7 @@ public class MiningOverlay extends TextOverlay { } catch (Exception ignored) { } if (duration > 0) { - ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), System.currentTimeMillis() + duration, 2, i, false); + ForgeItem newForgeItem = new ForgeItem(Utils.cleanColour(stack.getDisplayName()), System.currentTimeMillis() + duration, i, false); replaceForgeOrAdd(newForgeItem, hidden.forgeItems, true); } } @@ -260,10 +260,10 @@ public class MiningOverlay extends TextOverlay { } else { if (name.contains("LOCKED")) { - ForgeItem item = new ForgeItem("Locked", 0, 1, forgeInt, true); + ForgeItem item = new ForgeItem(forgeInt, 1,true); replaceForgeOrAdd(item, hidden.forgeItems, true); } else if (name.contains("EMPTY")) { - ForgeItem item = new ForgeItem("Empty", 0, 0, forgeInt, true); + ForgeItem item = new ForgeItem(forgeInt, 0,true); replaceForgeOrAdd(item, hidden.forgeItems, true); //forgeStringsEmpty.add(DARK_AQUA+"Forge "+ Utils.trimIgnoreColour(name).replaceAll("\u00a7[f|F|r]", "")); } else { @@ -276,7 +276,7 @@ public class MiningOverlay extends TextOverlay { String itemName = matcher.group(1); if (matcher.group("Ready") != null && !matcher.group("Ready").equals("")) { - ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), 0, 2, forgeInt, true); + ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), 0, forgeInt, true); replaceForgeOrAdd(item, hidden.forgeItems, true); } else { long duration = 0; @@ -297,7 +297,7 @@ public class MiningOverlay extends TextOverlay { } if (duration > 0) { duration = duration + 4000; - ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), System.currentTimeMillis() + duration, 2, forgeInt, true); + ForgeItem item = new ForgeItem(Utils.cleanColour(itemName), System.currentTimeMillis() + duration, forgeInt, true); replaceForgeOrAdd(item, hidden.forgeItems, false); } } @@ -483,17 +483,23 @@ public class MiningOverlay extends TextOverlay { } public static class ForgeItem{ - public ForgeItem(String itemName, long finishTime, int status, int forgeID, boolean fromScoreBoard){ + public ForgeItem(String itemName, long finishTime, int forgeID, boolean fromScoreBoard){ this.itemName = itemName; this.finishTime = finishTime; - this.status = status; + this.status = 2; + this.forgeID = forgeID; + this.fromScoreBoard = fromScoreBoard; + } + + public ForgeItem(int forgeID, int status, boolean fromScoreBoard){ this.forgeID = forgeID; + this.status = status; this.fromScoreBoard = fromScoreBoard; } - @Expose public final String itemName; - @Expose public final long finishTime; + @Expose public String itemName; + @Expose public long finishTime; @Expose public final int status; @Expose public final int forgeID; @Expose public final boolean fromScoreBoard; -- cgit From 45d4cfb62437201fbcacea0fe888acab7806dc62 Mon Sep 17 00:00:00 2001 From: DoKM Date: Fri, 27 Aug 2021 18:53:32 +0200 Subject: Redo the tutorial gui a bit Might be used at a later date, but this should make it easier to make multiple tutorial gui's with buttons that run commands --- .../moulberry/notenoughupdates/NEUOverlay.java | 2 - .../notenoughupdates/NotEnoughUpdates.java | 5 +- .../notenoughupdates/miscgui/HelpGUI.java | 189 ------------ .../miscgui/tutorials/NeuConfigTutorial.java | 9 + .../miscgui/tutorials/NeuTutorial.java | 127 ++++++++ .../miscgui/tutorials/TutorialBase.java | 319 +++++++++++++++++++++ 6 files changed, 458 insertions(+), 193 deletions(-) delete mode 100644 src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuConfigTutorial.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuTutorial.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index 79a822d8..1c6ae7f7 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -15,7 +15,6 @@ import io.github.moulberry.notenoughupdates.mbgui.MBGuiElement; import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupAligned; import io.github.moulberry.notenoughupdates.mbgui.MBGuiGroupFloating; import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu; -import io.github.moulberry.notenoughupdates.miscgui.HelpGUI; import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; import io.github.moulberry.notenoughupdates.util.*; import net.minecraft.client.Minecraft; @@ -52,7 +51,6 @@ import org.lwjgl.util.vector.Vector2f; import java.awt.*; import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.util.List; import java.util.*; import java.util.concurrent.ExecutorService; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index f0cf7774..142cb149 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -27,6 +27,7 @@ import io.github.moulberry.notenoughupdates.gamemodes.GuiGamemodes; import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes; import io.github.moulberry.notenoughupdates.miscfeatures.*; import io.github.moulberry.notenoughupdates.miscgui.*; +import io.github.moulberry.notenoughupdates.miscgui.tutorials.NeuTutorial; import io.github.moulberry.notenoughupdates.options.NEUConfig; import io.github.moulberry.notenoughupdates.options.NEUConfigEditor; import io.github.moulberry.notenoughupdates.overlays.FuelBar; @@ -990,7 +991,7 @@ public class NotEnoughUpdates { SimpleCommand tutorialCommand = new SimpleCommand("neututorial", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { - openGui = new HelpGUI(); + openGui = new NeuTutorial(); } }); @@ -1257,7 +1258,7 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(packDevCommand); if(!Loader.isModLoaded("skyblockextras")) ClientCommandHandler.instance.registerCommand(viewCataCommand); ClientCommandHandler.instance.registerCommand(peekCommand); - //ClientCommandHandler.instance.registerCommand(tutorialCommand); +// ClientCommandHandler.instance.registerCommand(tutorialCommand); ClientCommandHandler.instance.registerCommand(overlayPlacementsCommand); ClientCommandHandler.instance.registerCommand(enchantColourCommand); ClientCommandHandler.instance.registerCommand(neuAhCommand); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java deleted file mode 100644 index cc41a76f..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/HelpGUI.java +++ /dev/null @@ -1,189 +0,0 @@ -package io.github.moulberry.notenoughupdates.miscgui; - -import io.github.moulberry.notenoughupdates.util.TexLoc; -import io.github.moulberry.notenoughupdates.util.Utils; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.ResourceLocation; -import org.lwjgl.input.Keyboard; -import org.lwjgl.util.vector.Vector2f; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class HelpGUI extends GuiScreen { - - private int guiLeft = 0; - private int guiTop = 0; - private int sizeX = 0; - private int sizeY = 0; - - private int page = 0; - private ResourceLocation screenshotBorder = new ResourceLocation("notenoughupdates:ss_border.jpg"); - private ResourceLocation[] screenshots = null; - - int scaleFactor = 0; - - @Override - public void setWorldAndResolution(Minecraft mc, int width, int height) { - super.setWorldAndResolution(mc, width, height); - - screenshots = new ResourceLocation[18]; - for(int i=0; i<=17; i++) { - screenshots[i] = new ResourceLocation("notenoughupdates:ss_small/ss"+(i+1)+"-0.jpg"); - } - } - - @Override - protected void keyTyped(char typedChar, int keyCode) throws IOException { - Keyboard.enableRepeatEvents(true); - super.keyTyped(typedChar, keyCode); - if(keyCode == Keyboard.KEY_LEFT) { - page--; - } else if(keyCode == Keyboard.KEY_RIGHT) { - page++; - } - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - super.drawScreen(mouseX, mouseY, partialTicks); - - drawDefaultBackground(); - - ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); - scaleFactor = scaledResolution.getScaleFactor(); - - sizeX = width/2+40/scaleFactor; - sizeY = height/2+40/scaleFactor; - guiLeft = width/4-20/scaleFactor; - guiTop = height/4-20/scaleFactor; - - Minecraft.getMinecraft().getTextureManager().bindTexture(screenshotBorder); - Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY); - - page = Math.max(0, Math.min(17, page)); - - Minecraft.getMinecraft().getTextureManager().bindTexture(screenshots[page]); - Utils.drawTexturedRect(guiLeft+20f/scaleFactor, guiTop+20f/scaleFactor, sizeX-40f/scaleFactor, sizeY-40f/scaleFactor); - - Utils.drawStringCentered(EnumChatFormatting.GOLD+"NEU Tutorial - Page "+(page+1)+"/18 - Use arrow keys", Minecraft.getMinecraft().fontRendererObj, - width/2, guiTop+8, true, 0); - if(scaleFactor != 2) Utils.drawStringCentered(EnumChatFormatting.GOLD+"Use GUI Scale normal for better reading experience", Minecraft.getMinecraft().fontRendererObj, - width/2, guiTop+18, true, 0); - - for(Map.Entry> entry : texts[page].entrySet()) { - Vector2f location = entry.getKey(); - List text = entry.getValue(); - - float x = guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*location.x; - float y = guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*location.y; - - Utils.drawHoveringText(text, (int)x, (int)y+12, 100000, 100000, 200, Minecraft.getMinecraft().fontRendererObj); - } - } - - - private static HashMap>[] texts = new HashMap[18]; - static { - for(int i=0; i<18; i++) { - texts[i] = new HashMap<>(); - } - texts[0].put(new Vector2f(0.73f, 0.60f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"Here you will find a list of (most) skyblock items", - EnumChatFormatting.GRAY+"The itemlist can be accessed by opening your inventory or most menus while on skyblock")); - texts[1].put(new Vector2f(0.73f, 0.16f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"These are the page controls for the itemlist", - EnumChatFormatting.GRAY+"Clicking these controls will bring you to other pages of the itemlist")); - texts[2].put(new Vector2f(0.73f, 1.05f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"These are the sorting controls for the itemlist", - EnumChatFormatting.GRAY+"The buttons on the left control the ordering of the items", - EnumChatFormatting.GRAY+"The buttons on the right can be used to filter a certain type of item")); - texts[3].put(new Vector2f(0.39f, 1.04f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"This is the search bar for the itemlist", - EnumChatFormatting.GRAY+"Double-click the bar to enable inventory search mode", - EnumChatFormatting.GRAY+"The button on the left opens up the mod settings", - EnumChatFormatting.GRAY+"The button on the right displays this tutorial")); - texts[4].put(new Vector2f(0.39f, 0.99f), Utils.createList( - EnumChatFormatting.GOLD+"QuickCommands", - EnumChatFormatting.GRAY+"These are the QuickCommands", - EnumChatFormatting.GRAY+"They let you warp around or access certain menus more easily")); - texts[5].put(new Vector2f(0.7f, 0.71f), Utils.createList( - EnumChatFormatting.GOLD+"Itemlist", - EnumChatFormatting.GRAY+"Hover over an item in the list to display it's lore", - EnumChatFormatting.GRAY+"Left clicking some items will display the recipe for that item", - EnumChatFormatting.GRAY+"Right clicking some items will display a wiki page for that item", - EnumChatFormatting.GRAY+"'F' will favourite an item, putting it to the top of the itemlist")); - texts[6].put(new Vector2f(0.17f, 0.21f), Utils.createList( - EnumChatFormatting.GOLD+"Collection Log", - EnumChatFormatting.GRAY+"This is the collection log. It can be accessed using the /neucl command, or via the QuickCommand", - EnumChatFormatting.GRAY+"The collection log keeps track of all items that enter your inventory while you are playing skyblock", - EnumChatFormatting.GRAY+"If you are a completionist, this feature is for you")); - texts[7].put(new Vector2f(0.05f, 0.13f), Utils.createList( - EnumChatFormatting.GOLD+"Collection Log", - EnumChatFormatting.GRAY+"Clicking on 'Filter' will change the items that", - EnumChatFormatting.GRAY+"appear in the list")); - texts[8].put(new Vector2f(0.35f, 0.74f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"This is the NEU Auction House (NeuAH)", - EnumChatFormatting.GRAY+"This AH can be accessed from anywhere using the /neuah command, or via the QuickCommand", - EnumChatFormatting.GRAY+"The items here refresh automatically, so there is no need to close the GUI to see the latest auctions", - EnumChatFormatting.GRAY+"Sometimes, you might have to wait until the list is populated with items from the API")); - texts[9].put(new Vector2f(0.41f, 0.40f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"These tabs control the items that appear in NeuAH", - EnumChatFormatting.GRAY+"You can find the main categories on the top of the GUI and subcategories appear on the side of the GUI once a main category is selected")); - texts[10].put(new Vector2f(0.57f, 0.38f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"Search for items using the search bar at the top", - EnumChatFormatting.GRAY+"Boolean operators such as &, | or ! work here.")); - texts[10].put(new Vector2f(0.40f, 0.72f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"This toolbar contains many useful features", - EnumChatFormatting.GRAY+"which control the sorting and ordering of", - EnumChatFormatting.GRAY+"the auction house, similar to the normal AH")); - texts[11].put(new Vector2f(0.55f, 0.72f), Utils.createList( - EnumChatFormatting.GOLD+"NeuAH", - EnumChatFormatting.GRAY+"Clicking on an item will bring up the auction view", - EnumChatFormatting.GRAY+"Here you can viewer the buyer/seller and place bids or make purchases", - EnumChatFormatting.GRAY+"Trying to purchase an item will result in a confirmation GUI similar to the normal AH")); - texts[12].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"Access the profile viewer using /neuprofile (ign) or /pv (ign)", - EnumChatFormatting.GRAY+"This is the main page of the profile viewer", - EnumChatFormatting.GRAY+"This page contains basic information like stats and skill levels")); - texts[12].put(new Vector2f(0.72f, 0.55f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"Click the button on the left to switch profiles and use the bar on the right to switch players")); - texts[13].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the extra info page of the profile viewer", - EnumChatFormatting.GRAY+"This page contains all the small bits of information about a player that don't fit anywhere else")); - texts[14].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the inventories page of the profile viewer", - EnumChatFormatting.GRAY+"Click on the inventory icons in the top-left or use your keyboard to switch the inventory type", - EnumChatFormatting.GRAY+"The bar on the bottom-left searches the current inventory for matching items")); - texts[15].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the collections page of the profile viewer", - EnumChatFormatting.GRAY+"Click on the icons on the left or use the keyboard shortcut to switch collection type")); - texts[16].put(new Vector2f(0.28f, 0.82f), Utils.createList( - EnumChatFormatting.GOLD+"Profile Viewer", - EnumChatFormatting.GRAY+"This is the pets page of the profile viewer", - EnumChatFormatting.GRAY+"Click to select the pet on the left", - EnumChatFormatting.GRAY+"The selected pet's stats will display on the right")); - texts[17].put(new Vector2f(0.27f, 0.40f), Utils.createList( - EnumChatFormatting.GOLD+"Overlay", - EnumChatFormatting.GRAY+"Rearrange certain GUI elements of the main overlay using /neuoverlay", - EnumChatFormatting.GRAY+"If you accidentally move them off screen, use the button in the top left to reset the GUI")); - } -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuConfigTutorial.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuConfigTutorial.java new file mode 100644 index 00000000..c4d0115f --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuConfigTutorial.java @@ -0,0 +1,9 @@ +package io.github.moulberry.notenoughupdates.miscgui.tutorials; + +public class NeuConfigTutorial extends TutorialBase { + + static { + title = "NEU Config Tutorial"; + } + +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuTutorial.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuTutorial.java new file mode 100644 index 00000000..454c8788 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/NeuTutorial.java @@ -0,0 +1,127 @@ +package io.github.moulberry.notenoughupdates.miscgui.tutorials; + +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import org.lwjgl.util.vector.Vector2f; + +import java.util.ArrayList; +import java.util.HashMap; + +public class NeuTutorial extends TutorialBase { + + static { + title = "NEU Tutorial"; + } + + @Override + public void setWorldAndResolution(Minecraft mc, int width, int height) { + super.setWorldAndResolution(mc, width, height); + screenshots = new ResourceLocation[18]; + for (int i = 0; i <= 17; i++) { + screenshots[i] = new ResourceLocation("notenoughupdates:ss_small/ss" + (i + 1) + "-0.jpg"); + } + } + +// static { +// +// texts[0].put(new Vector2f(0.73f, 0.60f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Here you will find a list of (most) skyblock items", +// EnumChatFormatting.GRAY+"The itemlist can be accessed by opening your inventory or most menus while on skyblock")); +// texts[1].put(new Vector2f(0.73f, 0.16f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the page controls for the itemlist", +// EnumChatFormatting.GRAY+"Clicking these controls will bring you to other pages of the itemlist")); +// texts[2].put(new Vector2f(0.73f, 1.05f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the sorting controls for the itemlist", +// EnumChatFormatting.GRAY+"The buttons on the left control the ordering of the items", +// EnumChatFormatting.GRAY+"The buttons on the right can be used to filter a certain type of item")); +// texts[3].put(new Vector2f(0.39f, 1.04f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"This is the search bar for the itemlist", +// EnumChatFormatting.GRAY+"Double-click the bar to enable inventory search mode", +// EnumChatFormatting.GRAY+"The button on the left opens up the mod settings", +// EnumChatFormatting.GRAY+"The button on the right displays this tutorial")); +// texts[4].put(new Vector2f(0.39f, 0.99f), Utils.createList( +// EnumChatFormatting.GOLD+"QuickCommands", +// EnumChatFormatting.GRAY+"These are the QuickCommands", +// EnumChatFormatting.GRAY+"They let you warp around or access certain menus more easily")); +// texts[5].put(new Vector2f(0.7f, 0.71f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Hover over an item in the list to display it's lore", +// EnumChatFormatting.GRAY+"Left clicking some items will display the recipe for that item", +// EnumChatFormatting.GRAY+"Right clicking some items will display a wiki page for that item", +// EnumChatFormatting.GRAY+"'F' will favourite an item, putting it to the top of the itemlist")); +// texts[6].put(new Vector2f(0.17f, 0.21f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"This is the collection log. It can be accessed using the /neucl command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The collection log keeps track of all items that enter your inventory while you are playing skyblock", +// EnumChatFormatting.GRAY+"If you are a completionist, this feature is for you")); +// texts[7].put(new Vector2f(0.05f, 0.13f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"Clicking on 'Filter' will change the items that", +// EnumChatFormatting.GRAY+"appear in the list")); +// texts[8].put(new Vector2f(0.35f, 0.74f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This is the NEU Auction House (NeuAH)", +// EnumChatFormatting.GRAY+"This AH can be accessed from anywhere using the /neuah command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The items here refresh automatically, so there is no need to close the GUI to see the latest auctions", +// EnumChatFormatting.GRAY+"Sometimes, you might have to wait until the list is populated with items from the API")); +// texts[9].put(new Vector2f(0.41f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"These tabs control the items that appear in NeuAH", +// EnumChatFormatting.GRAY+"You can find the main categories on the top of the GUI and subcategories appear on the side of the GUI once a main category is selected")); +// texts[10].put(new Vector2f(0.57f, 0.38f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Search for items using the search bar at the top", +// EnumChatFormatting.GRAY+"Boolean operators such as &, | or ! work here.")); +// texts[10].put(new Vector2f(0.40f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This toolbar contains many useful features", +// EnumChatFormatting.GRAY+"which control the sorting and ordering of", +// EnumChatFormatting.GRAY+"the auction house, similar to the normal AH")); +// texts[11].put(new Vector2f(0.55f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Clicking on an item will bring up the auction view", +// EnumChatFormatting.GRAY+"Here you can viewer the buyer/seller and place bids or make purchases", +// EnumChatFormatting.GRAY+"Trying to purchase an item will result in a confirmation GUI similar to the normal AH")); +// texts[12].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Access the profile viewer using /neuprofile (ign) or /pv (ign)", +// EnumChatFormatting.GRAY+"This is the main page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains basic information like stats and skill levels")); +// texts[12].put(new Vector2f(0.72f, 0.55f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Click the button on the left to switch profiles and use the bar on the right to switch players")); +// texts[13].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the extra info page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains all the small bits of information about a player that don't fit anywhere else")); +// texts[14].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the inventories page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the inventory icons in the top-left or use your keyboard to switch the inventory type", +// EnumChatFormatting.GRAY+"The bar on the bottom-left searches the current inventory for matching items")); +// texts[15].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the collections page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the icons on the left or use the keyboard shortcut to switch collection type")); +// texts[16].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the pets page of the profile viewer", +// EnumChatFormatting.GRAY+"Click to select the pet on the left", +// EnumChatFormatting.GRAY+"The selected pet's stats will display on the right")); +// texts[17].put(new Vector2f(0.27f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"Overlay", +// EnumChatFormatting.GRAY+"Rearrange certain GUI elements of the main overlay using /neuoverlay", +// EnumChatFormatting.GRAY+"If you accidentally move them off screen, use the button in the top left to reset the GUI")); +// } +// +// static { +// buttons = new ArrayList<>(); +// buttons.add(createNewButton(0.27f, 0.40f, new int[]{1, 2},"TESTSHIT", "neu")); +// } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java new file mode 100644 index 00000000..215f210c --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/tutorials/TutorialBase.java @@ -0,0 +1,319 @@ +package io.github.moulberry.notenoughupdates.miscgui.tutorials; + +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import io.github.moulberry.notenoughupdates.NotEnoughUpdates; +import io.github.moulberry.notenoughupdates.util.Utils; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.client.ClientCommandHandler; +import org.lwjgl.input.Keyboard; +import org.lwjgl.opengl.GL11; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +import static io.github.moulberry.notenoughupdates.miscgui.GuiEnchantColour.custom_ench_colour; + +public class TutorialBase extends GuiScreen { + + private int guiLeft = 0; + private int guiTop = 0; + private int sizeX = 0; + private int sizeY = 0; + + protected static String title; + + private int page = 0; + private ResourceLocation screenshotBorder = new ResourceLocation("notenoughupdates:ss_border.jpg"); + + protected ResourceLocation[] screenshots = null; + + int scaleFactor = 0; + + + + @Override + public void setWorldAndResolution(Minecraft mc, int width, int height) { + super.setWorldAndResolution(mc, width, height); + } + + @Override + protected void keyTyped(char typedChar, int keyCode) throws IOException { + Keyboard.enableRepeatEvents(true); + super.keyTyped(typedChar, keyCode); + if(keyCode == Keyboard.KEY_LEFT) { + page--; + } else if(keyCode == Keyboard.KEY_RIGHT) { + page++; + } + } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + super.drawScreen(mouseX, mouseY, partialTicks); + + drawDefaultBackground(); + + ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft()); + scaleFactor = scaledResolution.getScaleFactor(); + + sizeX = width/2+40/scaleFactor; + sizeY = height/2+40/scaleFactor; + guiLeft = width/4-20/scaleFactor; + guiTop = height/4-20/scaleFactor; + + Minecraft.getMinecraft().getTextureManager().bindTexture(screenshotBorder); + Utils.drawTexturedRect(guiLeft, guiTop, sizeX, sizeY); + + page = Math.max(0, Math.min(17, page)); + + Minecraft.getMinecraft().getTextureManager().bindTexture(screenshots[page]); + Utils.drawTexturedRect(guiLeft+20f/scaleFactor, guiTop+20f/scaleFactor, sizeX-40f/scaleFactor, sizeY-40f/scaleFactor); + + Utils.drawStringCentered(EnumChatFormatting.GOLD+title+" - Page "+(page+1)+"/"+(texts.size())+" - Use arrow keys", Minecraft.getMinecraft().fontRendererObj, + width/2, guiTop+8, true, 0); + if(scaleFactor != 2) Utils.drawStringCentered(EnumChatFormatting.GOLD+"Use GUI Scale normal for better reading experience", Minecraft.getMinecraft().fontRendererObj, + width/2, guiTop+18, true, 0); + JsonArray pageTexts = texts.get(page); + for (int i = 0; i < pageTexts.size(); i++) { + JsonObject textElement = pageTexts.get(i).getAsJsonObject(); + float oldX = textElement.get("x").getAsFloat(); + float oldY = textElement.get("y").getAsFloat(); + +// List text = entry.getValue(); + JsonArray textArray = textElement.getAsJsonArray("lines"); + List text = new ArrayList<>(); + for (int j = 0; j < textArray.size(); j++) { + text.add(textArray.get(j).getAsString()); + } + + + float x = guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*oldX; + float y = guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*oldY; + + Utils.drawHoveringText(text, (int)x, (int)y+12, 100000, 100000, 200, Minecraft.getMinecraft().fontRendererObj); + } + + drawButtons(); + } + + protected void drawButtons(){ + + for (int i = 0; i < buttons.size(); i++) { + JsonObject button = buttons.get(i); + JsonArray pages = button.get("pages").getAsJsonArray(); + boolean drawButton = false; + for (int i1 = 0; i1 < pages.size(); i1++) { + if(pages.get(i1).getAsInt() == page){ + drawButton = true; + break; + } + } + if(!drawButton){ + continue; + } + float x = button.get("x").getAsFloat(); + float y = button.get("y").getAsFloat(); + String text = button.get("text").getAsString(); +// String command = button.get("command").getAsString(); + Minecraft.getMinecraft().getTextureManager().bindTexture(custom_ench_colour); + GlStateManager.color(1, 1, 1, 1); + Utils.drawTexturedRect(guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*x, guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*y, 88, 20, 64/217f, 152/217f, 48/78f, 68/78f, GL11.GL_NEAREST); + Utils.drawStringCenteredScaledMaxWidth(text, fontRendererObj, (guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*x)+44, (guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*y)+10, false, 86, 4210752); + + + } + } + + @Override + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + int width= 88; + int height = 20; + + for (int i = 0; i < buttons.size(); i++) { + JsonObject button = buttons.get(i); + JsonArray pages = button.get("pages").getAsJsonArray(); + boolean drawButton = false; + for (int i1 = 0; i1 < pages.size(); i1++) { + if(pages.get(i1).getAsInt() == page){ + drawButton = true; + break; + } + } + if(!drawButton){ + continue; + } + float x = button.get("x").getAsFloat(); + float y = button.get("y").getAsFloat(); + //String text = button.get("text").getAsString(); + float realX = guiLeft+20f/scaleFactor+(sizeX-40f/scaleFactor)*x; + float realY = guiTop+20f/scaleFactor+(sizeY-40f/scaleFactor)*y; + if(mouseX > realX && mouseX < realX+width && mouseY > realY && mouseY < realY+height){ + String command = button.get("command").getAsString(); + NotEnoughUpdates.INSTANCE.openGui = null; + ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, "/"+command); + return; + } + } + } + + + + + + protected static List texts = new ArrayList(); + + protected static List buttons = new ArrayList<>(); + + protected static JsonObject createNewButton(float x, float y, int[] pages, String text, String command){ + JsonObject button = new JsonObject(); + JsonArray pagesArray = new JsonArray(); + for (int i = 0; i < pages.length; i++) { + pagesArray.add(new JsonPrimitive(pages[i])); + } + button.add("pages",pagesArray); + button.add("x", new JsonPrimitive(x)); + button.add("y", new JsonPrimitive(y)); + button.add("text", new JsonPrimitive(text)); + button.add("command", new JsonPrimitive(command)); + return button; + } + + protected static JsonArray createNewTexts(JsonObject... texts){ + JsonArray textArray = new JsonArray(); + for (int i = 0; i < texts.length; i++) { + textArray.add(texts[i]); + } + return textArray; + } + + protected static JsonObject createNewText(float x, float y, String... texts){ + JsonObject tooltip = new JsonObject(); + tooltip.add("x", new JsonPrimitive(x)); + tooltip.add("y", new JsonPrimitive(y)); + JsonArray lines = new JsonArray(); + for (int i = 0; i < texts.length; i++) { + lines.add(new JsonPrimitive(texts[i])); + } + tooltip.add("lines", lines); + return tooltip; + } + + protected static JsonObject createNewText(float x, float y, List texts){ + JsonObject tooltip = new JsonObject(); + tooltip.add("x", new JsonPrimitive(x)); + tooltip.add("y", new JsonPrimitive(y)); + JsonArray lines = new JsonArray(); + for (int i = 0; i < texts.size(); i++) { + lines.add(new JsonPrimitive(texts.get(i))); + } + tooltip.add("lines", lines); + return tooltip; + } + +// static { +// for(int i=0; i<18; i++) { +// texts[i] = new HashMap<>(); +// } +// texts[0].put(new Vector2f(0.73f, 0.60f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Here you will find a list of (most) skyblock items", +// EnumChatFormatting.GRAY+"The itemlist can be accessed by opening your inventory or most menus while on skyblock")); +// texts[1].put(new Vector2f(0.73f, 0.16f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the page controls for the itemlist", +// EnumChatFormatting.GRAY+"Clicking these controls will bring you to other pages of the itemlist")); +// texts[2].put(new Vector2f(0.73f, 1.05f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"These are the sorting controls for the itemlist", +// EnumChatFormatting.GRAY+"The buttons on the left control the ordering of the items", +// EnumChatFormatting.GRAY+"The buttons on the right can be used to filter a certain type of item")); +// texts[3].put(new Vector2f(0.39f, 1.04f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"This is the search bar for the itemlist", +// EnumChatFormatting.GRAY+"Double-click the bar to enable inventory search mode", +// EnumChatFormatting.GRAY+"The button on the left opens up the mod settings", +// EnumChatFormatting.GRAY+"The button on the right displays this tutorial")); +// texts[4].put(new Vector2f(0.39f, 0.99f), Utils.createList( +// EnumChatFormatting.GOLD+"QuickCommands", +// EnumChatFormatting.GRAY+"These are the QuickCommands", +// EnumChatFormatting.GRAY+"They let you warp around or access certain menus more easily")); +// texts[5].put(new Vector2f(0.7f, 0.71f), Utils.createList( +// EnumChatFormatting.GOLD+"Itemlist", +// EnumChatFormatting.GRAY+"Hover over an item in the list to display it's lore", +// EnumChatFormatting.GRAY+"Left clicking some items will display the recipe for that item", +// EnumChatFormatting.GRAY+"Right clicking some items will display a wiki page for that item", +// EnumChatFormatting.GRAY+"'F' will favourite an item, putting it to the top of the itemlist")); +// texts[6].put(new Vector2f(0.17f, 0.21f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"This is the collection log. It can be accessed using the /neucl command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The collection log keeps track of all items that enter your inventory while you are playing skyblock", +// EnumChatFormatting.GRAY+"If you are a completionist, this feature is for you")); +// texts[7].put(new Vector2f(0.05f, 0.13f), Utils.createList( +// EnumChatFormatting.GOLD+"Collection Log", +// EnumChatFormatting.GRAY+"Clicking on 'Filter' will change the items that", +// EnumChatFormatting.GRAY+"appear in the list")); +// texts[8].put(new Vector2f(0.35f, 0.74f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This is the NEU Auction House (NeuAH)", +// EnumChatFormatting.GRAY+"This AH can be accessed from anywhere using the /neuah command, or via the QuickCommand", +// EnumChatFormatting.GRAY+"The items here refresh automatically, so there is no need to close the GUI to see the latest auctions", +// EnumChatFormatting.GRAY+"Sometimes, you might have to wait until the list is populated with items from the API")); +// texts[9].put(new Vector2f(0.41f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"These tabs control the items that appear in NeuAH", +// EnumChatFormatting.GRAY+"You can find the main categories on the top of the GUI and subcategories appear on the side of the GUI once a main category is selected")); +// texts[10].put(new Vector2f(0.57f, 0.38f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Search for items using the search bar at the top", +// EnumChatFormatting.GRAY+"Boolean operators such as &, | or ! work here.")); +// texts[10].put(new Vector2f(0.40f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"This toolbar contains many useful features", +// EnumChatFormatting.GRAY+"which control the sorting and ordering of", +// EnumChatFormatting.GRAY+"the auction house, similar to the normal AH")); +// texts[11].put(new Vector2f(0.55f, 0.72f), Utils.createList( +// EnumChatFormatting.GOLD+"NeuAH", +// EnumChatFormatting.GRAY+"Clicking on an item will bring up the auction view", +// EnumChatFormatting.GRAY+"Here you can viewer the buyer/seller and place bids or make purchases", +// EnumChatFormatting.GRAY+"Trying to purchase an item will result in a confirmation GUI similar to the normal AH")); +// texts[12].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Access the profile viewer using /neuprofile (ign) or /pv (ign)", +// EnumChatFormatting.GRAY+"This is the main page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains basic information like stats and skill levels")); +// texts[12].put(new Vector2f(0.72f, 0.55f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"Click the button on the left to switch profiles and use the bar on the right to switch players")); +// texts[13].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the extra info page of the profile viewer", +// EnumChatFormatting.GRAY+"This page contains all the small bits of information about a player that don't fit anywhere else")); +// texts[14].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the inventories page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the inventory icons in the top-left or use your keyboard to switch the inventory type", +// EnumChatFormatting.GRAY+"The bar on the bottom-left searches the current inventory for matching items")); +// texts[15].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the collections page of the profile viewer", +// EnumChatFormatting.GRAY+"Click on the icons on the left or use the keyboard shortcut to switch collection type")); +// texts[16].put(new Vector2f(0.28f, 0.82f), Utils.createList( +// EnumChatFormatting.GOLD+"Profile Viewer", +// EnumChatFormatting.GRAY+"This is the pets page of the profile viewer", +// EnumChatFormatting.GRAY+"Click to select the pet on the left", +// EnumChatFormatting.GRAY+"The selected pet's stats will display on the right")); +// texts[17].put(new Vector2f(0.27f, 0.40f), Utils.createList( +// EnumChatFormatting.GOLD+"Overlay", +// EnumChatFormatting.GRAY+"Rearrange certain GUI elements of the main overlay using /neuoverlay", +// EnumChatFormatting.GRAY+"If you accidentally move them off screen, use the button in the top left to reset the GUI")); +// } +} -- cgit From 4f852c5b9bbbf83b55086da047d4f5fc0a5ede3f Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Fri, 27 Aug 2021 19:50:09 +0200 Subject: we be fixing --- .../notenoughupdates/NEUEventListener.java | 6 +++-- .../miscfeatures/StorageManager.java | 31 ++++++++++++---------- .../notenoughupdates/miscgui/StorageOverlay.java | 21 +++++++-------- 3 files changed, 31 insertions(+), 27 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index ea9994a7..c7e89e9b 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1399,8 +1399,10 @@ public class NEUEventListener { if(containerName.endsWith(" Profile") && eventGui.getSlotUnderMouse() != null && eventGui.getSlotUnderMouse().getSlotIndex() == 34 && Mouse.getEventButton() >= 0) { event.setCanceled(true); - Utils.playPressSound(); - NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{containerName.replaceAll("'s? Profile", "")}); + if(Mouse.getEventButtonState()) { + Utils.playPressSound(); + NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{containerName.replaceAll("'s? Profile", "")}); + } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index 03e6b98e..b85b79fe 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -166,6 +166,7 @@ public class StorageManager { public static class StorageConfig { public HashMap pages = new HashMap<>(); public final HashMap displayToStorageIdMap = new HashMap<>(); + public final HashMap displayToStorageIdMapRender = new HashMap<>(); } public StorageConfig storageConfig = new StorageConfig(); @@ -491,21 +492,22 @@ public class StorageManager { if(changed) { synchronized(storageConfig.displayToStorageIdMap) { storageConfig.displayToStorageIdMap.clear(); + storageConfig.displayToStorageIdMapRender.clear(); int displayIndex = 0; for(int i=0; i 0) { updateSearchForPage(searchStr, page); if(page.matchesSearch) { - storageConfig.displayToStorageIdMap.put(displayIndex++, i); + storageConfig.displayToStorageIdMapRender.put(displayIndex++, i); } } else { - storageConfig.displayToStorageIdMap.put(displayIndex++, i); + storageConfig.displayToStorageIdMapRender.put(displayIndex++, i); page.matchesSearch = true; page.searchedId = sid; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index 6b459ecb..78402a7f 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -125,12 +125,12 @@ public class StorageOverlay extends GuiElement { private LerpingInteger scroll = new LerpingInteger(0, 200); private int getMaximumScroll() { - synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMap) { + synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMapRender) { int maxH = 0; for(int i=0; i<3; i++) { - int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size()-1; + int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.size()-1; int coords = (int)Math.ceil(lastDisplayId/3f)*3+1+i; int h = getPageCoords(coords).y+scroll.getValue()-getStorageViewSize()-14; @@ -305,8 +305,8 @@ public class StorageOverlay extends GuiElement { int startY = getPageCoords(0).y; if(OpenGlHelper.isFramebufferEnabled()) { int h; - synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMap) { - int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMap.size()-1; + synchronized(StorageManager.getInstance().storageConfig.displayToStorageIdMapRender) { + int lastDisplayId = StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.size()-1; int coords = (int)Math.ceil(lastDisplayId/3f)*3+3; h = getPageCoords(coords).y+scroll.getValue(); @@ -363,7 +363,7 @@ public class StorageOverlay extends GuiElement { if(doItemRender) { enchantGlintRenderLocations.clear(); - for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) { + for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) { int displayId = entry.getKey(); int storageId = entry.getValue(); @@ -583,7 +583,7 @@ public class StorageOverlay extends GuiElement { } GlScissorStack.push(0, guiTop+3, width, guiTop+3+storageViewSize, scaledResolution); - for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) { + for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) { int displayId = entry.getKey(); int storageId = entry.getValue(); @@ -1427,10 +1427,10 @@ public class StorageOverlay extends GuiElement { for(int j=i; j guiTop+3 && mouseY < guiTop+storageViewSize+3) { int currentPage = StorageManager.getInstance().getCurrentPageId(); - - for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMap.entrySet()) { + for(Map.Entry entry : StorageManager.getInstance().storageConfig.displayToStorageIdMapRender.entrySet()) { IntPair pageCoords = getPageCoords(entry.getKey()); if(pageCoords.y > storageViewSize+3 || pageCoords.y+90 < 3) continue; @@ -1854,7 +1853,7 @@ public class StorageOverlay extends GuiElement { if(Keyboard.getEventKeyState()) { if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotLocking && - KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockKey)) { + KeybindHelper.isKeyPressed(NotEnoughUpdates.INSTANCE.config.slotLocking.slotLockKey) && !searchBar.getFocus()) { if(!(Minecraft.getMinecraft().currentScreen instanceof GuiContainer)) return true; GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen; -- cgit From b9525a3419d695ce8b10e8da76ba61c0c6be54e2 Mon Sep 17 00:00:00 2001 From: DoKM Date: Sat, 28 Aug 2021 19:03:35 +0200 Subject: I think this fixes a slotlocking crash --- .../io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java index 7f981092..7459c4a4 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/SlotLocking.java @@ -420,7 +420,7 @@ public class SlotLocking { return; } else if(locked.locked || (clickType == 2 && SlotLocking.getInstance().isSlotIndexLocked(clickedButton))) { consumer.accept(null); - } else if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && clickType == 1) { + } else if(NotEnoughUpdates.INSTANCE.config.slotLocking.enableSlotBinding && clickType == 1 && locked.boundTo != -1) { GuiContainer container = (GuiContainer) Minecraft.getMinecraft().currentScreen; Slot boundSlot = container.inventorySlots.getSlotFromInventory(Minecraft.getMinecraft().thePlayer.inventory, locked.boundTo); -- cgit From 5ff913b685316c23317193cfeb30ae51f1a47f1d Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 29 Aug 2021 16:13:49 +0200 Subject: Add Replace Social options chat with PV --- .../moulberry/notenoughupdates/NEUEventListener.java | 16 ++++++++++++++++ .../notenoughupdates/options/seperateSections/Misc.java | 11 +++++++++++ .../io/github/moulberry/notenoughupdates/util/Utils.java | 5 +++++ 3 files changed, 32 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index ea9994a7..84c58aeb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -776,6 +776,20 @@ public class NEUEventListener { return Utils.trimIgnoreColour(text.replaceAll(EnumChatFormatting.DARK_GREEN+"\\S+ Drill Fuel", "")); } + + private IChatComponent replaceSocialControlsWithPV(IChatComponent chatComponent){ + + if(NotEnoughUpdates.INSTANCE.config.misc.replaceSocialOptions && chatComponent.getChatStyle() != null && chatComponent.getChatStyle().getChatClickEvent() != null && chatComponent.getChatStyle().getChatClickEvent().getAction() == ClickEvent.Action.RUN_COMMAND){ + if(chatComponent.getChatStyle().getChatClickEvent().getValue().startsWith("/socialoptions")){ + String username = chatComponent.getChatStyle().getChatClickEvent().getValue().substring(15); + + chatComponent.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/pv "+username, ""+EnumChatFormatting.YELLOW+"Click to open "+EnumChatFormatting.AQUA+EnumChatFormatting.BOLD+username+EnumChatFormatting.RESET+EnumChatFormatting.YELLOW+"'s profile in "+EnumChatFormatting.DARK_PURPLE+EnumChatFormatting.BOLD+"NEU's"+EnumChatFormatting.RESET+EnumChatFormatting.YELLOW+ " profile viewer.")); + return chatComponent; + } + } + return chatComponent; + } + /** * 1) When receiving "You are playing on profile" messages, will set the current profile. * 2) When a /viewrecipe command fails (i.e. player does not have recipe unlocked, will open the custom recipe GUI) @@ -787,6 +801,8 @@ public class NEUEventListener { CrystalMetalDetectorSolver.process(e.message); e.message = processChatComponent(e.message); return; + } else if(e.type == 0){ + e.message = replaceSocialControlsWithPV(e.message); } DungeonWin.onChatMessage(e); 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 6a083cae..b38e7fd5 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 @@ -38,6 +38,17 @@ public class Misc { @ConfigEditorBoolean public boolean guiButtonClicks = true; + + @Expose + @ConfigOption( + name = "Replace Chat Social Options", + desc = "Replace Hypixel's chat social options with NEU's profile viewer." + ) + @ConfigEditorBoolean + public boolean replaceSocialOptions = true; + + + @Expose @ConfigOption( name = "Damage Indicator Style", 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 3e84261c..7f1c20d3 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java @@ -1045,6 +1045,11 @@ public class Utils { style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(EnumChatFormatting.YELLOW+value))); return style; } + public static ChatStyle createClickStyle(ClickEvent.Action action, String value, String message) { + ChatStyle style = createClickStyle(action, value); + style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new ChatComponentText(message))); + return style; + } public static void recursiveDelete(File file) { if(file.isDirectory() && !Files.isSymbolicLink(file.toPath())) { -- cgit From 90ad79d106fd36f50edaf8a2bed6c4ee0210050d Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 29 Aug 2021 17:24:00 +0200 Subject: Fix pv button showing in hypixel player menu and not showing when guest --- .../notenoughupdates/NEUEventListener.java | 38 ++++++++++++++-------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 84c58aeb..cb6a38ab 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -953,15 +953,20 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); - if(containerName.endsWith(" Profile")){ - Slot slot = new Slot(cc.getLowerChestInventory(), 34, cc.inventorySlots.get(34).xDisplayPosition, cc.inventorySlots.get(34).yDisplayPosition); - slot.putStack(Utils.createItemStack(Item.getItemFromBlock(Blocks.command_block), EnumChatFormatting.GREEN + "Profile Viewer", - EnumChatFormatting.YELLOW + "Click to open NEU profile viewer!")); - cc.inventorySlots.replaceAll(e -> { - if(e.getSlotIndex() == 34) - return slot; - return e; - }); + if(containerName.contains(" Profile") && cc.inventorySlots.size() >= 54){ + if(cc.inventorySlots.get(22).getStack() != null && cc.inventorySlots.get(22).getStack().getTagCompound() != null){ + NBTTagCompound tag = eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound(); + if(tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")){ + String tagName = tag.getCompoundTag("SkullOwner").getString("Name"); + String displayname = Utils.cleanColour(cc.inventorySlots.get(22).getStack().getDisplayName()); + if(tagName.equals(displayname.substring(displayname.length()-tagName.length()))){ + Slot slot = new Slot(cc.getLowerChestInventory(), 42, cc.inventorySlots.get(42).xDisplayPosition, cc.inventorySlots.get(42).yDisplayPosition); + slot.putStack(Utils.createItemStack(Item.getItemFromBlock(Blocks.command_block), EnumChatFormatting.GREEN + "Profile Viewer", + EnumChatFormatting.YELLOW + "Click to open NEU profile viewer!")); + cc.inventorySlots.set(42, slot); + } + } + } } } @@ -1412,11 +1417,18 @@ public class NEUEventListener { GuiChest eventGui = (GuiChest) guiScreen; ContainerChest cc = (ContainerChest) eventGui.inventorySlots; containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText(); - if(containerName.endsWith(" Profile") && eventGui.getSlotUnderMouse() != null && eventGui.getSlotUnderMouse().getSlotIndex() == 34 && - Mouse.getEventButton() >= 0) { + if(containerName.contains(" Profile") && eventGui.getSlotUnderMouse() != null && + eventGui.getSlotUnderMouse().getSlotIndex() == 42 && Mouse.getEventButton() >= 0) { event.setCanceled(true); - Utils.playPressSound(); - NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{containerName.replaceAll("'s? Profile", "")}); + if(eventGui.inventorySlots.inventorySlots.get(22).getStack() != null && eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound() != null){ + NBTTagCompound tag = eventGui.inventorySlots.inventorySlots.get(22).getStack().getTagCompound(); + if(tag.hasKey("SkullOwner") && tag.getCompoundTag("SkullOwner").hasKey("Name")){ + String username = tag.getCompoundTag("SkullOwner").getString("Name"); + Utils.playPressSound(); + NotEnoughUpdates.INSTANCE.viewProfileRunnable.processCommand(null, new String[]{username}); + } + } + } } -- cgit From 7e065b9d6b8763377a3c3fbec68145aa8cf79778 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Mon, 30 Aug 2021 10:27:25 +0200 Subject: fix da fix --- .../github/moulberry/notenoughupdates/miscfeatures/StorageManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index b85b79fe..530833f9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -380,7 +380,7 @@ public class StorageManager { public int getDisplayIdForStorageId(int storageId) { if(storageId < 0) return -1; - for(Map.Entry entry : storageConfig.displayToStorageIdMap.entrySet()) { + for(Map.Entry entry : storageConfig.displayToStorageIdMapRender.entrySet()) { if(entry.getValue() == storageId) { return entry.getKey(); } -- cgit From 8e43f9f23835e802b5caea2585db8a50a6408fbb Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Mon, 30 Aug 2021 10:53:02 +0200 Subject: fix shift click delay --- .../io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index 78402a7f..bc96b732 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -1543,6 +1543,8 @@ public class StorageOverlay extends GuiElement { if(mouseX > guiLeft+181 && mouseX < guiLeft+181+162 && mouseY > guiTop+storageViewSize+18 && mouseY < guiTop+storageViewSize+94) { + if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + dirty = true; return false; } -- cgit From b0164aa3994e4b74c6d7a15c1fe5d03f16dcba2e Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Mon, 30 Aug 2021 13:05:10 +0200 Subject: last thing --- .../notenoughupdates/miscfeatures/StorageManager.java | 10 ++++++++++ .../moulberry/notenoughupdates/miscgui/StorageOverlay.java | 6 +++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java index 530833f9..3a3aec6d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/StorageManager.java @@ -379,6 +379,16 @@ public class StorageManager { } public int getDisplayIdForStorageId(int storageId) { + if(storageId < 0) return -1; + for(Map.Entry entry : storageConfig.displayToStorageIdMap.entrySet()) { + if(entry.getValue() == storageId) { + return entry.getKey(); + } + } + return -1; + } + + public int getDisplayIdForStorageIdRender(int storageId) { if(storageId < 0) return -1; for(Map.Entry entry : storageConfig.displayToStorageIdMapRender.entrySet()) { if(entry.getValue() == storageId) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java index bc96b732..d80a5daf 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java @@ -1705,7 +1705,7 @@ public class StorageOverlay extends GuiElement { } else if(Mouse.getEventButtonState() && Mouse.getEventButton() == 0) { for(int i=0; i<9; i++) { int storageId = i; - int displayId = StorageManager.getInstance().getDisplayIdForStorageId(i); + int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(i); StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false); if(page != null) { @@ -1722,7 +1722,7 @@ public class StorageOverlay extends GuiElement { } for(int i=0; i<18; i++) { int storageId = i+StorageManager.MAX_ENDER_CHEST_PAGES; - int displayId = StorageManager.getInstance().getDisplayIdForStorageId(i); + int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(i); StorageManager.StoragePage page = StorageManager.getInstance().getPage(storageId, false); if(page != null) { @@ -1805,7 +1805,7 @@ public class StorageOverlay extends GuiElement { } } else { int currentPage = StorageManager.getInstance().getCurrentPageId(); - int displayId = StorageManager.getInstance().getDisplayIdForStorageId(currentPage); + int displayId = StorageManager.getInstance().getDisplayIdForStorageIdRender(currentPage); if(displayId >= 0) { IntPair pageCoords = getPageCoords(displayId); -- cgit From 0c6cd3695ff2b78e11fe6457a31dc8c7575330ff Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 30 Aug 2021 21:43:43 +0200 Subject: Add Support for pets with special levelling systems Like the golden Dragon pet --- Update Notes/2.0-Pre31.md | 15 +++-- .../notenoughupdates/NEUEventListener.java | 4 +- .../moulberry/notenoughupdates/NEUManager.java | 76 +++++++++++++++++++--- .../miscfeatures/PetInfoOverlay.java | 2 +- .../profileviewer/GuiProfileViewer.java | 72 ++++++++++++++++++-- .../profileviewer/PlayerStats.java | 4 +- 6 files changed, 145 insertions(+), 28 deletions(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index b1a37ccc..3745dae3 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -26,21 +26,23 @@ - Added mastermode support for /join. - Added option to only show price tooltip when holding key. - Added option to disable neu's custom skulls. (idk why you would want it but its here) -- Added explenation to search highlight feature. +- Added explanation to search highlight feature. - Added fast render warning to storage gui. - Added info about how to get neu capes to the cosmetics gui. - Added SBA chroma support to neuec. - Redid bonemerang overlay - Moveable and a bit more info. -- Added /neuhelp (neu command list with bit of explenation) +- Added /neuhelp (neu command list with bit of explanation) - Added toggle to prismapump overlay. - Added ability to toggle the pickaxe's ability cooldown showing up as the pickaxe durability. - Added alternative command for "/neusouls" "/fairysouls". - Added pet skins to /pv. (DeDiamondPro) - Added pet candy to /pv. (DeDiamondPro) +- Added a /pv button to the right click player menu (DeDiamondPro) (fixed by DoKM) +- Replaced the chat command when clicking on a player name with /pv (Toggleable) ### **Bug Fixes** -- Fishing helper not showing "!" when rod colours are disabled. +- Fishing helper not showing "!" when the rod colours are disabled. - Decimal point values not being counted in Accessory bag overlay. - /pv not having the correct max minion tier. (Ironm00n) - Other (not Transparent) storage ui themes not having edit button. (please update your textures artists) @@ -50,11 +52,11 @@ - Fixed a spelling mistake in todo timers "Godpotf". - Fixed Reforge stones with reforges that have no stats not showing the tooltip (hot stuff/heated example) (heated can now have its stats hotfix reverted @repo guys) - Fixed dungeon win overlay. -- Remove description and price tooltip from backpack/personalvault icon in /pv. +- Remove description and price tooltip from backpack/personal vault icon in /pv. - Fixed Typo in NEUButtons Dungeon preset catacombs floor 7. (jani270) - Fixed fastrender check for cosmetics gui and profile viewer. - Change skyclient shader. (nacrt) -- Added a hidden toggle to disable the negative cape (replaced with null cape (cause i thought it looked nice)) as a user was not able to play due to a graphical bug that caused their screen to turn full green. +- Added a hidden toggle to disable the negative cape (replaced with null cape (because i thought it looked nice)) as a user was not able to play due to a graphical bug that caused their screen to turn full green. - Maybe fixed neu's slotlocking in dungeons. (limited testing) - Fixed Key's being "autoclicked" when bound to a keyboard key. - Fixed being able to drop slotlocked items by quickly swapping slots and spamming/holding Q. @@ -89,6 +91,9 @@ - Changed first time message to open /neuhelp instead of tutorial. - AOTV Etherwarp fixes. (DeDiamondPro) - Disabled Builders wand, block zapper and prismapump overlays on non private islands. +- Disabled stacktrace from apisync from showing if not in dev mode. +- Redid the tutorial class to be allow for buttons. +- Removed the tutorial screenshots to lower file size as the tutorial has been disabled. ### **Notes for texturepack creators** diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index cb6a38ab..4fdddffc 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2398,9 +2398,9 @@ public class NEUEventListener { tag.getCompoundTag("ExtraAttributes").getString("petInfo"), JsonObject.class); if (petInfo.has("exp") && petInfo.get("exp").isJsonPrimitive()) { JsonPrimitive exp = petInfo.getAsJsonPrimitive("exp"); - int rarityOffset = Constants.PETS.get("pet_rarity_offset").getAsJsonObject().get( + String petName = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip))).getAsInt(); - petlevel = GuiProfileViewer.getPetLevel(Constants.PETS.get("pet_levels").getAsJsonArray(), rarityOffset, exp.getAsLong()); + petlevel = GuiProfileViewer.getPetLevel(petName, Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip)), exp.getAsLong()); } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 80fc0667..5fef4c62 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -1208,10 +1208,17 @@ public class NEUManager { HashMap replacements = new HashMap<>(); if(level < 1) { - replacements.put("LVL", "1\u27A1100"); + if (Constants.PETS.has("custom_pet_leveling") && Constants.PETS.getAsJsonObject("custom_pet_leveling").has(petname) && Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(petname).has("max_level")){ + int maxLvl = Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(petname).get("max_level").getAsInt(); + replacements.put("LVL", "1\u27A1"+maxLvl); + } else { + replacements.put("LVL", "1\u27A1100"); + } } else { replacements.put("LVL", ""+level); } + + if(petnums != null) { if(petnums.has(petname)) { JsonObject petInfo = petnums.get(petname).getAsJsonObject(); @@ -1227,8 +1234,18 @@ public class NEUManager { if(level < 1) { JsonArray otherNumsMin = min.get("otherNums").getAsJsonArray(); JsonArray otherNumsMax = max.get("otherNums").getAsJsonArray(); + boolean addZero = false; + if(petInfoTier.has("stats_levelling_curve")){ + String[] stringArray = petInfoTier.get("stats_levelling_curve").getAsString().split(":"); + if(stringArray.length == 3) { + int type = Integer.parseInt(stringArray[2]); + if(type == 1){ + addZero = true; + } + } + } for(int i=0; i0?"+":"")+statMin+"\u27A1"+statMax; + statStr = (addZero?"0\u27A1":"")+statStr; replacements.put(entry.getKey(), statStr); } } else { - float minMix = (100-level)/99f; - float maxMix = (level-1)/99f; + + int minStatsLevel = 0; + int maxStatsLevel = 100; + int statsLevelingType = -1; + + int statsLevel = level; + + + if(petInfoTier.has("stats_levelling_curve")) { + String[] stringArray = petInfoTier.get("stats_levelling_curve").getAsString().split(":"); + if (stringArray.length == 3) { + minStatsLevel = Integer.parseInt(stringArray[0]); + maxStatsLevel = Integer.parseInt(stringArray[1]); + statsLevelingType = Integer.parseInt(stringArray[2]); + switch (statsLevelingType) { + //Case for maybe a pet that might exist + case 0: + case 1: + if (level < minStatsLevel) { + statsLevel = 1; + } else if (level < maxStatsLevel) { + statsLevel = level - minStatsLevel + 1; + } else { + statsLevel = maxStatsLevel - minStatsLevel + 1; + } + break; + + } + } + } + float minMix = (maxStatsLevel-(minStatsLevel-(statsLevelingType==-1?0:1))-statsLevel)/99f; + float maxMix = (statsLevel-1)/99f; JsonArray otherNumsMin = min.get("otherNums").getAsJsonArray(); JsonArray otherNumsMax = max.get("otherNums").getAsJsonArray(); for(int i=0; i entry : max.get("statNums").getAsJsonObject().entrySet()) { - float statMax = entry.getValue().getAsFloat(); - float statMin = min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsFloat(); - float val = statMin*minMix + statMax*maxMix; - String statStr = (statMin>0?"+":"")+(int)Math.floor(val); - replacements.put(entry.getKey(), statStr); + if(statsLevelingType == 1 && level < minStatsLevel) { + replacements.put(entry.getKey(), "0"); + } else { + float statMax = entry.getValue().getAsFloat(); + float statMin = min.get("statNums").getAsJsonObject().get(entry.getKey()).getAsFloat(); + float val = statMin * minMix + statMax * maxMix; + String statStr = (statMin > 0 ? "+" : "") + (int) Math.floor(val); + replacements.put(entry.getKey(), statStr); + } } } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index 7769c274..5313afd9 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -1018,7 +1018,7 @@ public class PetInfoOverlay extends TextOverlay { JsonObject petsJson = Constants.PETS; if(currentPet != null && petsJson != null) { - currentPet.petLevel = GuiProfileViewer.getPetLevel(petsJson.get("pet_levels").getAsJsonArray(), currentPet.rarity.petOffset, currentPet.petLevel.totalXp); + currentPet.petLevel = GuiProfileViewer.getPetLevel(currentPet.petItem, currentPet.rarity.name(), currentPet.petLevel.totalXp); } } 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 3c448cda..a45524ba 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/GuiProfileViewer.java @@ -1209,7 +1209,65 @@ public class GuiProfileViewer extends GuiScreen { public float totalXp; } - public static PetLevel getPetLevel(JsonArray levels, int offset, float exp) { + private static JsonObject getPetInfo(String pet_name, String rarity){ + JsonObject petInfo = new JsonObject(); + //System.out.println(pet_name); + //System.out.println(rarity); + + if(Constants.PETS.has("custom_pet_leveling") && Constants.PETS.getAsJsonObject("custom_pet_leveling").has(pet_name)){ + JsonObject pet = Constants.PETS.getAsJsonObject("custom_pet_leveling").getAsJsonObject(pet_name); + if(pet.has("type") && pet.has("pet_levels")){ + int type = pet.get("type").getAsInt(); + switch (type) { + case 1: + JsonArray defaultLevels = Constants.PETS.getAsJsonArray("pet_levels"); + defaultLevels.addAll(pet.getAsJsonArray("pet_levels")); + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + break; + case 2: + petInfo.add("pet_levels", pet.getAsJsonArray("pet_levels")); + break; + default: + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + break; + } + } else { + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + } + if(pet.has("max_level")){ + petInfo.add("max_level", pet.get("max_level")); + } else { + petInfo.add("max_level", new JsonPrimitive(100)); + } + + if(pet.has("pet_rarity_offset")){ + petInfo.add("offset", pet.get("pet_rarity_offset")); + } else { + petInfo.add("offset", Constants.PETS.getAsJsonObject("pet_rarity_offset").get(rarity)); + } + + } else { + //System.out.println("Default Path"); + petInfo.add("offset", Constants.PETS.getAsJsonObject("pet_rarity_offset").get(rarity)); + petInfo.add("max_level", new JsonPrimitive(100)); + petInfo.add("pet_levels", Constants.PETS.getAsJsonArray("pet_levels")); + } + + + return petInfo; + + } + + public static PetLevel getPetLevel(String pet_name, String rarity, float exp) { + + JsonObject petInfo = getPetInfo(pet_name, rarity); + int offset = petInfo.get("offset").getAsInt(); + int maxPetLevel = petInfo.get("max_level").getAsInt(); + JsonArray levels = petInfo.getAsJsonArray("pet_levels"); + System.out.println("Offset: "+offset); + System.out.println("MaxPetLevel: "+maxPetLevel); + + float xpTotal = 0; float level = 1; float currentLevelRequirement = 0; @@ -1217,7 +1275,7 @@ public class GuiProfileViewer extends GuiScreen { boolean addLevel = true; - for(int i=offset; i 100) { - level = 100; + } else if(level > maxPetLevel) { + level = maxPetLevel; } PetLevel levelObj = new PetLevel(); levelObj.level = level; @@ -1355,10 +1415,8 @@ public class GuiProfileViewer extends GuiScreen { tierNum = ""+(Integer.parseInt(tierNum)+1); } - int petRarityOffset = petsJson.get("pet_rarity_offset").getAsJsonObject().get(tier).getAsInt(); - JsonArray levelsArr = petsJson.get("pet_levels").getAsJsonArray(); + PetLevel levelObj = GuiProfileViewer.getPetLevel(petname, tier, exp); - PetLevel levelObj = getPetLevel(levelsArr, petRarityOffset, exp); float level = levelObj.level; float currentLevelRequirement = levelObj.currentLevelRequirement; float maxXP = levelObj.maxXP; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java index c95fadf0..76427cc8 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/PlayerStats.java @@ -471,10 +471,8 @@ public class PlayerStats { tierNum = ""+(Integer.parseInt(tierNum)+1); } - int petRarityOffset = petsJson.get("pet_rarity_offset").getAsJsonObject().get(tier).getAsInt(); - JsonArray levelsArr = petsJson.get("pet_levels").getAsJsonArray(); + GuiProfileViewer.PetLevel levelObj = GuiProfileViewer.getPetLevel(petname, tier, exp); - GuiProfileViewer.PetLevel levelObj = GuiProfileViewer.getPetLevel(levelsArr, petRarityOffset, exp); float level = levelObj.level; float currentLevelRequirement = levelObj.currentLevelRequirement; float maxXP = levelObj.maxXP; -- cgit From d7f9b39792d17d8ee204a46b5ff8be3c217ea2a1 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 30 Aug 2021 21:51:35 +0200 Subject: Quick fix --- .../java/io/github/moulberry/notenoughupdates/NEUEventListener.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 4fdddffc..97c31a58 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -2399,7 +2399,7 @@ public class NEUEventListener { if (petInfo.has("exp") && petInfo.get("exp").isJsonPrimitive()) { JsonPrimitive exp = petInfo.getAsJsonPrimitive("exp"); String petName = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); - Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip))).getAsInt(); + //Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip))).getAsInt(); petlevel = GuiProfileViewer.getPetLevel(petName, Utils.getRarityFromInt(Utils.checkItemTypePet(event.toolTip)), exp.getAsLong()); } } -- cgit From ba051e5f37222737e6655e25ce7ea339fe6bc834 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 31 Aug 2021 15:45:34 +0200 Subject: Add Ability for third party mods to disable Inventory Buttons Per request --- .../github/moulberry/notenoughupdates/NEUApi.java | 10 ++ .../notenoughupdates/NEUEventListener.java | 192 +++++++++++---------- 2 files changed, 109 insertions(+), 93 deletions(-) create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java new file mode 100644 index 00000000..56a196b4 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUApi.java @@ -0,0 +1,10 @@ +package io.github.moulberry.notenoughupdates; + +import net.minecraftforge.fml.relauncher.ReflectionHelper; + +public class NEUApi { + static boolean disableInventoryButtons = false; + public static void setInventoryButtonsToDisabled(){ + disableInventoryButtons = true; + } +} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 97c31a58..9f55e89e 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -567,6 +567,7 @@ public class NEUEventListener { @SubscribeEvent public void onGuiOpen(GuiOpenEvent event) { CraftingOverlay.shouldRender = false; + NEUApi.disableInventoryButtons = false; if((Minecraft.getMinecraft().currentScreen instanceof GuiScreenElementWrapper || Minecraft.getMinecraft().currentScreen instanceof GuiItemRecipe) && @@ -1022,40 +1023,42 @@ public class NEUEventListener { GlStateManager.translate(0, 0, zOffset); - int xSize = ((GuiContainer)event.gui).xSize; - int ySize = ((GuiContainer)event.gui).ySize; - int guiLeft = ((GuiContainer)event.gui).guiLeft; - int guiTop = ((GuiContainer)event.gui).guiTop; + int xSize = ((GuiContainer) event.gui).xSize; + int ySize = ((GuiContainer) event.gui).ySize; + int guiLeft = ((GuiContainer) event.gui).guiLeft; + int guiTop = ((GuiContainer) event.gui).guiTop; - for(NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { - if(!button.isActive()) continue; - if(button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; + if (!NEUApi.disableInventoryButtons) { + for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { + if (!button.isActive()) continue; + if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; - int x = guiLeft+button.x; - int y = guiTop+button.y; - if(button.anchorRight) { - x += xSize; - } - if(button.anchorBottom) { - y += ySize; - } - if(AccessoryBagOverlay.isInAccessoryBag()){ - if(x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28+ 5 && y > guiTop-18 && y < guiTop + 150){ - x += 80+28; + int x = guiLeft + button.x; + int y = guiTop + button.y; + if (button.anchorRight) { + x += xSize; + } + if (button.anchorBottom) { + y += ySize; + } + if (AccessoryBagOverlay.isInAccessoryBag()) { + if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) { + x += 80 + 28; + } } - } GlStateManager.color(1, 1, 1, 1f); GlStateManager.enableDepth(); - GlStateManager.enableAlpha(); - Minecraft.getMinecraft().getTextureManager().bindTexture(EDITOR); - Utils.drawTexturedRect(x, y, 18, 18, - button.backgroundIndex*18/256f, (button.backgroundIndex*18+18)/256f, - 18/256f, 36/256f, GL11.GL_NEAREST); - - if(button.icon != null && !button.icon.trim().isEmpty()) { - GuiInvButtonEditor.renderIcon(button.icon, x+1, y+1); + GlStateManager.enableAlpha(); + Minecraft.getMinecraft().getTextureManager().bindTexture(EDITOR); + Utils.drawTexturedRect(x, y, 18, 18, + button.backgroundIndex * 18 / 256f, (button.backgroundIndex * 18 + 18) / 256f, + 18 / 256f, 36 / 256f, GL11.GL_NEAREST); + + if (button.icon != null && !button.icon.trim().isEmpty()) { + GuiInvButtonEditor.renderIcon(button.icon, x + 1, y + 1); + } } } GlStateManager.translate(0, 0, -zOffset); @@ -1132,51 +1135,53 @@ public class NEUEventListener { if(!doInventoryButtons) return; if(NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() && shouldRenderOverlay(event.gui) && event.gui instanceof GuiContainer) { - int xSize = ((GuiContainer)event.gui).xSize; - int ySize = ((GuiContainer)event.gui).ySize; - int guiLeft = ((GuiContainer)event.gui).guiLeft; - int guiTop = ((GuiContainer)event.gui).guiTop; - - for(NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { - if(!button.isActive()) continue; - if(button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; + int xSize = ((GuiContainer) event.gui).xSize; + int ySize = ((GuiContainer) event.gui).ySize; + int guiLeft = ((GuiContainer) event.gui).guiLeft; + int guiTop = ((GuiContainer) event.gui).guiTop; + + if (!NEUApi.disableInventoryButtons) { + for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { + if (!button.isActive()) continue; + if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; + + int x = guiLeft + button.x; + int y = guiTop + button.y; + if (button.anchorRight) { + x += xSize; + } + if (button.anchorBottom) { + y += ySize; + } + if (AccessoryBagOverlay.isInAccessoryBag()) { + if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) { + x += 80 + 28; + } + } - int x = guiLeft+button.x; - int y = guiTop+button.y; - if(button.anchorRight) { - x += xSize; - } - if(button.anchorBottom) { - y += ySize; - } - if(AccessoryBagOverlay.isInAccessoryBag()){ - if(x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28+ 5 && y > guiTop-18 && y < guiTop + 150){ - x += 80+28; + if (x - guiLeft >= 85 && x - guiLeft <= 115 && y - guiTop >= 4 && y - guiTop <= 25) { + disableCraftingText = true; } - } - if(x-guiLeft >= 85 && x-guiLeft <= 115 && y-guiTop >= 4 && y-guiTop <= 25) { - disableCraftingText = true; - } + if (event.mouseX >= x && event.mouseX <= x + 18 && + event.mouseY >= y && event.mouseY <= y + 18) { + hoveringButton = true; + long currentTime = System.currentTimeMillis(); - if(event.mouseX >= x && event.mouseX <= x+18 && - event.mouseY >= y && event.mouseY <= y+18) { - hoveringButton = true; - long currentTime = System.currentTimeMillis(); + if (buttonHovered != button) { + buttonHoveredMillis = currentTime; + buttonHovered = button; + } - if(buttonHovered != button) { - buttonHoveredMillis = currentTime; - buttonHovered = button; - } + if (currentTime - buttonHoveredMillis > 600) { + String command = button.command.trim(); + if (!command.startsWith("/")) { + command = "/" + command; + } - if(currentTime - buttonHoveredMillis > 600) { - String command = button.command.trim(); - if(!command.startsWith("/")) { - command = "/" + command; + Utils.drawHoveringText(Lists.newArrayList("\u00a77" + command), event.mouseX, event.mouseY, + event.gui.width, event.gui.height, -1, Minecraft.getMinecraft().fontRendererObj); } - - Utils.drawHoveringText(Lists.newArrayList("\u00a77"+command), event.mouseX, event.mouseY, - event.gui.width, event.gui.height, -1, Minecraft.getMinecraft().fontRendererObj); } } } @@ -1479,42 +1484,43 @@ public class NEUEventListener { int ySize = ((GuiContainer)event.gui).ySize; int guiLeft = ((GuiContainer)event.gui).guiLeft; int guiTop = ((GuiContainer)event.gui).guiTop; - - for(NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { - if(!button.isActive()) continue; - if(button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; - - int x = guiLeft+button.x; - int y = guiTop+button.y; - if(button.anchorRight) { - x += xSize; - } - if(button.anchorBottom) { - y += ySize; - } - if(AccessoryBagOverlay.isInAccessoryBag()){ - if(x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28+ 5 && y > guiTop-18 && y < guiTop + 150){ - x += 80+28; + if(!NEUApi.disableInventoryButtons) { + for (NEUConfig.InventoryButton button : NotEnoughUpdates.INSTANCE.config.hidden.inventoryButtons) { + if (!button.isActive()) continue; + if (button.playerInvOnly && !(event.gui instanceof GuiInventory)) continue; + + int x = guiLeft + button.x; + int y = guiTop + button.y; + if (button.anchorRight) { + x += xSize; + } + if (button.anchorBottom) { + y += ySize; + } + if (AccessoryBagOverlay.isInAccessoryBag()) { + if (x > guiLeft + xSize && x < guiLeft + xSize + 80 + 28 + 5 && y > guiTop - 18 && y < guiTop + 150) { + x += 80 + 28; + } } - } - if(mouseX >= x && mouseX <= x+18 && mouseY >= y && mouseY <= y+18) { - if(Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) { - int clickType = NotEnoughUpdates.INSTANCE.config.inventoryButtons.clickType; - if((clickType == 0 && Mouse.getEventButtonState()) || (clickType == 1 && !Mouse.getEventButtonState())) { - String command = button.command.trim(); - if(!command.startsWith("/")) { - command = "/" + command; - } - if(ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, command) == 0) { - NotEnoughUpdates.INSTANCE.sendChatMessage(command); + if (mouseX >= x && mouseX <= x + 18 && mouseY >= y && mouseY <= y + 18) { + if (Minecraft.getMinecraft().thePlayer.inventory.getItemStack() == null) { + int clickType = NotEnoughUpdates.INSTANCE.config.inventoryButtons.clickType; + if ((clickType == 0 && Mouse.getEventButtonState()) || (clickType == 1 && !Mouse.getEventButtonState())) { + String command = button.command.trim(); + if (!command.startsWith("/")) { + command = "/" + command; + } + if (ClientCommandHandler.instance.executeCommand(Minecraft.getMinecraft().thePlayer, command) == 0) { + NotEnoughUpdates.INSTANCE.sendChatMessage(command); + } } - } } else { event.setCanceled(true); } return; } + } } } } -- cgit From 7dfb4153a98f903c5779f56df0c00774cf1dccd6 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 31 Aug 2021 15:47:31 +0200 Subject: Clean up some duplicate values etc. --- .../moulberry/notenoughupdates/NEUEventListener.java | 16 ++++++++++------ .../moulberry/notenoughupdates/auction/APIManager.java | 8 ++++---- .../moulberry/notenoughupdates/auction/CustomAH.java | 16 ++++++++-------- .../notenoughupdates/miscgui/AccessoryBagOverlay.java | 10 +++++----- .../notenoughupdates/profileviewer/GuiProfileViewer.java | 3 +++ .../io/github/moulberry/notenoughupdates/util/Utils.java | 2 +- 6 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index 21ec5773..e731e47a 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -1047,9 +1047,9 @@ public class NEUEventListener { } } - GlStateManager.color(1, 1, 1, 1f); + GlStateManager.color(1, 1, 1, 1f); - GlStateManager.enableDepth(); + GlStateManager.enableDepth(); GlStateManager.enableAlpha(); Minecraft.getMinecraft().getTextureManager().bindTexture(EDITOR); Utils.drawTexturedRect(x, y, 18, 18, @@ -1515,11 +1515,11 @@ public class NEUEventListener { NotEnoughUpdates.INSTANCE.sendChatMessage(command); } } - } else { - event.setCanceled(true); + } else { + event.setCanceled(true); + } + return; } - return; - } } } } @@ -1734,6 +1734,10 @@ public class NEUEventListener { rarityArrMap.put("EPIC", rarityArrC[3]); rarityArrMap.put("LEGENDARY", rarityArrC[4]); rarityArrMap.put("MYTHIC", rarityArrC[5]); + rarityArrMap.put("SPECIAL", rarityArrC[6]); + rarityArrMap.put("VERY SPECIAL", rarityArrC[7]); + rarityArrMap.put("SUPREME", rarityArrC[8]); + } private HashSet percentStats = new HashSet<>(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java index f896f1c2..9351b208 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/auction/APIManager.java @@ -429,15 +429,15 @@ public class APIManager { } catch(Exception e) {} } - String[] rarityArr = new String[] { - "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", - }; +// String[] rarityArr = new String[] { +// "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME", +// }; public int checkItemType(String lore, boolean contains, String... typeMatches) { String[] split = lore.split("\n"); for(int i=split.length-1; i>=0; i--) { String line = split[i]; - for(String rarity : rarityArr) { + for(String rarity : Utils.rarityArr) { for(int j=0; j= 0 && rarityFilter < rarities.length) { - match &= rarities[rarityFilter].equals(auc.rarity); + if (rarityFilter >= 0 && rarityFilter < Utils.rarityArr.length) { + match &= Utils.rarityArr[rarityFilter].equals(auc.rarity); } if (binFilter == BIN_FILTER_BIN) { @@ -1674,10 +1674,10 @@ public class CustomAH extends Gui { case 2: if (rightClicked) { rarityFilter--; - if (rarityFilter < -1) rarityFilter = rarities.length - 1; + if (rarityFilter < -1) rarityFilter = Utils.rarityArr.length - 1; } else { rarityFilter++; - if (rarityFilter >= rarities.length) rarityFilter = -1; + if (rarityFilter >= Utils.rarityArr.length) rarityFilter = -1; } break; case 3: diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java index 728d4478..1b04ca88 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/AccessoryBagOverlay.java @@ -879,9 +879,9 @@ public class AccessoryBagOverlay { return stats; } - private static String[] rarityArr = new String[] { - "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", - }; +// private static String[] rarityArr = new String[] { +// "COMMON", "UNCOMMON", "RARE", "EPIC", "LEGENDARY", "MYTHIC", "SPECIAL", "VERY SPECIAL", "SUPREME" +// }; private static String[] rarityArrC = new String[] { EnumChatFormatting.WHITE+EnumChatFormatting.BOLD.toString()+"COMMON", EnumChatFormatting.GREEN+EnumChatFormatting.BOLD.toString()+"UNCOMMON", @@ -901,7 +901,7 @@ public class AccessoryBagOverlay { NBTTagList list = display.getTagList("Lore", 8); for (int i = list.tagCount()-1; i >= 0; i--) { String line = list.getStringTagAt(i); - for(String rarity : rarityArr) { + for(String rarity : Utils.rarityArr) { for(int j=0; j=0; i--) { String line = lore.get(i).getAsString(); - for(String rarity : rarityArr) { + for(String rarity : Utils.rarityArr) { for(int j=0; j Date: Tue, 31 Aug 2021 16:13:42 +0200 Subject: Update patch notes --- Update Notes/2.0-Pre31.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index 3745dae3..b08e6d8b 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -11,6 +11,7 @@ - Added load from/copy to clipboard to neu inventory buttons gui. - Added a crafting recipe overlay when looking up a recipe while in the crafting menu (to more easily craft items like the Soul Esoward recipe) (DeDiamondPro) - Added mastermode support to /pv (basically done, just needs mastermode xp) +- Added support for the Golden Dragon Pet and added support for other weird pets that might get added. ### **New Features:** @@ -70,6 +71,7 @@ - Fix being able to hotkey slotlocked items in a chest gui. - (Hopefully) Fix storage overlay nullpointer crash. - Fix not being able to dye undyed leather armour. +- Some Storage Overlay fixes (DeDiamondPro) ### **Other** @@ -94,7 +96,7 @@ - Disabled stacktrace from apisync from showing if not in dev mode. - Redid the tutorial class to be allow for buttons. - Removed the tutorial screenshots to lower file size as the tutorial has been disabled. - +- Added a way to disable inventory buttons for other mods - NEUApi ### **Notes for texturepack creators** -- cgit From e5b0cb390497e0462b9cdc824bd968d08315d942 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 31 Aug 2021 17:14:17 +0200 Subject: Neu Features link/ updating some strings --- README.md | 2 +- .../notenoughupdates/NEUEventListener.java | 24 +++++++++--- .../notenoughupdates/NotEnoughUpdates.java | 45 ++++++++++++++++------ .../miscfeatures/PetInfoOverlay.java | 2 +- 4 files changed, 54 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 3f699fb9..0b6648c4 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ NotEnoughUpdates (NEU) is a feature rich 1.8.9 Minecraft forge mod for Hypixel S 4. Then, hop onto Skyblock and run the command `/api new`. Your api key is automatically filled out and all features should work. 5. Type `/neu`. If you see the NotEnoughUpdates menu, you have done this correctly! -*If you need further assistance feel free to join the [discord](https://discord.gg/moulberry) and ask for help in [#neu-support-1](discord://discord.com/channels/516977525906341928/714332750156660756)* +*If you need further assistance feel free to join the [discord](https://discord.gg/moulberry) and ask for help in [#neu-support](discord://discord.com/channels/516977525906341928/714332750156660756)* ## Features diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java index e731e47a..48cd0e57 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java @@ -366,14 +366,26 @@ public class NEUEventListener { if(!NotEnoughUpdates.INSTANCE.config.hidden.loadedModBefore) { NotEnoughUpdates.INSTANCE.config.hidden.loadedModBefore = true; - + if(Constants.MISC == null || !Constants.MISC.has("featureslist")){ + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"WARNING: "+EnumChatFormatting.RESET+EnumChatFormatting.RED+"Could not load Feature List URL from repo.")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.RED+ "Please run "+EnumChatFormatting.BOLD+"/neuresetrepo"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" and "+EnumChatFormatting.BOLD+"restart your game"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" in order to fix. "+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"If that doesn't fix it"+EnumChatFormatting.RESET+EnumChatFormatting.RED+", please join discord.gg/moulberry and post in #neu-support")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.GOLD+"To view the feature list after restarting type /neufeatures")); + } else { + String url = Constants.MISC.get("featureslist").getAsString(); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( + EnumChatFormatting.BLUE + "It seems this is your first time using NotEnoughUpdates.")); + ChatComponentText clickTextFeatures = new ChatComponentText( + EnumChatFormatting.YELLOW + "Click this message if you would like to view a list of NotEnoughUpdate's Features."); + clickTextFeatures.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, url)); + Minecraft.getMinecraft().thePlayer.addChatMessage(clickTextFeatures); + } Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText( - EnumChatFormatting.BLUE+"It seems this is your first time using NotEnoughUpdates.")); - ChatComponentText clickText = new ChatComponentText( + ChatComponentText clickTextHelp = new ChatComponentText( EnumChatFormatting.YELLOW+"Click this message if you would like to view a list of NotEnoughUpdate's commands."); - clickText.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/neuhelp")); - Minecraft.getMinecraft().thePlayer.addChatMessage(clickText); + clickTextHelp.setChatStyle(Utils.createClickStyle(ClickEvent.Action.RUN_COMMAND, "/neuhelp")); + Minecraft.getMinecraft().thePlayer.addChatMessage(clickTextHelp); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); } } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java index 142cb149..38c46415 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java @@ -6,11 +6,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.mojang.authlib.Agent; -import com.mojang.authlib.minecraft.MinecraftSessionService; -import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; -import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService; -import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; import io.github.moulberry.notenoughupdates.auction.CustomAHGui; import io.github.moulberry.notenoughupdates.collectionlog.GuiCollectionLog; import io.github.moulberry.notenoughupdates.commands.SimpleCommand; @@ -24,7 +19,6 @@ import io.github.moulberry.notenoughupdates.dungeons.DungeonMap; import io.github.moulberry.notenoughupdates.dungeons.DungeonWin; import io.github.moulberry.notenoughupdates.dungeons.GuiDungeonMapEditor; import io.github.moulberry.notenoughupdates.gamemodes.GuiGamemodes; -import io.github.moulberry.notenoughupdates.gamemodes.SBGamemodes; import io.github.moulberry.notenoughupdates.miscfeatures.*; import io.github.moulberry.notenoughupdates.miscgui.*; import io.github.moulberry.notenoughupdates.miscgui.tutorials.NeuTutorial; @@ -69,8 +63,6 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.text.WordUtils; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.impl.client.HttpClients; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.GL11; @@ -78,7 +70,8 @@ import java.awt.*; import java.awt.datatransfer.StringSelection; import java.io.*; import java.lang.management.ManagementFactory; -import java.net.Proxy; +import java.net.URI; +import java.net.URISyntaxException; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.List; @@ -234,7 +227,7 @@ public class NotEnoughUpdates { } });*/ - SimpleCommand neuhelp = new SimpleCommand("neuhelp", new SimpleCommand.ProcessCommandRunnable() { + SimpleCommand neuHelp = new SimpleCommand("neuhelp", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { ArrayList neuHelpMessages = Lists.newArrayList( "\u00a75\u00a7lNotEnoughUpdates commands", @@ -291,6 +284,35 @@ public class NotEnoughUpdates { } }); + SimpleCommand neuFeatures = new SimpleCommand("neufeatures", new SimpleCommand.ProcessCommandRunnable() { + public void processCommand(ICommandSender sender, String[] args) { + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + if(Constants.MISC == null || !Constants.MISC.has("featureslist")){ + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"WARNING: "+EnumChatFormatting.RESET+EnumChatFormatting.RED+"Could not load URL from repo.")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(""+EnumChatFormatting.RED+ "Please run "+EnumChatFormatting.BOLD+"/neuresetrepo"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" and "+EnumChatFormatting.BOLD+"restart your game"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" in order to fix. "+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"If that doesn't fix it"+EnumChatFormatting.RESET+EnumChatFormatting.RED+", please join discord.gg/moulberry and post in #neu-support")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + return; + } + String url = Constants.MISC.get("featureslist").getAsString(); + + Desktop desk = Desktop.getDesktop(); + try { + desk.browse(new URI(url)); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText(EnumChatFormatting.DARK_PURPLE+""+EnumChatFormatting.BOLD+"NEU"+EnumChatFormatting.RESET+EnumChatFormatting.GOLD+"> Opening Feature List in browser.")); + } catch (URISyntaxException | IOException ignored){ + + ChatComponentText clickTextFeatures = new ChatComponentText( + EnumChatFormatting.DARK_PURPLE+""+EnumChatFormatting.BOLD+"NEU"+EnumChatFormatting.RESET+EnumChatFormatting.GOLD+"> Click here to open the Feature List in your browser."); + clickTextFeatures.setChatStyle(Utils.createClickStyle(ClickEvent.Action.OPEN_URL, url)); + Minecraft.getMinecraft().thePlayer.addChatMessage(clickTextFeatures); + + } + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("")); + + } + }); + + SimpleCommand stWhyCommand = new SimpleCommand("neustwhy", new SimpleCommand.ProcessCommandRunnable() { public void processCommand(ICommandSender sender, String[] args) { NEUEventListener.displayNotification(Lists.newArrayList( @@ -1271,7 +1293,8 @@ public class NotEnoughUpdates { ClientCommandHandler.instance.registerCommand(calendarCommand); ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommand()); ClientCommandHandler.instance.registerCommand(new FairySouls.FairySoulsCommandAlt()); - ClientCommandHandler.instance.registerCommand(neuhelp); + ClientCommandHandler.instance.registerCommand(neuHelp); + ClientCommandHandler.instance.registerCommand(neuFeatures); BackgroundBlur.registerListener(); diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java index 5313afd9..29926628 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/PetInfoOverlay.java @@ -554,7 +554,7 @@ public class PetInfoOverlay extends TextOverlay { public static Pet getPetFromStack(String name, String[] lore) { if(Constants.PETS == null || Constants.PETS.get("pet_levels") == null || Constants.PETS.get("pet_levels") instanceof JsonNull) { - Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a7cInvalid PET constants. Please run /neuresetrepo and restart game in order to fix. If that doesn't fix it, please join discord.gg/moulberry and post in #neu-support-1")); + Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("\u00a7cInvalid PET constants. Please run "+EnumChatFormatting.BOLD+"/neuresetrepo"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" and "+EnumChatFormatting.BOLD+"restart your game"+EnumChatFormatting.RESET+EnumChatFormatting.RED+" in order to fix. "+EnumChatFormatting.DARK_RED+EnumChatFormatting.BOLD+"If that doesn't fix it"+EnumChatFormatting.RESET+EnumChatFormatting.RED+", please join discord.gg/moulberry and post in #neu-support")); return null; } -- cgit From 01974f71ba11cb496e15b99440418fe5ab15bab1 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 31 Aug 2021 20:59:42 +0200 Subject: Remove the Screenshots for the disabled help gui If we ever want to redo the help gui we should make it download the files from somewhere to decrease neu's overall file size --- .../assets/notenoughupdates/ss_small/ss1-0.jpg | Bin 148110 -> 0 bytes .../assets/notenoughupdates/ss_small/ss10-0.jpg | Bin 57284 -> 0 bytes .../assets/notenoughupdates/ss_small/ss11-0.jpg | Bin 56257 -> 0 bytes .../assets/notenoughupdates/ss_small/ss12-0.jpg | Bin 57416 -> 0 bytes .../assets/notenoughupdates/ss_small/ss13-0.jpg | Bin 83136 -> 0 bytes .../assets/notenoughupdates/ss_small/ss14-0.jpg | Bin 74904 -> 0 bytes .../assets/notenoughupdates/ss_small/ss15-0.jpg | Bin 66785 -> 0 bytes .../assets/notenoughupdates/ss_small/ss16-0.jpg | Bin 72065 -> 0 bytes .../assets/notenoughupdates/ss_small/ss17-0.jpg | Bin 62715 -> 0 bytes .../assets/notenoughupdates/ss_small/ss18-0.jpg | Bin 30420 -> 0 bytes .../assets/notenoughupdates/ss_small/ss2-0.jpg | Bin 94161 -> 0 bytes .../assets/notenoughupdates/ss_small/ss3-0.jpg | Bin 96250 -> 0 bytes .../assets/notenoughupdates/ss_small/ss4-0.jpg | Bin 93772 -> 0 bytes .../assets/notenoughupdates/ss_small/ss5-0.jpg | Bin 95859 -> 0 bytes .../assets/notenoughupdates/ss_small/ss6-0.jpg | Bin 106602 -> 0 bytes .../assets/notenoughupdates/ss_small/ss7-0.jpg | Bin 127654 -> 0 bytes .../assets/notenoughupdates/ss_small/ss8-0.jpg | Bin 86011 -> 0 bytes .../assets/notenoughupdates/ss_small/ss9-0.jpg | Bin 69263 -> 0 bytes 18 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss1-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss10-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss11-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss12-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss13-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss14-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss15-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss16-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss17-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss18-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss2-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss3-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss4-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss5-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss6-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss7-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss8-0.jpg delete mode 100644 src/main/resources/assets/notenoughupdates/ss_small/ss9-0.jpg diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss1-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss1-0.jpg deleted file mode 100644 index d05faab2..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss1-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss10-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss10-0.jpg deleted file mode 100644 index a3bbae70..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss10-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss11-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss11-0.jpg deleted file mode 100644 index 071a5df1..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss11-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss12-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss12-0.jpg deleted file mode 100644 index 447459cc..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss12-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss13-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss13-0.jpg deleted file mode 100644 index 88a89ae2..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss13-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss14-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss14-0.jpg deleted file mode 100644 index a83e64fa..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss14-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss15-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss15-0.jpg deleted file mode 100644 index 3d34bc43..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss15-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss16-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss16-0.jpg deleted file mode 100644 index 9827eec2..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss16-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss17-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss17-0.jpg deleted file mode 100644 index 560b1d9a..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss17-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss18-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss18-0.jpg deleted file mode 100644 index 6322f89d..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss18-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss2-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss2-0.jpg deleted file mode 100644 index ba71a84e..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss2-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss3-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss3-0.jpg deleted file mode 100644 index 7b179fcc..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss3-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss4-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss4-0.jpg deleted file mode 100644 index c8ee048c..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss4-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss5-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss5-0.jpg deleted file mode 100644 index 4435fd97..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss5-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss6-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss6-0.jpg deleted file mode 100644 index c027edbc..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss6-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss7-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss7-0.jpg deleted file mode 100644 index 47dffef2..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss7-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss8-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss8-0.jpg deleted file mode 100644 index fe4ae1bb..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss8-0.jpg and /dev/null differ diff --git a/src/main/resources/assets/notenoughupdates/ss_small/ss9-0.jpg b/src/main/resources/assets/notenoughupdates/ss_small/ss9-0.jpg deleted file mode 100644 index d06c092a..00000000 Binary files a/src/main/resources/assets/notenoughupdates/ss_small/ss9-0.jpg and /dev/null differ -- cgit From 2035b02a56231efb820490a6b888396dcd3f3dc8 Mon Sep 17 00:00:00 2001 From: DoKM Date: Tue, 31 Aug 2021 21:17:42 +0200 Subject: Latest changelog update for pre31 --- Update Notes/2.0-Pre31.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Update Notes/2.0-Pre31.md b/Update Notes/2.0-Pre31.md index b08e6d8b..802ad7c4 100644 --- a/Update Notes/2.0-Pre31.md +++ b/Update Notes/2.0-Pre31.md @@ -40,6 +40,7 @@ - Added pet candy to /pv. (DeDiamondPro) - Added a /pv button to the right click player menu (DeDiamondPro) (fixed by DoKM) - Replaced the chat command when clicking on a player name with /pv (Toggleable) +- Added a link to a webpage containing neu's feature /neufeatures and it shows on the first time launch. ### **Bug Fixes** -- cgit From 05d6207281e18980b8a28046621c741fa81c1606 Mon Sep 17 00:00:00 2001 From: DoKM Date: Wed, 1 Sep 2021 10:12:20 +0200 Subject: Change the fetchur prediction's offset again its now +1 instead of +3 --- .../io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 5c0c5ddd..8c5c119d 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java @@ -134,7 +134,7 @@ public class TimersOverlay extends TextOverlay { ZonedDateTime currentTimeEST = ZonedDateTime.now(ZoneId.of("America/Atikokan")); - long fetchurIndex = ((currentTimeEST.getDayOfMonth()+3) % 13)-1; + long fetchurIndex = ((currentTimeEST.getDayOfMonth()+1) % 13)-1; //Added because disabled fetchur and enabled it again but it was showing the wrong item //Lets see if this stays correct -- cgit