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()){
+
+ 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<String> getForgeStrings(List<ForgeItem> forgeItems){
+ List<String> 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<ForgeItem> 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<NetworkPlayerInfo> 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 0d111762..728703ad 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;
@@ -132,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];
@@ -192,11 +198,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;
}
}
@@ -226,7 +243,6 @@ public class TimersOverlay extends TextOverlay {
}
if (godpotRemaingTimeUnformatted.length >= 1) {
godPotDuration = godPotDuration + (long) Integer.parseInt(godpotRemaingTimeUnformatted[i]) * 1000;
-
}
} catch (Exception ignored) {
}
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..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,26 +469,77 @@ 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",
};
+
+ public static String getRarityFromInt(int rarity){
+ if(rarity < 0|| rarity >= rarityArr.length){ return rarityArr[0]; }
+ return rarityArr[rarity];
+ }
+
+ public static int checkItemTypePet(List<String> 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<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;
- }
+
+ int returnType = checkItemType(line, contains, typeMatches);
+ if(returnType != -1){
+ return returnType;
+ }
+ }
+ return -1;
+ }
+
+ public static int checkItemType(String[] lore, boolean contains, String... typeMatches) {
+ for(int i=lore.length-1; i>=0; i--) {
+ String line = lore[i];
+
+ int returnType = checkItemType(line, contains, typeMatches);
+ if(returnType != -1){
+ return returnType;
+ }
+ }
+ return -1;
+ }
+
+ public static int checkItemType(List<String> 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,13 @@ 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() {
playSound(new ResourceLocation("gui.button.press"), true);
}