aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman / Nea <roman.graef@gmail.com>2022-02-09 00:16:26 +0100
committerGitHub <noreply@github.com>2022-02-08 18:16:26 -0500
commitc9b09df800776e6ad59db97bfec6b67c52792b2c (patch)
treeb53c6c6d54b116e6f5c9fd6eec980e811a787070
parent346788609546690084f21210c52940b7a4b6c99c (diff)
downloadNotEnoughUpdates-c9b09df800776e6ad59db97bfec6b67c52792b2c.tar.gz
NotEnoughUpdates-c9b09df800776e6ad59db97bfec6b67c52792b2c.tar.bz2
NotEnoughUpdates-c9b09df800776e6ad59db97bfec6b67c52792b2c.zip
Fix Enchanting GUI (#76)
im sowwy
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java16
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java6
2 files changed, 12 insertions, 10 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
index d7061c22..80795044 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUEventListener.java
@@ -20,7 +20,6 @@ import io.github.moulberry.notenoughupdates.miscgui.*;
import io.github.moulberry.notenoughupdates.options.NEUConfig;
import io.github.moulberry.notenoughupdates.overlays.*;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
-import io.github.moulberry.notenoughupdates.recipes.CraftingOverlay;
import io.github.moulberry.notenoughupdates.util.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;
@@ -53,14 +52,15 @@ import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
-import javax.swing.*;
-import java.awt.*;
+import javax.swing.JOptionPane;
+import javax.swing.JTextField;
+import java.awt.Color;
+import java.awt.Toolkit;
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;
@@ -1141,9 +1141,13 @@ public class NEUEventListener {
String containerName = null;
GuiScreen guiScreen = Minecraft.getMinecraft().currentScreen;
+ if (guiScreen instanceof GuiChest) {
+ GuiChest eventGui = (GuiChest) guiScreen;
+ ContainerChest cc = (ContainerChest) eventGui.inventorySlots;
+ containerName = cc.getLowerChestInventory().getDisplayName().getUnformattedText();
- if (GuiCustomEnchant.getInstance().shouldOverride(containerName)) {
- return;
+ if (GuiCustomEnchant.getInstance().shouldOverride(containerName))
+ return;
}
boolean tradeWindowActive = TradeWindow.tradeWindowActive(containerName);
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 71915b8d..c68f02fc 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java
@@ -1,7 +1,6 @@
package io.github.moulberry.notenoughupdates.miscgui;
import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import io.github.moulberry.notenoughupdates.NotEnoughUpdates;
@@ -200,9 +199,8 @@ public class GuiCustomEnchant extends Gui {
public boolean shouldOverride(String containerName) {
shouldOverrideFast = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableTableGUI &&
- containerName != null &&
- NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard() &&
- containerName.equalsIgnoreCase("Enchant Item");
+ Objects.equals("Enchant Item", containerName) &&
+ NotEnoughUpdates.INSTANCE.hasSkyblockScoreboard();
if (!shouldOverrideFast) {
currentState = EnchantState.NO_ITEM;
applicable.clear();