Jump to content

[1.8] [Resolved] Minecraft default pathname and good practice ?


Recommended Posts

Posted

Is there something I can call inside code to return the default minecraft pathname ?

 

I need to save some subfolders and files subfolders and I want to be able to easily get to the /Mods/<ModName> directory.

 

What is good practice Mod practice if you have to do this ? (e.g. create the base directory for and save files for the mod would be Mods/<Modname>  ?

 

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

Posted

My utility:

 

public static File getMcDir()
{
if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDedicatedServer())
{
	return new File(".");
}
return Minecraft.getMinecraft().mcDataDir;
}

 

Note: Returns /.minecraft/ for client and /server_folder/ for dedic.

1.7.10 is no longer supported by forge, you are on your own.

Posted

My utility:

 

public static File getMcDir()
{
if (MinecraftServer.getServer() != null && MinecraftServer.getServer().isDedicatedServer())
{
	return new File(".");
}
return Minecraft.getMinecraft().mcDataDir;
}

 

Note: Returns /.minecraft/ for client and /server_folder/ for dedic.

 

Just what the doctor ordered !  :)

 

I'll add that to my generic utililty stuff....

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

Posted

I'm also assuming (dangerous I know) that I use the /Mods directory and make a sub directory of that with my mod name as a place to hold my needed folders.

 

If this is wrong, please let me know :D

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

Posted

If I don't use a subfolder off of the Mod folder where do I put the default folder for the mod ?

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

Posted

Its a place where I put files that my mod generates (which can have a few subfolders if neccesary).

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

Posted

My mod generates data that needs to be saved so it can be recalled later (structures etc), so  basically user generated text files and potential subfolders with those files in it.....

 

So, to restate clearer:

 

Where do you put user generated files (generated by the mod) so that they don't clobber something else ?

 

It would seem to make sense to put is as a subdirectory to your mod where ever you place your mod files, but , if not there, then where is the best place to put these (as a named subdirectory off the root would seem kind of  inappropriate) ?

 

 

 

 

 

 

 

 

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

Posted

This is like REALLY mod-specific question. You can put data anywhere you want.

 

I personally do it in /.minecraft/MyModFoler/myData.something

 

Diesieben just said that your /mods/ should not contain anything other than mods.

1.7.10 is no longer supported by forge, you are on your own.

Posted

So I'll put it in a folder of my own creation of the root....

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

Posted

Can you please clarify ? I don't see a "world" folder under my minecraft (I am running a few mods now)....

 

If you mean by a save file, then it is not specific to that particular world per se but used by the mod to generate stuff.....

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

Posted

Then this thread is truly resolved then :D

 

I hope it is of use to any future modders......

I don't keep an open mind lest someone try to fill it with garbage - Mark Twain

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.