Jump to content

[FORGE BUG]GuiConfigEntries.SelectValueEntry title overlapping options


The_Fireplace

Recommended Posts

Ok, so my issue is that in the Config Gui, I have a config option which I used a class extending GuiConfigEntries.SelectValueEntry as the Gui for. When I click the option to open the Gui, it looks like this:

 

 

r3rDuBt.png

 

 

However, in the example given by FML, the Gui adjusted so the title didn't overlap with the options, like this:

 

 

uWDSHUS.png

 

 

Now, for my code:

 

 

OreGenEntries.class(The file extending GuiConfigEntries.SelectValueEntry)

public class OreGenEntries extends GuiConfigEntries.SelectValueEntry {

public OreGenEntries(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) {
	super(owningScreen, owningEntryList, configElement, ClaySpawn.instance.entries);
}
}

My main mod file:

/**
* @author The_Fireplace
*/
@Mod(modid=ClaySpawn.MODID, name=ClaySpawn.MODNAME, version=ClaySpawn.VERSION, acceptedMinecraftVersions = "1.8", guiFactory = "the_fireplace.clayspawn.config.ClaySpawnGuiFactory")
public class ClaySpawn {
@Instance(ClaySpawn.MODID)
public static ClaySpawn instance;
public static final String MODID = "clayspawn";
public static final String MODNAME = "Fire's Clay Spawn";
public static final String VERSION = "2.2.1.0";
public static final String downloadURL = "http://goo.gl/vi8Kom";

public WorldGeneratorClay wg = new WorldGeneratorClay();
public Map entries = Maps.newHashMap();

public static Configuration file;
public static Property OREGENRATE_PROPERTY;
public static Property DENSITYOVERRIDE_PROPERTY;
public static Property HEIGHTOVERRIDE_PROPERTY;

public static void syncConfig(){
	ConfigValues.OREGENRATE = OREGENRATE_PROPERTY.getString();
	ConfigValues.DENSITYOVERRIDE = DENSITYOVERRIDE_PROPERTY.getInt();
	ConfigValues.HEIGHTOVERRIDE = HEIGHTOVERRIDE_PROPERTY.getInt();
	if(file.hasChanged()){
		file.save();
	}
}

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	CSAPI.registerOre("iron", 65, ;
	CSAPI.registerOre("coal", 128, 16);
	CSAPI.registerOre("diamond", 15, 7);
	CSAPI.registerOre("gold", 32, ;
	CSAPI.registerOre("emerald", 32, 1);
	CSAPI.registerOre("lapis", 31, 6);
	CSAPI.registerOre("redstone", 16, 7);
	//Mod Ores
	CSAPI.registerOre("unlogicii:fossil", 12, 2);
	CSAPI.registerOre("clayspawn:clayworld", 255, 32);
	FMLCommonHandler.instance().bus().register(new FMLEvents());
	file = new Configuration(event.getSuggestedConfigurationFile());
	file.load();
	OREGENRATE_PROPERTY = file.get(Configuration.CATEGORY_GENERAL, ConfigValues.OREGENRATE_NAME, ConfigValues.OREGENRATE_DEFAULT, StatCollector.translateToLocal(ConfigValues.OREGENRATE_NAME+".tooltip"));
	DENSITYOVERRIDE_PROPERTY = file.get(Configuration.CATEGORY_GENERAL, ConfigValues.DENSITYOVERRIDE_NAME, ConfigValues.DENSITYOVERRIDE_DEFAULT, StatCollector.translateToLocal(ConfigValues.DENSITYOVERRIDE_NAME+".tooltip"));
	HEIGHTOVERRIDE_PROPERTY = file.get(Configuration.CATEGORY_GENERAL, ConfigValues.HEIGHTOVERRIDE_NAME, ConfigValues.HEIGHTOVERRIDE_DEFAULT, StatCollector.translateToLocal(ConfigValues.HEIGHTOVERRIDE_NAME+".tooltip"));
	OREGENRATE_PROPERTY.setConfigEntryClass(OreGenEntries.class);
	syncConfig();
}
}

And finally, ClaySpawnConfigGui.class

/**
* @author The_Fireplace
*/
public class ClaySpawnConfigGui extends GuiConfig{
public ClaySpawnConfigGui(GuiScreen parentScreen) {
	super(parentScreen,
			new ConfigElement(ClaySpawn.file.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(), ClaySpawn.MODID, true,
			false, GuiConfig.getAbridgedConfigPath(ClaySpawn.file.toString()));
}
}

 

 

Now, does anyone know how I can fix this? Or did I do it correctly, and this is an FML bug?

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

Why did you make your own entry class? It is meaningless, first fix that.

It errored if I didn't use my own entry class, I believe it was because if it was set to GuiConfigEntries.SelectValueEntry, there was no list defined. I will try again and post what happens.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

Why did you make your own entry class? It is meaningless, first fix that.

Ok, I checked again, and it is not meaningless. When you don't make your own entry class, the following error prints to the console when you open the mod's config gui:

 

 

[22:38:56] [Client thread/ERROR] [FML]: There was a critical error instantiating the custom IConfigEntry for config element OreGenRate.
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.NoSuchMethodException: net.minecraftforge.fml.client.config.GuiConfigEntries$SelectValueEntry.<init>(net.minecraftforge.fml.client.config.GuiConfig, net.minecraftforge.fml.client.config.GuiConfigEntries, net.minecraftforge.fml.client.config.IConfigElement)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at java.lang.Class.getConstructor0(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at java.lang.Class.getConstructor(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.client.config.GuiConfigEntries.<init>(GuiConfigEntries.java:118)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.client.config.GuiConfig.<init>(GuiConfig.java:155)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.client.config.GuiConfig.<init>(GuiConfig.java:109)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at the_fireplace.clayspawn.config.ClaySpawnConfigGui.<init>(ClaySpawnConfigGui.java:15)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at java.lang.reflect.Constructor.newInstance(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.client.GuiModList.actionPerformed(GuiModList.java:276)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.gui.GuiScreen.mouseClicked(GuiScreen.java:510)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.client.GuiModList.mouseClicked(GuiModList.java:187)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:606)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:572)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1760)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1087)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.Minecraft.run(Minecraft.java:376)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.main.Main.main(Main.java:117)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at java.lang.reflect.Method.invoke(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at GradleStart.main(Unknown Source)
[22:38:56] [Client thread/ERROR] [FML]: There was a critical error instantiating the custom IConfigEntry for config element OreGenRate.
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: java.lang.NoSuchMethodException: net.minecraftforge.fml.client.config.GuiConfigEntries$SelectValueEntry.<init>(net.minecraftforge.fml.client.config.GuiConfig, net.minecraftforge.fml.client.config.GuiConfigEntries, net.minecraftforge.fml.client.config.IConfigElement)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at java.lang.Class.getConstructor0(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at java.lang.Class.getConstructor(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.client.config.GuiConfigEntries.<init>(GuiConfigEntries.java:118)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.client.config.GuiConfig.initGui(GuiConfig.java:189)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.gui.GuiScreen.setWorldAndResolution(GuiScreen.java:552)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:983)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.client.GuiModList.actionPerformed(GuiModList.java:277)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.gui.GuiScreen.mouseClicked(GuiScreen.java:510)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.fml.client.GuiModList.mouseClicked(GuiModList.java:187)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:606)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:572)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1760)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1087)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.Minecraft.run(Minecraft.java:376)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.client.main.Main.main(Main.java:117)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at java.lang.reflect.Method.invoke(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at net.minecraftforge.gradle.GradleStartCommon.launch(Unknown Source)
[22:38:56] [Client thread/INFO] [sTDERR]: [java.lang.Throwable$WrappedPrintStream:println:-1]: 	at GradleStart.main(Unknown Source)

 

 

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

Ah you used Config Entry Class..

The FML used ConfigGuiType.MOD_ID instead of entry class. Try that.

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

Sorry, I had mistaken.

It is done by this element: new DummyConfigElement<String>("modIDSelector", "FML", ConfigGuiType.MOD_ID, "fml.config.sample.modIDSelector")

So it does need Dummy Config Element..

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

Sorry, I had mistaken.

It is done by this element: new DummyConfigElement<String>("modIDSelector", "FML", ConfigGuiType.MOD_ID, "fml.config.sample.modIDSelector")

So it does need Dummy Config Element..

How would I set up my syncConfig() to work with that? And isn't it called a Dummy config element because it shouldn't be used for "real" content? And can they be saved and loaded from the config file like regular config elements? I know in the FML example, it is a Dummy for trying it out, and doesn't save.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

  • 2 weeks later...

Sorry, I had mistaken.

It is done by this element: new DummyConfigElement<String>("modIDSelector", "FML", ConfigGuiType.MOD_ID, "fml.config.sample.modIDSelector")

So it does need Dummy Config Element..

How would I set up my syncConfig() to work with that? And isn't it called a Dummy config element because it shouldn't be used for "real" content? And can they be saved and loaded from the config file like regular config elements? I know in the FML example, it is a Dummy for trying it out, and doesn't save.

Anyone? Also, just saying, having to do this big of a redesign to simply fix that overlapping shouldn't be necessary.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

  • 2 weeks later...

After doing some more testing, I have determined this to be a Forge bug, and figured out a temporary workaround.

The workaround:

 

 

In your class extending GuiConfig, add the following line to the constructor:

this.titleLine2="";

 

 

Why it is a Forge Bug:

The issue is how GuiConfigEntries determines what height its top is at. Specifically, GuiConfigEntries:77( https://github.com/MinecraftForge/MinecraftForge/blob/master/src/main/java/net/minecraftforge/fml/client/config/GuiConfigEntries.java#L77 )

super(mc, parent.width, parent.height, parent.titleLine2 != null ? 33 : 23, parent.height - 32, 20);

titleLine2 is null, but the name of the config option the gui is for, which isn't null, renders below where titleLine2 would be, and this code doesn't check for that.

 

Here is the issue on the Forge issue tracker: https://github.com/MinecraftForge/MinecraftForge/issues/2114

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.