Jump to content

[1.8] Custom text file IO best practices ?


DJD

Recommended Posts

I was wondering what the best way to save/read generated  files so that the user can edit them manually. Do I use a property file ? Or do I mess around with generic text files ?

 

The file will contain an element consisting of single fields  (such as "name") and some variable length 3 dimensional arrays. This is one "record" in the file, but it can contain multiple elements as well.

 

I could do it as a binary but I want the user to be able to edit its contents in notepad or some such so I don't have to create a utility to read/mod it.

 

Also, where is the proper place for mod writers to place their generated files (in terms of minecraft/mods) ?

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

Link to comment
Share on other sites

I was wondering what the best way to save/read generated  files so that the user can edit them manually. Do I use a property file ? Or do I mess around with generic text files ?

 

The file will contain an element consisting of single fields  (such as "name") and some variable length 3 dimensional arrays. This is one "record" in the file, but it can contain multiple elements as well.

 

I could do it as a binary but I want the user to be able to edit its contents in notepad or some such so I don't have to create a utility to read/mod it.

 

Also, where is the proper place for mod writers to place their generated files (in terms of minecraft/mods) ?

Why do you need a 3D array?

The right format would probably be minecraft/yourmod/filename.txt

Maker of the Craft++ mod.

Link to comment
Share on other sites

I could do 1 dimensional arrays for batches of  data at x,y,z coords (which I'll probably do) but the coding gets a bit more "cluttered" than I like.

 

Really its more a preference to keep learning stuff I'm not wholly comfortable with and keep my skills up (including getting used to Eclipse as an IDE).

 

I probably will settle on a sequential access file type structure for my mod. The downside is it won't be as readable as a Property file, but it should still be hand-editable.....

 

Now if I can only get my Eclipse to stop fighting me when I'm coding  ! :D

 

 

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

Link to comment
Share on other sites

Heheh :D .

 

I thought of that but it seems so many folks use Eclipse I thought I'd go with something a lot of other folks seem to be using.

 

And why the heck don't they have #Regions like C++ does so you can group methods without having to scroll through them (even reduced with the + some classes require FAR to much scrolling through)...  /Rant Done

 

But to stay on topic (too late, I know) but here's another dumb question:

 

Some of the writing I think requires me to use JRE 1.7 code, is that compatable with Forge ? Or does it matter since its compiled anyway ?

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

Link to comment
Share on other sites

Still flailing a little with Eclipse (this is off a fresh install so I kept my messing with things to a minimum). I guess I could play with the compiler settings if I get a little more froggy......

 

I'll try to make everything work in 1.6 just to be safe.......

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

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.