aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2021-08-24 15:24:41 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2021-08-24 15:24:41 +0200
commit457d4cd1d409141ae991998238afa797eb1760e1 (patch)
tree824979f39ef8d7fcd784561678b966e1c181e6dd /src/main/java
parent10d64cd33c0c86be95952f94783950bfedd912ba (diff)
parenta48012a509a3733d908fc0a23ce07335ccb4493e (diff)
downloadNotEnoughUpdates-457d4cd1d409141ae991998238afa797eb1760e1.tar.gz
NotEnoughUpdates-457d4cd1d409141ae991998238afa797eb1760e1.tar.bz2
NotEnoughUpdates-457d4cd1d409141ae991998238afa797eb1760e1.zip
Merge remote-tracking branch 'dokm/master'
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java128
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java8
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiItemCustomize.java2
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/StorageOverlay.java4
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Mining.java51
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java10
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java246
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/overlays/TimersOverlay.java22
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/util/Utils.java88
10 files changed, 509 insertions, 51 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 62a94ab8..4f3b6187 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<String> 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: ") ||
@@ -2283,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);
@@ -2302,8 +2318,112 @@ public class NEUEventListener {
if(NotEnoughUpdates.INSTANCE.config.tooltipTweaks.showPriceInfoInvItem) {
ItemPriceInformation.addToTooltip(event.toolTip, internalname, event.itemStack);
}
+
+
+
+
+
+ }
+
+ private Pattern xpLevelPattern = Pattern.compile("(.*) (\\xA7e(.*)\\xA76/\\xA7e(.*))");
+
+ private void onItemToolTipInternalNameNull(ItemTooltipEvent event){
+ petToolTipXPExtendPetMenu(event);
+
+ }
+
+ private List<String> petToolTipXPExtend(ItemTooltipEvent event) {
+ List<String> 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) {
+
+ if (Utils.cleanColour(event.toolTip.get(1)).matches("((Farming)|(Combat)|(Fishing)|(Mining)|(Foraging)|(Enchanting)|(Alchemy)) ((Mount)|(Pet)).*")) {
+
+ GuiProfileViewer.PetLevel petlevel = null;
+
+ //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) {
+ 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");
+ }
+ }
+ }
+ }
+ }
+ 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;
+
+ 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")) {
+ 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");
+
+ }
+ }
+ }
}
+ 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..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<String> text = stack.getTooltip(Minecraft.getMinecraft().thePlayer, false);
String internalname = json.get("internalname").getAsString();
@@ -2008,6 +2015,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/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) -> {
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);
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 c838c314..324f6744 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java
@@ -333,6 +333,7 @@ public class NEUConfig extends Config {
@Expose public long commissionsCompleted = 0L;
@Expose public long experimentsCompleted = 0L;
@Expose public long cookieBuffRemaining = 0L;
+ @Expose public List<MiningOverlay.ForgeItem> forgeItems = new ArrayList<MiningOverlay.ForgeItem>();
@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 0a680b0c..0599963b 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"}
@@ -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 = ""
@@ -148,7 +172,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,7 +198,7 @@ public class Mining {
@Expose
@ConfigOption(
- name = "Enabled",
+ name = "Enable Overlay",
desc = "Enables the Crystal Hollows Overlay."
)
@ConfigEditorBoolean
@@ -183,7 +207,7 @@ public class Mining {
@Expose
@ConfigOption(
- name = "Position",
+ name = "Overlay Position",
desc = "Change the position of the Crystal Hollows Overlay."
)
@ConfigEditorButton(
@@ -252,7 +276,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)
@@ -338,6 +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 = 6)
public int crystalHollowDoneColor = 10;
@@ -345,7 +370,6 @@ public class Mining {
@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"}
@@ -357,7 +381,6 @@ public class Mining {
@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"}
@@ -369,7 +392,6 @@ public class Mining {
@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"}
@@ -381,7 +403,6 @@ public class Mining {
@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"}
@@ -393,7 +414,6 @@ public class Mining {
@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"}
@@ -405,7 +425,6 @@ public class Mining {
@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"}
@@ -417,7 +436,6 @@ public class Mining {
@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"}
@@ -429,7 +447,6 @@ public class Mining {
@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"}
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
@@ -97,6 +97,16 @@ public class TooltipTweaks {
@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",
desc = "Make the borders of tooltips match the rarity of the item (NEU Tooltips Only)"
)
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>Completed!)|(((?<days>[0-9]+)d)? ?((?<hours>[0-9]+)h)? ?((?<minutes>[0-9]+)m)? ?((?<seconds>[0-9]+)s)?))");
+ private static final Pattern timeRemainingTab = Pattern.compile(".*[1-5]\\) (?<ItemName>.*): ((?<Ready>Ready!)|(((?<days>[0-9]+)d)? ?((?<hours>[0-9]+)h)? ?((?<minutes>[0-9]+)m)? ?((?<seconds>[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<String> forgeStrings = new ArrayList<>();
- List<String> forgeStringsEmpty = new ArrayList<>();
+
String mithrilPowder = null;
String gemstonePowder = null;
-
+ int forgeInt = 0;
boolean commissions = false;
boolean forges = false;
List<NetworkPlayerInfo> 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()){
+