Inventory Tweaks [1.12 only]

Inventory Tweaks [1.12 only]

127M Downloads

There was a critical issue trying to build the config GUI for inventorytweaks java.lang.NoSuchMethodException: invtweaks.InvTweaksGuiSettings.<init>(net.minecraft.client.gui.GuiScreen)

glentakahashi opened this issue ยท 3 comments

commented

Minecraft Version:1.9
Inventory Tweaks Version:1.61-dev-43

[23:37:29] [Client thread/ERROR] [FML/]: There was a critical issue trying to build the config GUI for inventorytweaks
java.lang.NoSuchMethodException: invtweaks.InvTweaksGuiSettings.<init>(net.minecraft.client.gui.GuiScreen)
        at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_74]
        at java.lang.Class.getConstructor(Class.java:1825) ~[?:1.8.0_74]
        at net.minecraftforge.fml.client.GuiModList.func_146284_a(GuiModList.java:276) [GuiModList.class:?]
        at net.minecraft.client.gui.GuiScreen.func_73864_a(GuiScreen.java:451) [bfb.class:?]
        at net.minecraftforge.fml.client.GuiModList.func_73864_a(GuiModList.java:190) [GuiModList.class:?]
        at net.minecraft.client.gui.GuiScreen.func_146274_d(GuiScreen.java:539) [bfb.class:?]
        at net.minecraft.client.gui.GuiScreen.func_146269_k(GuiScreen.java:508) [bfb.class:?]
        at net.minecraft.client.Minecraft.func_71407_l(Minecraft.java:1694) [bcf.class:?]
        at net.minecraft.client.Minecraft.func_71411_J(Minecraft.java:1051) [bcf.class:?]
        at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:366) [bcf.class:?]
        at net.minecraft.client.main.Main.main(SourceFile:124) [Main.class:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_74]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_74]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_74]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_74]
        at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
        at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

I get this error and see no buttons at all for sorting in Minecraft. Clicking the config button produces nothing (as shown by the error).

commented

I wasn't kidding when I said I hadn't tested it. Looks like maybe the way FML handles the mod screen changed a bit? I'll look into it more.

commented

Yea, just thought it was worth reporting. Looks like it only passes in the Parent Screen as the constructor, so I tried something like

    public InvTweaksGuiSettings(GuiScreen parentScreen_) {
        this(parentScreen_.mc, parentScreen_, new InvTweaksConfigManager(parentScreen_.mc).getConfig());
    }

But that ended up having the config be null. How else might I get the config in this situation?

EDIT: Ah, figured it out, really temporary way of doing it for now, looking forward to your real patch. This doesn't actually make the mod work, just fixes the Settings GUI.

From 8ebb27b969bac29257b49e4764c3437625bf6d1f Mon Sep 17 00:00:00 2001
From: Glen Takahashi <[email protected]>
Date: Wed, 23 Mar 2016 00:49:39 +0100
Subject: [PATCH 1/1] Fix GUI config things

---
 src/main/java/invtweaks/InvTweaksGuiModNotWorking.java  |  6 +++---
 src/main/java/invtweaks/InvTweaksGuiSettings.java       | 17 +++++++++++++----
 .../java/invtweaks/InvTweaksGuiSettingsAbstract.java    |  6 ++++--
 .../java/invtweaks/InvTweaksGuiSettingsAdvanced.java    | 10 +++++++---
 src/main/java/invtweaks/InvTweaksGuiSettingsButton.java |  7 +++----
 5 files changed, 30 insertions(+), 16 deletions(-)

