Jump to content

Recommended Posts

Posted

This snippet of code came from a 1.11 mod I'm trying to use to create a gui config.  I think maybe the code was changed between 1.11 and 1.12 as it's telling me it can't me resolved.

 

package com.fuzzybat23.csbr.config;

import java.util.Set;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.fml.client.IModGuiFactory;

public class GuiFactory implements IModGuiFactory
{
    @Override
    public void initialize(Minecraft minecraftInstance)
    {   }

    @Override  <---- Error 1
    public Class<? extends GuiScreen> mainConfigGuiClass()
        {
        return GuiModConfig.class;
    }

    @Override <---- Error 2
    public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()  <---- Error 3
    {
        return null;
    }

    @Override
    public RuntimeOptionGuiHandler getHandlerFor(RuntimeOptionCategoryElement element)
    {
        return null;
    }

    @Override
    public boolean hasConfigGui()
    {
        return true;
    }

    @Override
    public GuiScreen createConfigGui(GuiScreen parentScreen)
    {
        return new GuiModConfig(parentScreen);
    }

}

Error 1 and Error 2 say "Method does not override method from its superclass."

 

Error 3 is in reference to RuntimeOptionGuiHandler and says "Cannot resolve symbol 'RuntimeOptionGuiHandler'

 

Any one know if this has been changed?  This GuiFactory is a direct copy of another person's code that does compile, as far as I know, as his mod has been released with no errors.

 

mainConfigGuiClasss refers to net.minecraftforge.fml.client.config.GuiConfig.java which reads:

 

    public GuiConfig(GuiScreen parentScreen, String modID, boolean allRequireWorldRestart, boolean allRequireMcRestart, String title,
            Class<?>... configClasses)
    {
        this(parentScreen, collectConfigElements(configClasses), modID, null, allRequireWorldRestart, allRequireMcRestart, title, null);
    }

 

and the new GuiModConfig.java in my mod directory reads:

 

package com.fuzzybat23.csbr.config;

import com.fuzzybat23.csbr.CSBR;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.fml.client.config.GuiConfig;

public class GuiModConfig extends GuiConfig {
    public GuiModConfig(GuiScreen parent) {
        super(
                parent,
                new ConfigElement(CSBR.instance.config.file.getCategory("general")).getChildElements(),
                CSBR.MODID,
                false,
                false,
                GuiConfig.getAbridgedConfigPath(CSBR.instance.config.file.toString())
        );
    }
}

 

Posted
10 minutes ago, fuzzybat23 said:

Error 1 and Error 2 say "Method does not override method from its superclass."

 

Those particular methods have been deleted as they've been deprecated for a while now.

 

11 minutes ago, fuzzybat23 said:

Error 3 is in reference to RuntimeOptionGuiHandler and says "Cannot resolve symbol 'RuntimeOptionGuiHandler'

 

RuntimeOptionGuiHandler was deleted as, quoting the javadocs for RuntimeOptionGuiHandler from 1.11 code:

TODO remove in 1.11 - this was never fully implemented and will be removed

And it also was deprecated btw.

 

 

Posted

Actually, mainConfigGuiClass wasn't deleted, it was renamed.  It's still in IModGuiFactory, but as createConfigGui.

 

The old ->
public Class<? extends GuiScreen> mainConfigGuiClass();


    /**
     * Return a list of the "runtime" categories this mod wishes to populate with
     * GUI elements.
     *
     * Runtime categories are created on demand and organized in a 'lite' tree format.
     * The parent represents the parent node in the tree. There is one special parent
     * 'Help' that will always list first, and is generally meant to provide Help type
     * content for mods. The remaining parents will sort alphabetically, though
     * this may change if there is a lot of alphabetic abuse. "AAA" is probably never a valid
     * category parent.
     *
     * Runtime configuration itself falls into two flavours: in-game help, which is
     * generally non interactive except for the text it wishes to show, and client-only
     * affecting behaviours. This would include things like toggling minimaps, or cheat modes
     * or anything NOT affecting the behaviour of the server. Please don't abuse this to
     * change the state of the server in any way, this is intended to behave identically
     * when the server is local or remote.
     *
     * @return the set of options this mod wishes to have available, or empty if none
     */

