Jump to content

Crafting recipe error when using custom items


sinsiliuxs120

Recommended Posts

So I've encountered this problem when I try to add a crafting recipe for item from my mod using other items from my mod minecraft crashes on start up. Eclipse doesn't show any errors and I'm not sure what to do. All my items are in base mod class as well as their crafting recipes. However items that are crafted with vanilla minecraft items work just fine. If you need any part of code just let me know. Thanks in advance

 

-S

Link to comment
Share on other sites

You said that i should ask, so here it is: Code?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

Here is the error code

---- Minecraft Crash Report ----

// I feel sad now :(

 

Time: 8/17/13 9:11 PM

Description: Failed to start game

 

java.lang.NullPointerException

        at net.minecraft.item.crafting.CraftingManager.addRecipe(CraftingManager.java:213)

        at cpw.mods.fml.common.registry.GameRegistry.addShapedRecipe(GameRegistry.java:244)

        at cpw.mods.fml.common.registry.GameRegistry.addRecipe(GameRegistry.java:239)

        at mod.tdm.TdmBase.load(TdmBase.java:34)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:494)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

        at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

        at com.google.common.eventbus.EventBus.post(EventBus.java:267)

        at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:192)

        at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:172)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

        at java.lang.reflect.Method.invoke(Unknown Source)

        at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)

        at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)

        at com.google.common.eventbus.EventBus.dispatch(EventBus.java:314)

        at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)

        at com.google.common.eventbus.EventBus.post(EventBus.java:267)

        at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:103)

        at cpw.mods.fml.common.Loader.initializeMods(Loader.java:691)

        at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:213)

        at net.minecraft.client.Minecraft.startGame(Minecraft.java:448)

        at net.minecraft.client.MinecraftAppletImpl.startGame(MinecraftAppletImpl.java:44)

        at net.minecraft.client.Minecraft.run(Minecraft.java:733)

        at java.lang.Thread.run(Unknown Source)

 

Link to comment
Share on other sites

All letters are defined, but I think that those items I used in crafting are unregistered. Could you explain it to me/give me a link where it's explained how to register items?

 

Edit: If you mean by typing public static ItemName under the public class BaseMod then yes I did that, for all items

Link to comment
Share on other sites

So, there are three possible null arguments:

-ObsidianSword

-CondensedObsidian

-blazerod

All those should be initialized before the addRecipe(args) line.

 

You can also try with

GameRegistry.addRecipe(new ItemStack(ObsidianSword), new Object[]{" O "," O "," R ",'O', ashtonsmod.CondensedObsidian,'R',blazerod});

Link to comment
Share on other sites

