Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.11.2] @Config creates and loads file, but doesn't create GUI


Recommended Posts

I made a very simple @Config class with just a few booleans:

Spoiler

@Config(modid = Geomastery.MODID)
public class GeoConfig {

    @Comment("Show the food type in the item tooltip")
    public static boolean foodTooltips = true;

    @Comment("Show the item's decay level with the filled proportion of durability bar as well as colour")
    public static boolean foodDurability = false;

    @Comment("Show the biomes where a crop can grow in the item tooltip")
    public static boolean cropBiomes = true;

    @Comment("Hide unusued and inaccessible vanilla items from Just Enough Items")
    public static boolean hideVanilla = true;
    
    @Comment("Show simple building block requirements in the item tooltip")
    public static boolean buildReqs = true;
}

 

When I delete the config file, it creates it with the properties and comments in the class, and when I change values in the file then the fields in the class change as expected - so it's definitely working in some sense. But the "config" button in the mods list is greyed out. There aren't any crashes or error messages that I can find, but I could post the whole log if that's useful.

 

I do subscribe to OnConfigChangedEvent in my mod class, but it doesn't get called because there is no GUI to save the config from.

Spoiler

    @SubscribeEvent
    public static void configChanged(ConfigChangedEvent.OnConfigChangedEvent
            event) {

        if (event.getModID().equals(MODID)) {

            ConfigManager.load(MODID, Config.Type.INSTANCE);
        }
    }

 

 

What am I missing? All my code is on github.

Link to post
Share on other sites

Forge doesn't automatically create a config GUI for you. In your @Mod annotation, you need to provide a value for the guiFactory property. It should be the fully-qualified name of a class that implements IModGuiFactory. In your GUI factory, you'll need to make sure that hasConfigGui returns true and that you've implemented createConfigGui.

 

This is my GUIConfig class which is a small wrapper around FML's GuiConfig class that makes it a bit easier to use. 

Don't make mods if you don't know Java.

Check out my website: http://shadowfacts.net

Developer of many mods

Link to post
Share on other sites

Forge does automatically create a config GUI for you if you're using the annotation-based config system and Forge 1.11.2-13.20.0.2262 (commit 25497d3) or later.

 

You're using Forge 1.11.2-13.20.0.2228, so you need to update to get the automatic config GUI.

Edited by Choonster
  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to post
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.

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



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I may have simply needed to update the import. Sorry about that.
    • I'm using forge-1.17.1-37.0.15-mdk, and the empty project starts without any problems. I have no idea where the problem lies.
    • It happens with Language Support for Java. Because of this error, my code will not be able to resolve the reference. Please help me. Error Messages: ---------------------------------- [Warn  - 9:37:53] 2021/08/01 9:37:53 While loading class "org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions$LookupStrategy", thread "Thread[Worker-1: Loading available Gradle versions,5,main]" timed out waiting (30035ms) for thread "Thread[pool-2-thread-1,5,main]" to finish starting bundle "org.eclipse.buildship.core_3.1.5.v20210112-1646-s [14]". To avoid deadlock, thread "Thread[Worker-1: Loading available Gradle versions,5,main]" is proceeding but "org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersions$LookupStrategy" may not be fully initialized. Unable to acquire the state change lock for the module: osgi.identity; type="osgi.bundle"; version:Version="3.1.5.v20210112-1646-s"; osgi.identity="org.eclipse.buildship.core"; singleton:="true" [id=14] STARTED [STARTED] org.osgi.framework.BundleException: Unable to acquire the state change lock for the module: osgi.identity; type="osgi.bundle"; version:Version="3.1.5.v20210112-1646-s"; osgi.identity="org.eclipse.buildship.core"; singleton:="true" [id=14] STARTED [STARTED]     at org.eclipse.osgi.container.Module.lockStateChange(Module.java:350)     at org.eclipse.osgi.container.Module.start(Module.java:419)     at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:511)     at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:117)     at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:572)     at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:345)     at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:401)     at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:480)     at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:170)     at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:519)     at org.eclipse.buildship.core.internal.util.gradle.PublishedGradleVersionsWrapper$LoadVersionsJob.run(PublishedGradleVersionsWrapper.java:60)     at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: java.util.concurrent.TimeoutException: Timeout after waiting 30 seconds to acquire the lock.     at org.eclipse.osgi.container.Module.lockStateChange(Module.java:347)     ... 11 more Caused by: org.eclipse.osgi.framework.util.ThreadInfoReport: Thread dump ... ----------------------------------  
    • Can someone please tell me why this is happening and help me find a solution. thanks. Edit: Nevermind I figured it out.
    • I am trying to store data through my ItemStack capability storage, but I stumbled upon a roadblock. My ItemStack Capability Storage: public class WandItemStorage implements Capability.IStorage<IWandCap> { @Nullable @Override public INBT writeNBT(Capability<IWandCap> capability, IWandCap instance, Direction side) { CompoundNBT tag = new CompoundNBT(); tag.put("spells", instance.getSpells()); return tag; } @Override public void readNBT(Capability<IWandCap> capability, IWandCap instance, Direction side, INBT nbt) { } } My ItemStack Capability: public class WandCap implements IWandCap { private List<Spell> spells; public WandCap () { spells = new ArrayList<>(); } @Override public List<Spell> getSpells() { return this.spells; } @Override public void addSpells(Spell... spells) { this.spells.addAll(Arrays.asList(spells)); } @Override public void addSpell(Spell spell) { this.spells.add(spell); } @Override public void removeSpells(Spell... spells) { this.spells.removeAll(Arrays.asList(spells)); } @Override public void removeSpell(Spell spell) { this.spells.remove(spell); } @Override public boolean containsSpell(Spell spell) { return this.spells.contains(spell); } } I'm currently trying to put a List of Spells (my custom object) to the Write and Read NBT methods of my ItemStack cap storage, but CompoundNBT doesn't have a method for putting a custom object into a tag. All it has is the put() method from what I'm seeing, however the put() method requires an INBT for the second parameter, which I do not have. Would I need to convert my List of Spells to an INBT, and how would I go about doing that?
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.