The New ->
    public GuiScreen createConfigGui(GuiScreen parentScreen);

    /**
     * Return a list of the "runtime" categories this mod wishes to populate with
     * GUI elements.
     *
     * Runtime categories are created on demand and organized in a 'lite' tree format.
     * The parent represents the parent node in the tree. There is one special parent
     * 'Help' that will always list first, and is generally meant to provide Help type
     * content for mods. The remaining parents will sort alphabetically, though
     * this may change if there is a lot of alphabetic abuse. "AAA" is probably never a valid
     * category parent.
     *
     * Runtime configuration itself falls into two flavours: in-game help, which is
     * generally non interactive except for the text it wishes to show, and client-only
     * affecting behaviours. This would include things like toggling minimaps, or cheat modes
     * or anything NOT affecting the behaviour of the server. Please don't abuse this to
     * change the state of the server in any way, this is intended to behave identically
     * when the server is local or remote.
     *
     * @return the set of options this mod wishes to have available, or empty if none
     */

So get rid of the runtime handler completely, eh?  Well, as for the other one which was renamed, not deleted, I redid the code as:

    @Override
    public Class<? extends GuiScreen> createConfigGui()
    {
        return ConfigGui.class;
    }

It throws the same error though.  Should I just erase that line, as well, and delete the GuiModConfig.java file and add it directly into the GuiFactory?

 

package com.fuzzybat23.csbr.config;

import java.util.Set;

import com.fuzzybat23.csbr.CSBR;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.common.config.ConfigElement;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.fml.client.IModGuiFactory;
import net.minecraftforge.fml.client.config.GuiConfig;

public class GuiFactory implements IModGuiFactory
{
    @Override
    public void initialize(Minecraft minecraftInstance)
    {   }

  //  @Override
  //  public Class<? extends GuiScreen> createConfigGui()
  //  {
  //      return ConfigGui.class;
  //  }

    @Override
    public Set<RuntimeOptionCategoryElement> runtimeGuiCategories()
    {
        return null;
    }

    @Override
    public boolean hasConfigGui()
    {
        return true;
    }

    @Override
    public GuiScreen createConfigGui(GuiScreen parentScreen)
    {
        return new ConfigGui(parentScreen);
    }

    public static class ConfigGui extends GuiConfig
    {
        public ConfigGui(GuiScreen parent)
        {
            super(parent, new ConfigElement(CSBR.instance.config.file.getCategory(Configuration.CATEGORY_GENERAL)).getChildElements(),
                    CSBR.MODID, false, false,
                    GuiConfig.getAbridgedConfigPath(CSBR.instance.config.file.toString()));
        }
    }
}

 

Posted
7 minutes ago, fuzzybat23 said:

Actually, mainConfigGuiClass wasn't deleted, it was renamed.  It's still in IModGuiFactory, but as createConfigGui.

No it was deleted, look at the signatures:

1.11:

public Class<? extends GuiScreen> mainConfigGuiClass();

 

1.12

public GuiScreen createConfigGui(GuiScreen parentScreen);

 

How is that renamed? The return type changed, a parameter had been introduced and the name is different. This does not look like a rename to me. Especially considering the fact that 1.11 has the createConfigGui method with the exact 1.12 signature.

 

9 minutes ago, fuzzybat23 said:

It throws the same error though.

Yes it does. There is no 

public Class<? extends GuiScreen> createConfigGui()

method for you to override or implement in the interface.

 

Your last code attachment looks fine to me.

Posted

Well, it compiles just fine.  I ran the other mod that has the original code and it's config screen opens just fine.  Mine doesn't crash when I click on the Config button,but it does throw this:

 

[19:35:13] [main/ERROR] [FML]: There was a critical issue trying to build the config GUI for csbr
java.lang.NullPointerException: null
	at com.fuzzybat23.csbr.config.GuiFactory$ConfigGui.<init>(GuiFactory.java:47) ~[GuiFactory$ConfigGui.class:?]
	at com.fuzzybat23.csbr.config.GuiFactory.createConfigGui(GuiFactory.java:40) ~[GuiFactory.class:?]
	at net.minecraftforge.fml.client.GuiModList.actionPerformed(GuiModList.java:301) [GuiModList.class:?]
	at net.minecraft.client.gui.GuiScreen.mouseClicked(GuiScreen.java:494) [GuiScreen.class:?]
	at net.minecraftforge.fml.client.GuiModList.mouseClicked(GuiModList.java:205) [GuiModList.class:?]
	at net.minecraft.client.gui.GuiScreen.handleMouseInput(GuiScreen.java:611) [GuiScreen.class:?]
	at net.minecraftforge.fml.client.GuiModList.handleMouseInput(GuiModList.java:351) [GuiModList.class:?]
	at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:576) [GuiScreen.class:?]
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1861) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1171) [Minecraft.class:?]
	at net.minecraft.client.Minecraft.run(Minecraft.java:436) [Minecraft.class:?]
	at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_131]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
	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_131]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_131]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_131]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_131]
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
	at GradleStart.main(GradleStart.java:26) [start/:?]

 

