Jump to content

Recommended Posts

Posted

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?

 

Posted

REWIND!

Well, I'm now able to successfully reference my variant and Eclipse doesnt show any errors, but inGame it still doesnt work.

So far I have been using the addSmelting() of the GameRegistry.

FurnaceRecipes::addSmeltingRecipe(ItemStack, ItemStack, float) doesnt work

Posted

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.

Posted

Here is an example:

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

Posted (edited)
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.

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

Posted

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

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

Posted (edited)

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
Posted

 

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.

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.