Jump to content

Cannot make static reference: Mod.name()


Lycanus Darkbinder

Recommended Posts

Forge 7.8.1.738, Minecraft 1.5.2

 

I'm trying to use Mod.name() to print the name of the mod in a debug message using System.out.println but I keep getting this error:

 

Cannot make a static reference to the non-static method name() from the type Mod

 

In the past you used to be able to reference modid, name and version from the Mod class. Several tutorials I've seen use this in registerIcons() to refer to the mod package. Is this no longer possible?

Link to comment
Share on other sites

That message is pretty self explanatory. Basic java: You can't call a non-static method without an instance available.

 

I understand the message, but how do you expose the Mod.name, Mod.modid and Mod.version information that gets set in the main class file? I would think that as soon as @PreInit is called an instance of the main class has been created.

 

Obviously it's available somewhere because it gets listed in the "Mods" list in the Minecraft GUI.

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.