Jump to content

Minecraft Forge File Paths


TuxCraft

Recommended Posts

I want the mod I'm making to be very customizable by the user so when it loads I want it to check and if a file is present it will do something. I know I could use a config file to do something similar but I'd like to do something on a larger scale.  What would the correct file path be to find the files I want to check?

 

If I knew that I could then use something like this...

 

File f = new File("minecraft/forge/where/do/I/go");

if(f.exists()) {  }   

 

Does it start at the .minecraft folder and then go up? Is it different between the forge eclipse environment and actual game running environment? Also could I make it relative to the minecraft forge mods folder, that would be the easiest way because I can easily find my way from there.

 

And one more thing, will it have to go through all the steps to get to the %appdata% folder because I know that varies from computer to computer and if your using a launcher or not.

Link to comment
Share on other sites

So if I had a setup like this...

modName > modDeveloper > folderA > folderB

And folderA contained fileA and folderB contained fileB

 

And fileA was testing for fileB I'd do this...

File f = new File("/modDeveloper/folderA/fileB.class");

Link to comment
Share on other sites

So should that work in both the eclipse and normal environment? I tried using a .png so I didn't have to worry about the .class or .java difference and set it up pretty similar to my example but it didn't work. Another issue is that I'm using a folder instead of a .jar, would that make a difference?

Link to comment
Share on other sites

It is. I did a little trial and error so I went into one of my render files for one of my projectiles and right under the load texture I pasted the whole new file f deal and cope the file path exactly, when I ran mine craft the console told me f.exists = false. So that leads me to believe there is something in the mine craft code that adds something to the beginning of the file path, I did a little digging and couldn't find anything. I'll try looking a little harder and looking at how the Item and Block file paths work but I'm not sure if I'll find what I'm looking for there.

Link to comment
Share on other sites

Would there be a way to mimic the loadTexture code from rendering, turn it into a boolean value (If no texture is available false, if there is true) and put it in my core file. I would only be able to check images but that should still be fine.

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.