Ok, so here is the BaseMod.class (TdmBase.java) code:

 

 

    package sins.tdm;

   

    import net.minecraft.block.Block;

    import net.minecraft.block.material.Material;

    import net.minecraft.creativetab.CreativeTabs;

    import net.minecraft.item.Item;

    import net.minecraft.item.ItemStack;

    import cpw.mods.fml.common.Mod;

    import cpw.mods.fml.common.Mod.Init;

    import cpw.mods.fml.common.event.FMLInitializationEvent;

    import cpw.mods.fml.common.network.NetworkMod;

    import cpw.mods.fml.common.registry.GameData;

    import cpw.mods.fml.common.registry.GameRegistry;

    import cpw.mods.fml.common.registry.LanguageRegistry;

    import net.minecraft.item.crafting.CraftingManager;

   

    @Mod(modid = TdmBase.modid, name = "Sorry no spoilers :)", version = "1.0")

    @NetworkMod(clientSideRequired = true, serverSideRequired = false)

    public class TdmBase

    {

   

            public static final String modid = "sins_TDM";

         

         

            public static CreativeTabs tabTDM = new CreativeTabs("tabTDM") {

            public ItemStack getIconItemStack() {

                    return new ItemStack(TdmBase.barrel, 1, 0);

            }

    };

         

            public static Block barrel;

            public static Item cog;

            public static Item woodenWheel;

            public static Item reinforcedWheel;

            public static Item smallCannon;

            public static Item woodenChassis;

            public static Item reinforcedChassis;

         

            @Init

            public void load(FMLInitializationEvent event)

            {

                    reinforcedChassis = new ItemReinforcedChassis(7210).setUnlocalizedName("Reinforced chassis");

                    LanguageRegistry.addName(reinforcedChassis, "Reinforced chassis");

                    GameRegistry.addRecipe(new ItemStack(reinforcedChassis), new Object[]{

                    "WIW","CBC","WIW", 'W', TdmBase.reinforcedWheel, 'I', Item.ingotIron, 'C', TdmBase.cog, 'B', Block.blockIron});

   

                    woodenChassis = new ItemWoodenChassis(7209).setUnlocalizedName("Wooden chassis");

                    LanguageRegistry.addName(woodenChassis, "Wooden chassis");

                    GameRegistry.addRecipe(new ItemStack(woodenChassis), new Object[]{

                    "WSW","CPC","WSW", 'W', TdmBase.woodenWheel, 'S', Item.stick, 'C', TdmBase.cog, 'P', Block.planks});

                 

                    smallCannon = new ItemSmallCannon(7208).setUnlocalizedName("Small cannon");

                    LanguageRegistry.addName(smallCannon, "Small cannon");

                    GameRegistry.addRecipe(new ItemStack(smallCannon), new Object[]{

                    "I  "," I ","  I", 'I', Item.ingotIron});

                 

                    reinforcedWheel = new ItemReinforcedWheel(7207).setUnlocalizedName("Reinforced wheel");

                    LanguageRegistry.addName(reinforcedWheel, "Reinforced wheel");

                    GameRegistry.addRecipe(new ItemStack(reinforcedWheel), new Object[]{

                    "III","IPI","III", 'I', Item.ingotIron, 'P', Block.planks});

                 

                    woodenWheel = new ItemWoodenWheel(7206).setUnlocalizedName("Wooden wheel");

                    LanguageRegistry.addName(woodenWheel, "Wooden wheel");

                    GameRegistry.addRecipe(new ItemStack(woodenWheel), new Object[]{

                    "SSS","SPS","SSS", 'P', Block.planks, 'S', Item.stick});

                 

                    cog = new ItemCog(7205).setUnlocalizedName("Cog");

                    LanguageRegistry.addName(cog, "Cog");

                    GameRegistry.addRecipe(new ItemStack(cog), new Object[]{

                " S ","SPS"," S ", 'I', Block.planks, 'S', Item.stick});

                 

                    barrel = new BlockBarrel(500, Material.grass).setUnlocalizedName("Barrel").setHardness(2.0F).setResistance(0.0F).setStepSound(Block.soundWoodFootstep);

                    GameRegistry.registerBlock(barrel, modid + barrel.getUnlocalizedName2());

                    LanguageRegistry.addName(barrel, "Barrel");

                    GameRegistry.addRecipe(new ItemStack(barrel), new Object[]{

            "PCP","PCP","PCP", 'P', Block.planks, 'C', Item.gunpowder});

                 

                    LanguageRegistry.instance().addStringLocalization("itemGroup.tabTDM", "en_US", "No spoilers :)))");

            }

    }

 

 

 

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
    • OLXTOTO adalah situs bandar togel online resmi terbesar dan terpercaya di Indonesia. Bergabunglah dengan OLXTOTO dan nikmati pengalaman bermain togel yang aman dan terjamin. Koleksi toto 4D dan togel toto terlengkap di OLXTOTO membuat para member memiliki pilihan taruhan yang lebih banyak. Sebagai situs togel terpercaya, OLXTOTO menjaga keamanan dan kenyamanan para membernya dengan sistem keamanan terbaik dan enkripsi data. Transaksi yang cepat, aman, dan terpercaya merupakan jaminan dari OLXTOTO. Nikmati layanan situs toto terbaik dari OLXTOTO dengan tampilan yang user-friendly dan mudah digunakan. Layanan pelanggan tersedia 24/7 untuk membantu para member. Bergabunglah dengan OLXTOTO sekarang untuk merasakan pengalaman bermain togel yang menyenangkan dan menguntungkan.
    • Baba  Serege [[+27-73 590 8989]] has experience of 27 years in helping and guiding many people from all over the world. His psychic abilities may help you answer and resolve many unanswered questions. He specialize in helping women and men from all walks of life.. 1) – Bring back lost lover. even if lost for a long time. 2) – My lover is abusing alcohol, partying and cheating on me I urgently need help” 3) – Divorce or court issues. 4) – Is your love falling apart? 5) – Do you want your love to grow stronger? 6) – Is your partner losing interest in you? 7) – Do you want to catch your partner cheating on you? – We help to keep your partner faithful and loyal to you. 9) – We recover love and happiness when relationship breaks down. 10) – Making your partner loves you alone. 11) – We create loyalty and everlasting love between couples. 12) – Get a divorce settlement quickly from your ex-partner. 13) – We create everlasting love between couples. 14) – We help you look for the best suitable partner. 15) – We bring back lost lover even if lost for a long time. 16) – We strengthen bonds in all love relationship and marriages 17) – Are you an herbalist who wants to get more powers? 18) – Buy a house or car of your dream. 19) – Unfinished jobs by other doctors come to me. 20) – I help those seeking employment. 21) – Pensioners free treatment. 22) – Win business tenders and contracts. 23) – Do you need to recover your lost property? 24) – Promotion at work and better pay. 25) – Do you want to be protected from bad spirits and nightmares? 26) – Financial problems. 27) – Why you can’t keep money or lovers? 28) – Why you have a lot of enemies? 29) – Why you are fired regularly on jobs? 30) – Speed up money claim spell, delayed payments, pension and accident funds 31) – I help students pass their exams/interviews. 33) – Removal of bad luck and debts. 34) – Are struggling to sleep because of a spiritual wife or husband. 35- ) Recover stolen property
  • Topics

×
×
  • Create New...

Important Information

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