Jump to content

[SOLVED] Recipes don't work??


iKreal

Recommended Posts

Hello,

I'm making a new recipe (a Shaped recipe) but when I launch the game, the craft doesn't work...

In the CommonProxy class:

	public void init() {
        new ModRecipes().RegisterCraftRecipes();
	    }
	

In the ModRecipes class:

	package net.dev.premiermod.init;
	import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fml.common.registry.GameRegistry;
	public class ModRecipes {
	    public void RegisterCraftRecipes() {
    GameRegistry.addRecipe(new ItemStack(ModItems.pan), new Object[]{"III"," I ", 'I', Items.IRON_INGOT});
	}

}

And in the main class:

	    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent event) {proxy.preInit();}
	    public void init(FMLInitializationEvent event) {proxy.init();}
	

Everything should work, but the recipe doesn't! Do you have an idea of the problem?

Thank you :)

Edited by iKreal
[Solved]
Link to comment
Share on other sites

3 hours ago, jhdoran said:

Use the JSON recipe system whenever you can.  There are examples in the assets package of vanilla Minecraft.

I'm coding for Minecraft 1.10.2 and this is not the problem (I think so) :/

But is it possible to use JSON recipe system in 1.10 ?

Link to comment
Share on other sites

No, it was introduced later.

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

Ok so lets see here:

This looks good, but it's called from somewhere else.

	public void init() {
        new ModRecipes().RegisterCraftRecipes();
	    }
	

And that place happens to be here:

	    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent event) {proxy.preInit();}
	    public void init(FMLInitializationEvent event) {proxy.init();}
	

Which might look fine, but it's not. Lets remove the code that doesn't interest us.

public void init(FMLInitializationEvent event) {proxy.init();}

Hold on a minute. Where is this called from?

Nowhere, that's where!

You're missing the EventHandler annotation on your init method.

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