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

Hello everyone,

 

Quick question, is there somewhere in the Minecraft src where I could find an array containing all items and all blocks?  I'd like to use something like it for a feature of my mod, so I don't have to copy and paste the same thing over and over with minimal changes.

 

Thank you in advance for any help you can give me.

  • Author

Thanks for the help, but I tried printing GameData.getBlockRegistry() to console and I got "cpw.mods.fml.common.registry.FMLControlledNamespacedRegistry@13437c7c".

 

Any idea what that means?

 

Edit:  Am I just doing this incorrectly?  And would you know how to put the blocks/items in an array?

What are you trying to do? Why do you need the array?

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

  • Author

I'm trying to find a way to get all of the vanilla items and blocks in a smelting recipe for a custom furnace.  The custom smelter I have takes the item/block and stores it inside of a different item by NBT for later use.

 

I think that writing out Items.whatever or Blocks.whatever and storing that in an array would be redundant, so I'm trying to look for a way around that.

Sorry if this is a noob-ish question, but how would I do so?

 

The registries are already an "array" (actually a map I think) that contains listing of all the blocks and items.  Like any map they have methods for retrieving all the entries.  Since this is a map, there are "keys" for each listing, so you don't just use ID numbers.  Instead you can use the general map techniques (like iterators) and I think you can additionally retrieve the list of keys and then iterate through that.

 

So I suggest that you get the set of all registered keys with something like GameData.getItemRegistry().getKeys().  That would actually give you all the registered items, so might be already what you need.

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

I'm trying to find a way to get all of the vanilla items and blocks in a smelting recipe for a custom furnace.  The custom smelter I have takes the item/block and stores it inside of a different item by NBT for later use.

 

I think that writing out Items.whatever or Blocks.whatever and storing that in an array would be redundant, so I'm trying to look for a way around that.

Why dont you jsut add a single recipe that takes any input and provides the correct output?

Seems like the way you want to do it is inefficient, both memory and processing wise. as well as does the naughty thing of trying to turn the registry into an array...

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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.