Posted May 30, 201411 yr 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
May 30, 201411 yr Author What I want is to store the strings from the config file into an array list. Does that method do that?
May 30, 201411 yr Author Cheers. Ive never used config files before, so I am not sure how its methods works. Thanks again
May 30, 201411 yr What are you going to do with that string once you get it into your Array? How are you going to take that and translate it into an item? Long time Bukkit & Forge Programmer Happy to try and help
May 30, 201411 yr Author What are you going to do with that string once you get it into your Array? How are you going to take that and translate it into an item? I will be using an arraylist, not an array if I can.
May 30, 201411 yr 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/
May 30, 201411 yr 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
May 30, 201411 yr Author Hmm Im testing it right now to see if it works. Ill post back as soon as I know more. I have considered an alternate method, but it is a lot more complex and frankly not worth the extra effort.
May 30, 201411 yr Author That may work; If I can store that data into the arraylist then I should have no issues
May 30, 201411 yr 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/
May 31, 201411 yr 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
May 31, 201411 yr 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/
May 31, 201411 yr Author GameData.itemRegistry.getObjectByName(String) I seem to be getting an error with the itemRegistry; Here is the error: itemRegistry cannot be resolved or is not a field Any idea what could be causing this?
May 31, 201411 yr 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
May 31, 201411 yr Author At this point im willing to try anything. Also I am doing this in 1.6.4, sorry I didnt clarify earlier, butI mostly work on the code late at night and it kept slipping my mind.
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.