Posted
3 minutes ago, fuzzybat23 said:

java.lang.NullPointerException: null at com.fuzzybat23.csbr.config.GuiFactory$ConfigGui.<init>(GuiFactory.java:47) ~[GuiFactory$ConfigGui.class:?]

Well, something in your ConfigGui constructor is null. Try setup a breakpoint to figure out what. The potential culprits are:

19 minutes ago, fuzzybat23 said:

CSBR.instance

19 minutes ago, fuzzybat23 said:

CSBR.instance.config

19 minutes ago, fuzzybat23 said:

CSBR.instance.config.file

 

 

Posted

My main class is:

package com.fuzzybat23.csbr;

import com.fuzzybat23.csbr.config.ConfigManager;

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

import java.io.File;

@net.minecraftforge.fml.common.Mod(modid = "csbr", version = "1.0", clientSideOnly = true, acceptedMinecraftVersions = "[1.12, 1.13)", guiFactory = "com.fuzzybat23.csbr.config.GuiFactory")
public class CSBR
{
    @net.minecraftforge.fml.common.Mod.Instance("CSBR")
    public static final String MODID = "csbr";

    public static CSBR instance;
    public ConfigManager config;

    public CSBR()
    {   }

    @Mod.EventHandler
    @SideOnly(Side.CLIENT)
    public void preInit(FMLPreInitializationEvent event)
    {
        config = new ConfigManager(event.getModConfigurationDirectory());
    }

    @Mod.EventHandler
    @SideOnly(Side.CLIENT)
    public void initialize(FMLInitializationEvent event)
    {
        MinecraftForge.EVENT_BUS.register(this);
        MinecraftForge.EVENT_BUS.register(config);

    }


    @Mod.EventHandler
    @SideOnly(Side.CLIENT)
    public void load(FMLInitializationEvent event)
    {

    }
}

I can't figure out where that null is coming from xD

Posted
9 hours ago, fuzzybat23 said:

public static CSBR instance;

This field is null and you never assign anything to it.

 

9 hours ago, fuzzybat23 said:

@net.minecraftforge.fml.common.Mod.Instance("CSBR")

public static final String MODID = "csbr";

