Jump to content

Saving information from config file


kenny2810

Recommended Posts

Is there a method or any way to store the information in a config file into an array list? My mod is going to randomly give the player a random item which he will list in the config in the form: item.ingotIron

 

Here is how the config will look:

 

item.ingotIron

item.ingotGold

item.diamond

 

etc

 

Basically I want to be able to load those into an array list, and the rest has already been taken care of. Is it possible to do this using config files? Thanks in advance :)

Link to comment
Share on other sites

He means that how you are gonna get the item from the string in the value?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

What larsgerrits said.  Someone out there might know a method, but I haven't found one yet that works.  If you don't have one, you will need to look at a different method.

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

What larsgerrits said.  Someone out there might know a method, but I haven't found one yet that works.  If you don't have one, you will need to look at a different method.

 

Delpi, the whole point of moving away from ID numbering is that you can now look up registered items, entities, etc. by name String.  Like GoToLink says there is a registry method getObjectByName().

 

Basically the ItemRegistry, BlockRegistry, are FMLControlledNamespacedRegistry class which has the set and get object methods.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Hopefully he has better luck.  I tried using this for blocks and couldn't get it to work.  No matter how I put in the name, it wouldn't get the block.  Eventually I resorted to ID's again. 

Long time Bukkit & Forge Programmer

Happy to try and help

Link to comment
Share on other sites

I tried using this for blocks and couldn't get it to work.  No matter how I put in the name, it wouldn't get the block.

 

I'll have to look at this sometime. But I usually debug it by turning it around and instead of looking for a key I hope is there, instead try reading through the map and output all the keys that are there.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Link to comment
Share on other sites

Hopefully, Jabelar or someone else can help you.  I've tried it and gotten a long range of errors.

 

I did a pretty robust error log grabbing the name out of blocks I clicked on, then automatically tried about 10 variations to regrab the block from that name.  Nada.

 

I'm assuming the same issue with items.

 

I'm all ears, cause this would be far easier than the bs required to work in ID's now.

Long time Bukkit & Forge Programmer

Happy to try and help

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.