diff --git a/src/main/java/invtweaks/InvTweaksGuiModNotWorking.java b/src/main/java/invtweaks/InvTweaksGuiModNotWorking.java
index 9552d94..d217bca 100644
--- a/src/main/java/invtweaks/InvTweaksGuiModNotWorking.java
+++ b/src/main/java/invtweaks/InvTweaksGuiModNotWorking.java
@@ -11,8 +11,8 @@ import net.minecraft.util.text.translation.I18n;
  * @author Jimeo Wan
  */
 public class InvTweaksGuiModNotWorking extends InvTweaksGuiSettingsAbstract {
-    public InvTweaksGuiModNotWorking(Minecraft mc_, GuiScreen parentScreen_, InvTweaksConfig config_) {
-        super(mc_, parentScreen_, config_);
+    public InvTweaksGuiModNotWorking(Minecraft mc_, GuiScreen parentScreen_) {
+        super(mc_, parentScreen_);
     }

     @Override
@@ -36,7 +36,7 @@ public class InvTweaksGuiModNotWorking extends InvTweaksGuiSettingsAbstract {
         switch(guibutton.id) {
             // Back to main settings screen
             case ID_DONE:
-                obf.displayGuiScreen(new InvTweaksGuiSettings(mc, parentScreen, config));
+                obf.displayGuiScreen(new InvTweaksGuiSettings(mc, parentScreen));
         }
     }

diff --git a/src/main/java/invtweaks/InvTweaksGuiSettings.java b/src/main/java/invtweaks/InvTweaksGuiSettings.java
index 07414da..83a0922 100644
--- a/src/main/java/invtweaks/InvTweaksGuiSettings.java
+++ b/src/main/java/invtweaks/InvTweaksGuiSettings.java
@@ -4,6 +4,9 @@ import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.GuiButton;
 import net.minecraft.client.gui.GuiScreen;
 import net.minecraft.util.text.translation.I18n;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 import org.lwjgl.util.Point;

 import java.awt.*;
@@ -16,6 +19,8 @@ import java.util.List;
  * @author Jimeo Wan
  */
 public class InvTweaksGuiSettings extends InvTweaksGuiSettingsAbstract {
+   public static Logger log = LogManager.getLogger(InvTweaksGuiSettings.class.getName());
+   
     private final static int ID_MIDDLE_CLICK = 1;
     private final static int ID_BEFORE_BREAK = 2;
     private final static int ID_SHORTCUTS = 3;
@@ -33,9 +38,13 @@ public class InvTweaksGuiSettings extends InvTweaksGuiSettingsAbstract {
     private static String labelAutoRefillBeforeBreak;
     private static String labelMoreOptions;
     private static String labelBugSorting;
+    
+    public InvTweaksGuiSettings(GuiScreen parentScreen_) {
+       this(parentScreen_.mc, parentScreen_);
+    }

-    public InvTweaksGuiSettings(Minecraft mc_, GuiScreen parentScreen_, InvTweaksConfig config_) {
-        super(mc_, parentScreen_, config_);
+    public InvTweaksGuiSettings(Minecraft mc_, GuiScreen parentScreen_) {
+        super(mc_, parentScreen_);

         labelMiddleClick = I18n.translateToLocal("invtweaks.settings.middleclick");
         labelShortcuts = I18n.translateToLocal("invtweaks.settings.shortcuts");
@@ -159,12 +168,12 @@ public class InvTweaksGuiSettings extends InvTweaksGuiSettingsAbstract {

             // More options screen
             case ID_MORE_OPTIONS:
-                obf.displayGuiScreen(new InvTweaksGuiSettingsAdvanced(mc, parentScreen, config));
+                obf.displayGuiScreen(new InvTweaksGuiSettingsAdvanced(mc, parentScreen));
                 break;

             // Sorting bug help screen
             case ID_BUG_SORTING:
-                obf.displayGuiScreen(new InvTweaksGuiModNotWorking(mc, parentScreen, config));
+                obf.displayGuiScreen(new InvTweaksGuiModNotWorking(mc, parentScreen));
                 break;

             // Open rules configuration in external editor
diff --git a/src/main/java/invtweaks/InvTweaksGuiSettingsAbstract.java b/src/main/java/invtweaks/InvTweaksGuiSettingsAbstract.java
index 5048c28..a22c40c 100644
--- a/src/main/java/invtweaks/InvTweaksGuiSettingsAbstract.java
+++ b/src/main/java/invtweaks/InvTweaksGuiSettingsAbstract.java
@@ -26,7 +26,7 @@ public abstract class InvTweaksGuiSettingsAbstract extends GuiScreen {
     protected InvTweaksConfig config;
     protected GuiScreen parentScreen;

-    public InvTweaksGuiSettingsAbstract(Minecraft mc_, GuiScreen parentScreen_, InvTweaksConfig config_) {
+    public InvTweaksGuiSettingsAbstract(Minecraft mc_, GuiScreen parentScreen_) {

         LABEL_DONE = I18n.translateToLocal("invtweaks.settings.exit");
         ON = ": " + I18n.translateToLocal("invtweaks.settings.on");
@@ -35,7 +35,9 @@ public abstract class InvTweaksGuiSettingsAbstract extends GuiScreen {
         mc = mc_;
         obf = new InvTweaksObfuscation(mc_);
         parentScreen = parentScreen_;
-        config = config_;
+       InvTweaksConfigManager configManager_ = new InvTweaksConfigManager(parentScreen_.mc);
+       configManager_.makeSureConfigurationIsLoaded();
+        config = configManager_.getConfig();
     }

     @Override
diff --git a/src/main/java/invtweaks/InvTweaksGuiSettingsAdvanced.java b/src/main/java/invtweaks/InvTweaksGuiSettingsAdvanced.java
index e24c15c..159384c 100644
--- a/src/main/java/invtweaks/InvTweaksGuiSettingsAdvanced.java
+++ b/src/main/java/invtweaks/InvTweaksGuiSettingsAdvanced.java
@@ -28,9 +28,13 @@ public class InvTweaksGuiSettingsAdvanced extends InvTweaksGuiSettingsAbstract {
     private static String labelEquipArmor;
     private static String labelEnableSounds;
     private static String labelServerAssist;
+    
+    public InvTweaksGuiSettingsAdvanced(GuiScreen parentScreen_) {
+       this(parentScreen_.mc, parentScreen_);
+    }

-    public InvTweaksGuiSettingsAdvanced(Minecraft mc_, GuiScreen parentScreen_, InvTweaksConfig config_) {
-        super(mc_, parentScreen_, config_);
+    public InvTweaksGuiSettingsAdvanced(Minecraft mc_, GuiScreen parentScreen_) {
+        super(mc_, parentScreen_);

         labelSortOnPickup = I18n.translateToLocal("invtweaks.settings.advanced.sortonpickup");
         labelEquipArmor = I18n.translateToLocal("invtweaks.settings.advanced.autoequip");
@@ -168,7 +172,7 @@ public class InvTweaksGuiSettingsAdvanced extends InvTweaksGuiSettingsAbstract {

             // Back to main settings screen
             case ID_DONE:
-                obf.displayGuiScreen(new InvTweaksGuiSettings(mc, parentScreen, config));
+                obf.displayGuiScreen(new InvTweaksGuiSettings(mc, parentScreen));

         }

diff --git a/src/main/java/invtweaks/InvTweaksGuiSettingsButton.java b/src/main/java/invtweaks/InvTweaksGuiSettingsButton.java
index 6fd792f..1e1df0d 100644
--- a/src/main/java/invtweaks/InvTweaksGuiSettingsButton.java
+++ b/src/main/java/invtweaks/InvTweaksGuiSettingsButton.java
@@ -1,11 +1,10 @@
 package invtweaks;

+import org.apache.logging.log4j.Logger;
+
 import invtweaks.api.container.ContainerSection;
 import invtweaks.container.ContainerSectionManager;
 import net.minecraft.client.Minecraft;
-import org.apache.logging.log4j.Logger;
-
-import java.util.concurrent.TimeoutException;

 /**
  * Button that opens the inventory & chest settings screen.
@@ -63,7 +62,7 @@ public class InvTweaksGuiSettingsButton extends InvTweaksGuiIconButton {
             cfgManager.makeSureConfigurationIsLoaded();

             // Display menu
-            obf.displayGuiScreen(new InvTweaksGuiSettings(minecraft, obf.getCurrentScreen(), config));
+            obf.displayGuiScreen(new InvTweaksGuiSettings(minecraft, obf.getCurrentScreen()));
             return true;
         } else {
             return false;
-- 
2.6.2

commented

It seems like this bug has been around for a while, but I remember that screen working in 1.8. Strange.