An Instance annotation goes over a field you want an instance of your mod to be injected into, not over the field that contains your modid.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • When i try to join my friends server with mods it just says failed to log in: the authentication servers are currently not reachable. I've been having this issue for a while now and no method I've tried to fix it works. I've seen a lot of people fixing it by modifying the host.txt file and removing anything related to Mojang but when I open mine there's nothing related to Mojang there. I also tried flushing DNS cache, and changing my IPV6 to 8888, but nothing works.  It only happens when the mods are on too. When I join my friends server on vanilla it works, but not with mods. I can join multiplayer servers like hypixel. I can also play singleplayer with the mods and it works perfectly. The mods are up to date with the versions and the servers, but it just never gets past "Logging in" when i try to join their server. I use Curseforge to launch my mods, so that could maybe have something to do with it because it's technically a third party server, but it hasn't given me any trouble besides this one issue. I do not have MCLeaks and don't know what that is, but how can i search for it anyway to make sure? I have uninstalled minecraft launcher, updated my microsoft and my videocard drivers, reset my wifi and checked my parental settings (I am the owner on my computer), flushed my dns, modifying my host file to delete mojang but there's nothing with mojang on there, disabled my firewall, changed my IPV6 domain to 8888, restarted my router, and none of that works. I have researched this issue thoroughly and tried every solution I have came across and nothing is fixing the problem so i have come here as a last ditch effort. All i want to do is play mods with my friend. My friend has no issues with the server or mods and he has it through curseforge too. I would like further assistance in any way you think could help or even refer me to another forum that could help with this. Genuinely I cannot figure out why it doesn't work I would love any sort of further help.  
    • been getting this error and followed the old tick loop post however i cant figure out what file to delete Description: Exception in server tick loop java.lang.NullPointerException: Cannot invoke "net.minecraft.world.level.LevelAccessor.m_7654_()" because the return value of "net.minecraftforge.event.level.LevelEvent$Unload.getLevel()" is null     at com.lion.graveyard.platform.forge.HordeSpawner.onWorldUnload(HordeSpawner.java:41) ~[The_Graveyard_3.1_(FORGE)_for_1.20.1.jar%23196!/:?] {re:classloading}     at com.lion.graveyard.platform.forge.__HordeSpawner_onWorldUnload_Unload.invoke(.dynamic) ~[The_Graveyard_3.1_(FORGE)_for_1.20.1.jar%23196!/:?] {re:classloading,pl:eventbus:B}     at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.mehvahdjukaar.moonlight.api.platform.forge.PlatHelperImpl.invokeLevelUnload(PlatHelperImpl.java:279) ~[moonlight-1.20-2.13.66-forge.jar%23185!/:?] {re:classloading}     at net.mehvahdjukaar.moonlight.api.platform.PlatHelper.invokeLevelUnload(PlatHelper.java) ~[moonlight-1.20-2.13.66-forge.jar%23185!/:?] {re:mixin,re:classloading}     at net.mehvahdjukaar.moonlight.core.misc.FakeLevelManager.invalidate(FakeLevelManager.java:29) ~[moonlight-1.20-2.13.66-forge.jar%23185!/:?] {re:classloading}     at net.mehvahdjukaar.supplementaries.common.utils.fake_level.BlockTestLevel.invalidate(BlockTestLevel.java:34) ~[supplementaries-1.20-3.1.13.jar%23192!/:?] {re:classloading}     at net.mehvahdjukaar.supplementaries.common.block.faucet.FaucetBehaviorsManager.onReloadWithLevel(FaucetBehaviorsManager.java:129) ~[supplementaries-1.20-3.1.13.jar%23192!/:?] {re:classloading}     at net.mehvahdjukaar.supplementaries.common.events.ServerEvents.onServerStart(ServerEvents.java:160) ~[supplementaries-1.20-3.1.13.jar%23192!/:?] {re:mixin,re:classloading}     at net.mehvahdjukaar.supplementaries.common.events.forge.ServerEventsForge.onServerStart(ServerEventsForge.java:119) ~[supplementaries-1.20-3.1.13.jar%23192!/:?] {re:classloading}     at net.mehvahdjukaar.supplementaries.common.events.forge.__ServerEventsForge_onServerStart_ServerStartedEvent.invoke(.dynamic) ~[supplementaries-1.20-3.1.13.jar%23192!/:?] {re:classloading,pl:eventbus:B}     at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.5.jar%2352!/:?] {}     at net.minecraftforge.server.ServerLifecycleHooks.handleServerStarted(ServerLifecycleHooks.java:115) ~[forge-1.20.1-47.3.29-universal.jar%23212!/:?] {re:classloading}     at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:638) ~[server-1.20.1-20230612.114412-srg.jar%23207!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraftserver,xf:fml:xaerominimap:xaero_minecraftserver,re:classloading,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraftserver,xf:fml:xaerominimap:xaero_minecraftserver,pl:mixin:APP:unionlib.mixins.json:MinecraftServerMixin,pl:mixin:APP:citadel.mixins.json:MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:A}     at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[server-1.20.1-20230612.114412-srg.jar%23207!/:?] {re:mixin,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraftserver,xf:fml:xaerominimap:xaero_minecraftserver,re:classloading,pl:accesstransformer:B,xf:fml:xaeroworldmap:xaero_wm_minecraftserver,xf:fml:xaerominimap:xaero_minecraftserver,pl:mixin:APP:unionlib.mixins.json:MinecraftServerMixin,pl:mixin:APP:citadel.mixins.json:MinecraftServerMixin,pl:mixin:APP:balm.mixins.json:MinecraftServerMixin,pl:mixin:A}     at java.lang.Thread.run(Thread.java:833) ~[?:?] {}  
    • Online forums in general seem to be declining in popularity imo. There’s still value here for certain types of content, such as written tutorials and blog posts which would otherwise get lost in the chat history fairly quickly on Discord. Also for those that prefer the forums format ofc. But for faster support related topics, I agree that the Discord is probably your best bet at the moment. The speed of responses is also down to the ratio of volunteers - the player support forum still seems pretty active, but the coding ones much less so. Once you’re feeling more confident in your modding skills, be the change you want to see
    • try the same link, i swapped logs after sitting in the world for a few minutes then leaving. Lmk if it keeps happening then ill just send a video of the live log on modrinth
    • It is an issue with chimes
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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