Jump to content

[1.8] | Item recipes with modded items


Scrapnix

Recommended Posts

Hey, I want to make a recipe with modded items. My basic recipe is:

public static void addRecipes(){
	ItemStack lavablock = new ItemStack(Main.lavablock);
	ItemStack lavaingot = new ItemStack(Main.lavaingot);

	GameRegistry.addRecipe(lavablock, "lll", "lll", "lll", 'l', lavaingot);
}

 

I registered the method in my main class and recipies without my modded items are working.

The Class of the lavablock is:

public class LavaBlock extends Block{

private final String name = "lavablock";
public LavaBlock(){
	super(Material.rock);
	setUnlocalizedName(Main.MODID + "_" + name);
	setCreativeTab(Main.CreativeTab1);
	GameRegistry.registerBlock(this, name);
}

public String getName(){
	return name;
}

}

The class of the lavaingot is the same one, but only for items.

In my Main class are the items / blocks registered like so:

    public static Block lavablock;
             public static Item lavaingot;


@EventHandler
    public void preInit(FMLPreInitializationEvent e) {
  	 	ModRecipes.addRecipes();
    }

@EventHandler
    public void init(FMLInitializationEvent e) {
    	lavablock = new LavaBlock();
    	lavaingot = new LavaIngot();
if(e.getSide() == Side.CLIENT)
           {
          //... ItemModelMesher register 

 

I hope for help :D

Battlemac

Link to comment
Share on other sites

Items need to be initialized in preInit not init. The problem you are facing is that you are trying to add a recipe for Items that don't exist yet. Also stop using ItemModelMesher instead use ModelLoader.setCustomModelResourceLocation

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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