Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.12.2] Smelting Recipes for Ore Variants


TestBaker
 Share

Recommended Posts

Good day fellow Modders,

after some succesfull days of coding, I have run into a new problem:

For my new Mod, I have created ores using variants, meaning I haven't initialized every specific ore from a basic ore-class. I just initialized a ore for the overworld and nether. The specific ores are then generated using variants.

This  works perfectly, the problem is about the smelting: the addSmelting method (for block) needs a block input. I have no idea how I can correctly specify my ore variant inside the method, so that it gets accepted.

Maybe using the getBlockbyID method?

 

Link to comment
Share on other sites

There was a pull request to add proper recipe support to the furnace, but it did not get accepted.

You can achieve this today as follows:

  • Use OreDictionary.getOres(<name>, false) at startup to get a list of ores registered for a name. Then register your recipe for all of them.
  • Subscribe to OreDictionary.OreRegisterEvent to get notified when new entries are added after you have created the initial set of recipes. When this event fires for an ore name you care about, add your recipe for the new ore, too.

 

Edit: I am an idiot. Use FurnaceRecipes::addSmeltingRecipe(ItemStack, ItemStack, float).

 

Edited by diesieben07
Link to comment
Share on other sites

Show more of your code.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

18 minutes ago, TestBaker said:

Here is an example:

GameRegistry.addSmelting(BlockInit.ore_world.getDefaultState().withProperty(BlockOres.VARIANT, EnumHandler.EnumType.tin).getBlock(), new ItemStack(ItemInit.tiningot), 1.0f);

withVariant() and getBlock() are counter to each other.

withVariant() defines which variant (and thus metadata) to use.

getBlock() strips metadata information.

 

If you want to register a variant block as a recipe, you need to get the item stack of that variant. Presumably you have a getDrops() or getPickBlock() method overridden in your block class that will do that.

 

Also, this button is for inline code:

tt.png

Edited by Draco18s
  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

13 minutes ago, Draco18s said:

withVariant() and getBlock() are counter to each other.

withVariant() defines which variant (and thus metadata) to use.

getBlock() strips metadata information.

 

If you want to register a variant block as a recipe, you need to get the item stack of that variant. Presumably you have a getDrops() or getPickBlock() method overridden in your block class that will do that.

 

Also, this button is for inline code:

tt.png

Thank you for the answer and explanation. I'll try it my getPickBlock() method of the base class and report in later.

Link to comment
Share on other sites

3 minutes ago, TestBaker said:

After multiple tries I started using vanilla items to see if the problem is with the registration.

Have a look at it:

vanilla in- and output, written directly inside the Init of the Main class. It doesn't work.

 

Screenshot (4).png

Well, seppuku is the only way to go for me now...

I realized, that I forgot the EventHandler for Init...

  • Like 1
Link to comment
Share on other sites

3 hours ago, TestBaker said:

Case closed.

Thank u for the help.

The only problem was the missing @EventHandler over Init.

@Draco18sgetBlock() doesn't strip of the metadata, it works perfectly fine now . :D

If it doesn't, then why does IBlockState exist?

And why would getStateFromMeta exist?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

After creating my own thread and looking through this one, I still have not figured out a clear answer to my problem. NO matter what I do with the code I cant give my separate Block Ore Variants smelting recipes that work. I just need an example that works because I cant get it to work despite my numerous hours of research and attempts.

 

error.png

Edited by landocchi
Link to comment
Share on other sites

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.

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

 Share



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.