Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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 :)

  • Author

What I want is to store the strings from the config file into an array list. Does that method do that?

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

  • 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.

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/

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

  • 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.

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/

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

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/

  • 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?

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

  • 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.

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.