From e5067247aea96304d02875ebe1cb348eb7173360 Mon Sep 17 00:00:00 2001 From: nea Date: Tue, 8 Feb 2022 13:28:46 +0100 Subject: Fix Enchanting GUI im sowwy --- .../moulberry/notenoughupdates/NEUEventListener.java | 16 ++++++++++------ .../notenoughupdates/miscgui/GuiCustomEnchant.java | 6 ++---- 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(); -- cgit