Jump to content



Recommended Posts

I've browsed the internet for ages now, and I cannot seem to find an answer.  I have an ore I just created (genericOre) and wanted to smelt it into an ingot (genericIngot) however I have no idea how I'm meant to use the addSmelting command.  If it helps, I was following the 'generic' tutorial on the wiki to the letter, until now when I thought I would try to smelt my new ore into the corresponding ingot.  The source is on the wiki, but I can post it up here later if needed.  Any help appreciated.

Link to comment
Share on other sites

From the wiki:


After you've put in the functions to add the ore to the library, then you just use:

GameRegistry.addSmelting(int itemID, ItemStack result, float experience);

like this:

GameRegistry.addSmelting(Block.stone.blockID, new ItemStack(Block.stoneBrick), 0.1f);


The first one must be a single itemID, because smelting only ever takes one item at a time. The second one is an item stack of one item, that is the result. The last value is the exp per smelting action.

Link to comment
Share on other sites

the wiki tut uses a standard block already in minecraft. i found i couldn't use (Block.genericBlock.blockID... as it would give me and error. genericBlock being my custom block.


however i used:


GameRegistry.addSmelting(this.genericBlock.blockID, new ItemStack(this.genericIngot), 0.5F);



and it seemed to work just fine. I've it used it successfully 4 times so far. I would be open to feed on if this is a good method for adding smelting recipes?

Link to comment
Share on other sites

Yeah, that is the way it's meant to be done. Nice catch Bishamonten.


Blocks.<block> is the vanilla minecraft way of storing all the blocks. When you create a new block it won't be in the vanilla list, so you have to access and use the blockID of the block you have created. This depends on where you've stored the reference to the block.


You can drop the keyword 'this' from the functions and it will still work.


Blakedut2: Also, I tried to find the code on the wiki, but I couldn't find it. Perhaps a link to it would be helpful next time, hint hint.

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.

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.


  • Create New...

Important Information

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