Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I'm going to go insane. As with almost everything Forge there is basically no documentation to be found. I wanted to use the SelectValueEntry GUI entry in the same fashion I use numeric sliders - by telling Configuration Properties about this nice ConfigEntry class:

 

File configFile = event.getSuggestedConfigurationFile();
config = new Configuration(configFile);
config.get("Category", "Field", "Default").setConfigEntryClass(GuiConfigEntries.SelectValueEntry.class);

Naturally that doesn't work because the relevant constructor then doesn't know about SelectValueEntry's fourth required parameter that gives it the map with values.

I tried a bunch of different  things; mainly the least  ugly override of the class like so:

public class MySelectValueEntry extends GuiConfigEntries.SelectValueEntry {
	public MySelectValueEntry(GuiConfig owningScreen, GuiConfigEntries owningEntryList, IConfigElement configElement) {
		super(owningScreen, owningEntryList, configElement,  ValueMap);
	}
}

where ValueMap is a previously constructed Map<Integer, String>, and just using it there instead. Seemed like a fairly okay solution, but I was met with an exception:

[01:59:12] [main/ERROR] [FML]: There was a critical error instantiating the custom IConfigEntry for config element cfg.field.
java.lang.NoSuchMethodException: net.amunak.minecraft.mod.Configuration$MySelectValueEntry.<init>(net.minecraftforge.fml.client.config.GuiConfig, net.minecraftforge.fml.client.config.GuiConfigEntries, net.minecraftforge.fml.client.config.IConfigElement)
	at java.lang.Class.getConstructor0(Class.java:3082) ~[?:1.8.0_181]
	at java.lang.Class.getConstructor(Class.java:1825) ~[?:1.8.0_181]
	at net.minecraftforge.fml.client.config.GuiConfigEntries.<init>(GuiConfigEntries.java:127) [GuiConfigEntries.class:?]
	at net.minecraftforge.fml.client.config.GuiConfig.<init>(GuiConfig.java:217) [GuiConfig.class:?]
	at net.minecraftforge.fml.client.config.GuiConfig.<init>(GuiConfig.java:153) [GuiConfig.class:?]
	at net.amunak.minecraft.mod.ModConfigGuiFactory$ConfigScreen$SimpleCategory.buildChildScreen(ModConfigGuiFactory.java:138) [ModConfigGuiFactory$ConfigScreen$SimpleCategory.class:?]
	at net.minecraftforge.fml.client.config.GuiConfigEntries$CategoryEntry.<init>(GuiConfigEntries.java:1322) [GuiConfigEntries$CategoryEntry.class:?]
	at net.amunak.minecraft.mod.ModConfigGuiFactory$ConfigScreen$SimpleCategory.<init>(ModConfigGuiFactory.java:121) [ModConfigGuiFactory$ConfigScreen$SimpleCategory.class:?]
	at net.amunak.minecraft.mod.ModConfigGuiFactory$ConfigScreen$EntitiesPlayersCategory.<init>(ModConfigGuiFactory.java:75) [ModConfigGuiFactory$ConfigScreen$EntitiesPlayersCategory.class:?]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [?:1.8.0_181]
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [?:1.8.0_181]
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [?:1.8.0_181]
	at net.minecraftforge.fml.client.config.GuiConfigEntries.<init>(GuiConfigEntries.java:128) [GuiConfigEntries.class:?]
	at net.minecraftforge.fml.client.config.GuiConfig.initGui(GuiConfig.java:269) [GuiConfig.class:?]
	at net.minecraft.client.gui.GuiScreen.setWorldAndResolution(GuiScreen.java:543) [GuiScreen.class:?]
	at net.minecraft.client.Minecraft.displayGuiScreen(Minecraft.java:1097) [Minecraft.class:?]
	at net.minecraftforge.fml.client.GuiModList.actionPerformed(GuiModList.java:303) [GuiModList.class:?]
	at net.minecraft.client.gui.GuiScreen.mouseClicked(GuiScreen.java:494) [GuiScreen.class:?]
	at net.minecraftforge.fml.client.GuiModList.mouseClicked(GuiModList.java:206) [GuiModList.class:?]
	at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:611) [GuiScreen.class:?]
	at net.minecraftforge.fml.client.GuiModList.handleMouseInput(GuiModList.java:352) [GuiModList.class:?]
	at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:576) [GuiScreen.class:?]
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1885) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1187) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:441) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	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:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:25) [start/:?]

suggesting that a fitting  constructor(?) doesn't exist. You can look at the full and pretty much current source code for context. I specifically don't want to draw the menu "by hand" (thus bypassing the whole instantiation from net.minecraftforge.fml.client.config.GuiConfigEntries:126) to avoid duplicating tons of code that already works just fine inside Forge.

Did I miss something or am I doing it somehow completely wrong? I've been trying at it for the past like 4 hours without much recourse. Any ideas?

Edited by Amunak

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.