Jump to content

[1.14.4] How to get the file location of the current game


Elrol_Arrowsend

Recommended Posts

I am looking to save a json for use in my mod. And since it will contain information realting to the specific game/server I would need to save the file in different locations for each, or change my json to have different trees for each save. I think the easiest way would just be to change the file location, but if I cant, then I would want to get the name of the singleplayer worlds, to seperate the json files.


Any help is appreciated.

Link to comment
Share on other sites

3 minutes ago, Elrol_Arrowsend said:

Any help is appreciated.

If your data is World specific then you might want to use a Capability.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

2 minutes ago, Elrol_Arrowsend said:

Basically what I am making is a config file that is world dependent so that wouldn't work I dont think.

Ok that's a little more troubling. Also sounds a little inconvenient for the user. What configurations are you proposing? Maybe you should just put them in the Forge specified configs. Maybe a little thought to be put into this. Anyways new File(".") will give you the working directory, so new File(./saves) will give you the saves directory in SinglePlayer. And the World's name would be in World#getWorldInfo()

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

8 minutes ago, Elrol_Arrowsend said:

store configurations made while ingame

Oh well then a Capability would definitely work.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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.