Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

No, the base directory is the mod jar. (I'm not sure if minecraft.jar files are included.) I don't know how to find files within the .minecraft folder but without the jar... I'd look in the Configuration code to see how it's done.

BEWARE OF GOD

---

Co-author of Pentachoron Labs' SBFP Tech.

  • Author

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");

  • Author

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?

  • Author

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.

  • Author

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.

  • Author

Ok, I found my problem, the file was reading out of the mcl jars folder not the src folder. I found that out by using f2.mkdir() and then locating the directory it created.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.