Jump to content

[1.7.10] [Solved] Getting a mod's config directory?


Recommended Posts

Posted

I'm making an api for one of my mods where they put the api in their mod's source folder (similar to the RedstoneFlux API) and perform a check that my mod is loaded then they can use it. Simple right? But now I'm running into a problem where I can't figure out how to get my mod's config directory without using FMLPreInitializationEvent event. If your wondering why I want to do this, it's because the api will edit some files in my mod's config folder and will not be able to access the rest of my mod's files because it will be in another mod's source. So, how would I do this?

Posted

I'm making an api for one of my mods where they put the api in their mod's source folder (similar to the RedstoneFlux API) and perform a check that my mod is loaded then they can use it. Simple right? But now I'm running into a problem where I can't figure out how to get my mod's config directory without using FMLPreInitializationEvent event. If your wondering why I want to do this, it's because the api will edit some files in my mod's config folder and will not be able to access the rest of my mod's files because it will be in another mod's source. So, how would I do this?

All you need is any directory or file inside minecraft folder or sub folders. After getting this file and it's path, you can with simple string manipulations find your mods config...

For that, i recommend you to check main classes (of mc, fml and forge)...

 

Also, there's completely other way of influencing one mod with another. Considering you have control over both - for you it's possible: Inter Mod Comms (messages sent between mods by forge).

Posted

Ya, thanks for the suggestion. I will be away from my code for a while because my computer's battery quit charging (I did a backup before it ran out of power, thankfully). So now it's a matter of putting the backup on another computer. Which isn't done yet. Oh btw, don't try to pry open a tablet to fix it, just don't. The screen shattered. :) Don't worry, my warranty was lapsed before I tried to replace the battery. lol

Posted

FMLPreInitializationEvent#getModConfigurationDirectory() gives the parent directory for the config.

So you can find the another mod's configuration file there.

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

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

Posted

Also, there's completely other way of influencing one mod with another. Considering you have control over both - for you it's possible: Inter Mod Comms (messages sent between mods by forge).

 

So, I got all my code moved and IntelliJ setup on my other computer.  I ran a test minecraft client and it works. So now I can edit my code. So how do I use Inter Mod Communications?

Posted

Ok, I figured it out, I was able to find a tutorial for Inter mod communication. Thanks everyone for your suggestions. :)

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.