Jump to content

Help with custom crafting recipes


Gurman8r

Recommended Posts

So I just started using forge to make mods (I use to just use ModLoder) but I've come across an issue. If I want to add smelting or crafting recipes using my custom items/blocks it crashes my game.

 

Here's some examples of recipes I've tried adding.

 

GameRegistry.addSmelting(Block.bedrock.blockID, new ItemStack(tes_BaseMod.moonstone), 100);

 

                GameRegistry.addRecipe(new ItemStack(tes_BaseMod.moonstone, 1), new Object[]{
                	" X ", " X ", "XXX", Character.valueOf('X'), Block.blockClay, Character.valueOf('P'), Item.paper
                });

-

 

- My main mod class is tes_BaseMod.

 

- Bedrock is there just as an example.

 

- If I replace tes_BaseMod.moonstone with a vanilla block/item it works.

 

- What would I add into both highlighted area to make them work with custom blocks/items???

 

-

Link to comment
Share on other sites

just do it like this

 

                GameRegistry.addRecipe(new ItemStack(tes_BaseMod.moonstone, 1), new Object[]{
                	" X ", " X ", "XXX", 'X', Block.blockClay, 'P', Item.paper
                });

 

and this

GameRegistry.addSmelting(Block.bedrock.blockID, new ItemStack(this.moonstone), 100);

Link to comment
Share on other sites

just do it like this

 

                GameRegistry.addRecipe(new ItemStack(tes_BaseMod.moonstone, 1), new Object[]{
                	" X ", " X ", "XXX", 'X', Block.blockClay, 'P', Item.paper
                });

 

and this

GameRegistry.addSmelting(Block.bedrock.blockID, new ItemStack(this.moonstone), 100);

 

I tried both of those and my game continues crashing. Here's the entitre tes_BaseMod file because ive looked at coutless tutorials and after following them I still keep crashing.

 

package gurman8r.tescraft.src;

//Imports
import net.minecraft.block.Block;
import net.minecraft.block.BlockHalfSlab;
import net.minecraft.block.BlockStairs;
import net.minecraft.block.BlockStep;
import net.minecraft.block.BlockTorch;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraftforge.common.MinecraftForge;

import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;



