Jump to content

Recommended Posts

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.

Posted

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?

Posted

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.

Posted

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/

Posted

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

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