Posted November 22, 201311 yr So I'm coding something that builds a list, from reading a txt file. The code itself works and has been tested outside of the realm of the Minecraft developing environment, but I can't get it to work correctly with Forge. I get a crash with file not found. So I was wondering if anyone knew what path I should be adding to find the file? As in, should I use a file path using only MY MODS directories, or should I make it look all through the minecraft folders example: ./minecraft/mods/-mymod or can I simply have it it search locally with my file path only like: /com/morpheuszero/mods/name.txt etc etc? I've tried a few different ways and II can't get it to work because I don't know which directory Forge is running from to know where to put a file path to read my file....I'm doing it this way because the information in this file needs to be easily changed by other users to be able to add the output of this file to an array list so I don't have to recode it and make the array larger it just builds itself each launch as pertaining to each user of the mod.
November 22, 201311 yr If you use a MySQL Api it would be very very easy... Use someting like JDBC (Java DataBase Connection)
November 22, 201311 yr Author Well I already got the code working. That's not an issue, I just need some assistance with the correct file pathing solution to FIND the file in the code. I know how to do it within my own applications, but not within the Forge and Minecraft environment...
November 22, 201311 yr Minecraft#mcDataDir Links to Minecraft active folder. Then you can use whatever child path you want.
November 22, 201311 yr I don't know if you figured this out, but here is what I have found that seems to work. File myFile = FMLCommonHandler.instance().getMinecraftServerInstance().getFile("hello_world.txt"); System.out.println("Location: " + myFile.getAbsolutePath()); Output: 2013-11-22 17:48:37 [iNFO] [sTDOUT] Location: C:\Users\cody\forge_hardcore_mod\mcp\jars\.\hello_world.txt
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.