@Mod(modid="tesCraft", name="TES Craft", version="0.0.1")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class tes_BaseMod<daedricIngot> {

        // The instance of your mod that Forge uses.
        @Instance("tesCraft")
        public static tes_BaseMod instance;
        
        // Says where the client and server 'proxy' code is loaded.
        @SidedProxy(clientSide="gurman8r.tescraft.client.ClientProxy", serverSide="gurman8r.tescraft.CommonProxy")
        public static CommonProxy proxy;
        
        @PreInit
        public void preInit(FMLPreInitializationEvent event) 
        {
                // Stub Method
        }
        
        @Init
        public void load(FMLInitializationEvent event) 
        {
                proxy.registerRenderers();
                
                //TES Craft Creative Tab
                LanguageRegistry.instance().addStringLocalization("itemGroup.tabTesCraft", "en_US", "TES Craft");
                
                /**
                 * Put recipes here:
                 */
                GameRegistry.addSmelting(Block.bedrock.blockID, new ItemStack(this.moonstone), 100);
                
                GameRegistry.addRecipe(new ItemStack(tes_BaseMod.moonstone, 1), new Object[]{
                	" X ", " X ", "XXX", 'X', Block.blockClay, 'P', Item.paper
                });

                /**
                 * Put blocks here:
                 */
                final Block tesForge = new BlockForge(500, 0, Material.rock).setHardness(3.5F).setResistance(5.0F).setBlockName("tesForge").setCreativeTab(this.tabTesCraft);
                GameRegistry.registerBlock(tesForge, "tesForge");
                LanguageRegistry.addName(tesForge, "Forge");
                
                final Block moonstoneOre = new BlockMoonstoneOre(517, 16, Material.rock).setHardness(5.0F).setResistance(5.0F).setBlockName("moonstoneOre").setCreativeTab(this.tabTesCraft);
                GameRegistry.registerBlock(moonstoneOre, "moonstoneOre");
                LanguageRegistry.addName(moonstoneOre, "Moonstone Ore");
                MinecraftForge.setBlockHarvestLevel(moonstoneOre, "pickaxe", 0);
                
                final Block malachiteOre = new BlockMalachiteOre(518, 17, Material.rock).setHardness(10.0F).setResistance(5.0F).setBlockName("malachiteOre").setCreativeTab(this.tabTesCraft);
                GameRegistry.registerBlock(malachiteOre, "malachiteOre");
                LanguageRegistry.addName(malachiteOre, "Malachite Ore");
                MinecraftForge.setBlockHarvestLevel(malachiteOre, "pickaxe", 0);
                
                final Block orichalcumOre = new BlockOrichalcumOre(519, 18, Material.rock).setHardness(15.0F).setResistance(5.0F).setBlockName("orichalcumOre").setCreativeTab(this.tabTesCraft);
                GameRegistry.registerBlock(orichalcumOre, "orichalcumOre");
                LanguageRegistry.addName(orichalcumOre, "Orichalcum Ore");
                MinecraftForge.setBlockHarvestLevel(orichalcumOre, "pickaxe", 0);
                
                final Block ebonyOre = new BlockEbonyOre(520, 19, Material.rock).setHardness(40.0F).setResistance(15.0F).setBlockName("ebonyOre").setCreativeTab(this.tabTesCraft);
                GameRegistry.registerBlock(ebonyOre, "ebonyOre");
                LanguageRegistry.addName(ebonyOre, "Ebony Ore");
                MinecraftForge.setBlockHarvestLevel(ebonyOre, "pickaxe", 0);
               
                
                /**
                 * Put items here:
                 */
                steelIngot = new ItemSteelIngot(4000, 0).setItemName("steel ingot").setCreativeTab(this.tabTesCraft);
                LanguageRegistry.addName(steelIngot, "Steel Ingot");

                moonstone = new ItemMoonstone(4001, 1).setItemName("moonstone").setCreativeTab(this.tabTesCraft);
                LanguageRegistry.addName(moonstone, "Moonstone");
                
                malachite = new ItemMalachite(4002, 2).setItemName("malachite").setCreativeTab(this.tabTesCraft);
                LanguageRegistry.addName(malachite, "Malachite");
                
                dwarvenMetal = new ItemDwarvenMetal(4003, 3).setItemName("dwarvenMetal").setCreativeTab(this.tabTesCraft);
                LanguageRegistry.addName(dwarvenMetal, "Dwarven Scrap Metal");
                
                corundumIngot = new ItemCorundumIngot(4004, 4).setItemName("corundumIngot").setCreativeTab(this.tabTesCraft);
                LanguageRegistry.addName(corundumIngot, "Dwarven Metal Ingot");
                
                orichalcumIngot = new ItemOrichalcum(4005, 5).setItemName("orichalcumingot").setCreativeTab(this.tabTesCraft);
                LanguageRegistry.addName(orichalcumIngot, "Orichalcum Ingot");
                
                ebonyIngot = new ItemEbonyIngot(4006, 6).setItemName("ebonyingot").setCreativeTab(this.tabTesCraft);
                LanguageRegistry.addName(ebonyIngot, "Ebony Ingot");
                
                daedricIngot = new ItemDaedricIngot(4007, 7).setItemName("daedric ingot").setCreativeTab(this.tabTesCraft);
                LanguageRegistry.addName(daedricIngot, "Daedric Ingot");
                

        }
        
        @PostInit
        public void postInit(FMLPostInitializationEvent event) 
        {
                // Stub Method
        }
        public static Item steelSword;
        public static Item elvenSword;
        public static Item glassSword;
        public static Item dwarvenSword;
        public static Item orcishSword;
        public static Item ebonySword;
        public static Item daedricSword;
        
        static EnumToolMaterial tesSteel = net.minecraftforge.common.EnumHelper.addToolMaterial("Steel", 2, 350, 6F, 4, 14);
        
        public static CreativeTabs tabTesCraft = new TabTesCraft("tabTesCraft");
        public static Item steelIngot;
        public static Item moonstone;
        public static Item corundumIngot;
        public static Item malachite;
        public static Item dwarvenMetal;
        public static Item orichalcumIngot;
        public static Item ebonyIngot;
        public static Item daedricIngot;
}

Link to comment
Share on other sites

                GameRegistry.addRecipe(new ItemStack(tes_BaseMod.moonstone, 1), new Object[]{

                " X ", " X ", "XXX", 'X', Block.blockClay, 'P', Item.paper

                });

 

I only see You use the block Clay but not the paper. thats the mistake i think because he can not fine the symbol from the paper (P).

Maybe that crashes your game

Link to comment
Share on other sites

I would have done it like this:

ItemStack moonstone = new ItemStack(tes_BaseMod.moonstone);
ItemStack clay = new ItemStack(Block.blockClay);
ItemStack paper = new ItemStack(Item.paper);

GameRegistry.addSmelting(new ItemStack(Block.bedrock, 1), clay, 1.0F);

GameRegistry.addRecipe(new ItemStack(tes_BaseMod.moonstone, 1), " X ", " X ", "XPX", 'X', clay, 'P', paper);

The last parameter in the furnace recipe is a float so you need F at the end. This gives the same ammount of exp that diamonds give you when mined.

 

This won't give you any errors at all.

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.



×
×
  • Create New...

Important Information

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