aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLulonaut <67191924+Lulonaut@users.noreply.github.com>2022-02-25 23:05:42 +0100
committerGitHub <noreply@github.com>2022-02-25 23:05:42 +0100
commit22cb02adbeb24b7ec98f843bcaba99cebe3e4f03 (patch)
treeda7af8448e8103a971f7fd63b30612e1e06afb39 /src
parentca26771b6fffc102b1585e4aaab297877339633e (diff)
downloadNotEnoughUpdates-22cb02adbeb24b7ec98f843bcaba99cebe3e4f03.tar.gz
NotEnoughUpdates-22cb02adbeb24b7ec98f843bcaba99cebe3e4f03.tar.bz2
NotEnoughUpdates-22cb02adbeb24b7ec98f843bcaba99cebe3e4f03.zip
Hide Hypixel reforge stats in Reforge Stone lore (#85)
* hide Hypixel reforge stats * unused import? * better comments * 2.1.md 🙂 * 2.1.md 🙂
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java38
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java1
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/TooltipTweaks.java8
3 files changed, 41 insertions, 6 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index 10755305..6af0d057 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -53,15 +53,14 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
-import javax.swing.JOptionPane;
-import javax.swing.JTextField;
-import java.awt.Color;
-import java.awt.Toolkit;
+import javax.swing.*;
+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.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -2575,16 +2574,45 @@ public class NEUEventListener {
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.
+ * This method does the following:
+ * Move the pet inventory display tooltip to the left to avoid conflicts
+ * Remove reforge stats for Legendary items from Hypixel if enabled
+ * Show NBT data when holding LCONTROL
*/
@SubscribeEvent
public void onItemTooltip(ItemTooltipEvent event) {
if (!neu.isOnSkyblock()) return;
+ if (event.toolTip == null) return;
//Render the pet inventory display tooltip to the left to avoid things from other mods rendering over the tooltip
if (event.itemStack.getTagCompound() != null && event.itemStack.getTagCompound().getBoolean("NEUPETINVDISPLAY")) {
GlStateManager.translate(-200, 0, 0);
}
+ if (event.toolTip.size() > 2 && NotEnoughUpdates.INSTANCE.config.tooltipTweaks.hideDefaultReforgeStats) {
+ String secondLine = StringUtils.stripControlCodes(event.toolTip.get(1));
+ if (secondLine.equals("Reforge Stone")) {
+ Integer startIndex = null;
+ Integer cutoffIndex = null;
+ //loop from the back of the List to find the wanted index sooner
+ for (int i = event.toolTip.size() - 1; i >= 0; i--) {
+ //rarity or mining level requirement
+ String line = StringUtils.stripControlCodes(event.toolTip.get(i));
+ if (line.contains("REFORGE STONE") || line.contains("Requires Mining Skill Level")) {
+ cutoffIndex = i;
+ }
+
+ //The line where the Hypixel stats start
+ if (line.contains("(Legendary):")) {
+ startIndex = i;
+ break;
+ }
+ }
+ if (startIndex != null && cutoffIndex != null && startIndex < cutoffIndex) {
+ event.toolTip.subList(startIndex, cutoffIndex).clear();
+ }
+ }
+ }
+
if (Keyboard.isKeyDown(Keyboard.KEY_LCONTROL) && NotEnoughUpdates.INSTANCE.config.hidden.dev &&
event.toolTip.size() > 0 && event.toolTip.get(event.toolTip.size() - 1).startsWith(EnumChatFormatting.DARK_GRAY + "NBT: ")) {
event.toolTip.remove(event.toolTip.size() - 1);
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
index 0cff5de1..e6cfd7c0 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NotEnoughUpdates.java
@@ -39,7 +39,6 @@ import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
-import scala.collection.parallel.ParIterableLike;
import java.awt.*;
import java.io.*;
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 78dc1995..fcbc5ea4 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
@@ -96,6 +96,14 @@ public class TooltipTweaks {
@Expose
@ConfigOption(
+ name = "Hide default reforge stats",
+ desc = "Hides the reforge stats only for Legendary items that Hypixel adds to the Reforge stones"
+ )
+ @ConfigEditorBoolean
+ public boolean hideDefaultReforgeStats = true;
+
+ @Expose
+ @ConfigOption(
name = "Missing Enchant List",
desc = "Show which enchants are missing on an item when pressing LSHIFT"
)