Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Crafting recipe error when using custom items


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

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



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • Minecraft forge is crashing whenever I create a new world. It will load in the world for a few frames before freezing, and then crashing to the launcher. It gives me a game crash error that says; The game crashed whilst unexpected error Error: java.lang.IllegalArgumentException: (256, 0) outside of image bounds (256, 8192) Exit Code: -1 This is the crash report.  
    • Sorry, just made it public, forgot to do that.
    • Latest commit from here should do the trick: https://github.com/hammy3502/survival-extras-2 .   I haven't tested on a built JAR, only when using the runClient task.
    • Looks fine. Can you post a Git repo that reproduces this issue?
    • buildscript { repositories { maven { url = 'https://files.minecraftforge.net/maven' } jcenter() mavenCentral() } dependencies { classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true } } apply plugin: 'net.minecraftforge.gradle' // Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. apply plugin: 'eclipse' apply plugin: 'maven-publish' version = '2.0.0' group = 'net.blf02.survivalextras2' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'survival_extras_2' sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) minecraft { // The mappings can be changed at any time, and must be in the following format. // snapshot_YYYYMMDD Snapshot are built nightly. // stable_# Stables are built at the discretion of the MCP team. // Use non-default mappings at your own risk. they may not always work. // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: 'snapshot', version: '20201028-1.16.3' // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Default run configurations. // These can be tweaked, removed, or duplicated as needed. runs { client { workingDirectory project.file('run') // Recommended logging data for a userdev environment property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' // Recommended logging level for the console property 'forge.logging.console.level', 'debug' mods { examplemod { source sourceSets.main } } // For Patchouli property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" } server { workingDirectory project.file('run') // Recommended logging data for a userdev environment property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' // Recommended logging level for the console property 'forge.logging.console.level', 'debug' mods { examplemod { source sourceSets.main } } } data { workingDirectory project.file('run') // Recommended logging data for a userdev environment property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' // Recommended logging level for the console property 'forge.logging.console.level', 'debug' // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. args '--mod', 'examplemod', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') mods { examplemod { source sourceSets.main } } } } } // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { maven { // location of the maven that hosts JEI files name = "Progwml6 maven" url = "https://dvs1.progwml6.com/files/maven/" } maven { // location of a maven mirror for JEI files, as a fallback name = "ModMaven" url = "https://modmaven.k-4u.nl" } maven { name = "Patchouli" url = "https://maven.blamejared.com" } flatDir { dirs 'libs' } } dependencies { // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed // that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied. // The userdev artifact is a special name and will get all sorts of transformations applied to it. minecraft 'net.minecraftforge:forge:1.16.4-35.1.37' // compile against the JEI API but do not include it at runtime compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // at runtime, use the full JEI jar runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") compileOnly fg.deobf("vazkii.patchouli:Patchouli:1.16.4-50:api") runtimeOnly fg.deobf("vazkii.patchouli:Patchouli:1.16.4-50") compile fg.deobf("net.blf02.vivecraftapi:Vivecraft-API-1.16.4-0.1.0") // You may put jars on which you depend on in ./libs or you may define them like so.. // compile "some.group:artifact:version:classifier" // compile "some.group:artifact:version" // Real examples // compile 'com.mod-buildcraft:buildcraft:6.0.8:dev' // adds buildcraft to the dev env // compile 'com.googlecode.efficient-java-matrix-library:ejml:0.24' // adds ejml to the dev env // The 'provided' configuration is for optional dependencies that exist at compile-time but might not at runtime. // provided 'com.mod-buildcraft:buildcraft:6.0.8:dev' // These dependencies get remapped to your current MCP mappings // deobf 'com.mod-buildcraft:buildcraft:6.0.8:dev' // For more info... // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } // Example for how to get properties into the manifest for reading by the runtime.. jar { manifest { attributes([ "Specification-Title": "examplemod", "Specification-Vendor": "examplemodsareus", "Specification-Version": "1", // We are version 1 of ourselves "Implementation-Title": project.name, "Implementation-Version": "${version}", "Implementation-Vendor" :"examplemodsareus", "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } } // Example configuration to allow publishing using the maven-publish task // This is the preferred method to reobfuscate your jar file jar.finalizedBy('reobfJar') // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing //publish.dependsOn('reobfJar') publishing { publications { mavenJava(MavenPublication) { artifact jar } } repositories { maven { url "file:///${project.projectDir}/mcmodsrepo" } } } EDIT: The JAR is stored in libs/, and is named `Vivecraft-API-1.16.4-0.1.0.jar`
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.