Vswe's Summer Courses | You're not logged in. Sign up or log in | Server time: | Donate
One can now see other persons' badge hunts. Simply head over to their profiles to access them.

Go back to sub forum page

General forum

Non-course related subjects

3. Programming help

1.7.2 Recipe Help

  • 2014-06-19 00:22:19
    I am having an issue where: When I try to register a 2x2 or 3x3 crafting recipe made up of one of the same block/item, my client crashes when I try to test the code. Any suggestions?

    The specific area causing the error:
        //Illuminous Iron Block
        illuminousIronBlock = new BlockIlluminousIron();
        GameRegistry.addRecipe(new ItemStack(illuminousIronBlock), new Object[]{         
            'X', illuminousIron});
        //Resonant Iron Block
        resonantIronBlock = new BlockResonantIron();
        GameRegistry.addRecipe(new ItemStack(resonantIronBlock), new Object[]{
            'X', resonantIron});
  • 2014-06-19 00:25:45
    Half of the class file:
    package com.technostar.technobits;

    import net.minecraft.block.Block;
    import net.minecraft.init.Blocks;
    import net.minecraft.init.Items;
    import net.minecraft.item.Item;
    import net.minecraft.item.Item.ToolMaterial;
    import net.minecraft.item.ItemStack;
    import net.minecraftforge.common.util.EnumHelper;

    import com.technostar.technobits.Blocks.BlockDarkStone;
    import com.technostar.technobits.Blocks.BlockIlluminousIron;
    import com.technostar.technobits.Blocks.BlockResonantIron;
    import com.technostar.technobits.Blocks.BlockTransparentStone;
    import com.technostar.technobits.Items.ItemResonantHoe;
    import com.technostar.technobits.Items.ItemIlluminousIron;
    import com.technostar.technobits.Items.ItemResonantAxe;
    import com.technostar.technobits.Items.ItemResonantBlade;
    import com.technostar.technobits.Items.ItemResonantIron;
    import com.technostar.technobits.Items.ItemResonantPickaxe;
    import com.technostar.technobits.Items.ItemResonantShovel;
    import com.technostar.technobits.help.RegisterHelper;

    import cpw.mods.fml.common.Mod;
    import cpw.mods.fml.common.Mod.EventHandler;
    import cpw.mods.fml.common.event.FMLPreInitializationEvent;
    import cpw.mods.fml.common.registry.GameRegistry;

    @Mod(name = TechnoBits.NAME, modid = TechnoBits.MODID, version = TechnoBits.VERSION)
    public class TechnoBits {
    public static final String MODID = "technobits";
    public static final String VERSION = "Pre-Alpha 1.0.0";
    public static final String NAME = "TechnoBits";

    public static Block darkStone;
    public static Block transparentStone;
    public static Block illuminousIronBlock;
    public static Block resonantIronBlock;

    public static Item illuminousIron;
    public static Item resonantIron;


    public static Item resonantIronPickaxe;
    public static Item resonantIronAxe;
    public static Item resonantIronShovel;
    public static Item resonantIronBlade;
    public static Item resonantIronHoe;


    static ToolMaterial resonantIronMaterial = EnumHelper.addToolMaterial("resonantIronMaterial", 3, 512, 8.75F, 4.25F, 30);

    public void preInit(FMLPreInitializationEvent event)
        //Darkness Stone
        darkStone = new BlockDarkStone();
        GameRegistry.addRecipe(new ItemStack(darkStone, 9), new Object[]{
            'X', Blocks.stone, 'Y', Blocks.obsidian});
        //Transparent Stone
        transparentStone = new BlockTransparentStone();
        GameRegistry.addRecipe(new ItemStack(transparentStone, 9), new Object[]{
            'X', Blocks.stone, 'Y', Blocks.glass});
  • 2014-06-19 00:26:10
    The other half:
    //Illuminous Iron
        illuminousIron = new ItemIlluminousIron();
        GameRegistry.addRecipe(new ItemStack(illuminousIron), new Object[]{
            'X', Items.glowstone_dust, 'Y', Items.iron_ingot, 'Z', Items.gold_nugget});
        GameRegistry.addRecipe(new ItemStack(illuminousIron, 4), new Object[]{
            'X', illuminousIronBlock});
        //Resonant Iron
        resonantIron = new ItemResonantIron();
        GameRegistry.addRecipe(new ItemStack(resonantIron, 4), new Object[]{
            'X', illuminousIron, 'Y', Items.diamond, 'Z', Items.ender_pearl});
        GameRegistry.addRecipe(new ItemStack(resonantIron, 4), new Object[]{
            'X', resonantIronBlock});
        //Resonant Iron Pickaxe
        resonantIronPickaxe = new ItemResonantPickaxe(resonantIronMaterial);
        GameRegistry.addRecipe(new ItemStack(resonantIronPickaxe), new Object[]{
            " X ",
            " X ",
            'X', Blocks.obsidian, 'Y', resonantIron});
        //Resonant Iron Axe
        resonantIronAxe = new ItemResonantAxe(resonantIronMaterial);
        GameRegistry.addRecipe(new ItemStack(resonantIronAxe), new Object[]{
            " X",
            'X', Blocks.obsidian, 'Y', resonantIron});
        GameRegistry.addRecipe(new ItemStack(resonantIronAxe), new Object[]{
            "X ",
            'X', Blocks.obsidian, 'Y', resonantIron});
        //Resonant Iron Shovel
        resonantIronShovel = new ItemResonantShovel(resonantIronMaterial);
        GameRegistry.addRecipe(new ItemStack(resonantIronShovel), new Object[]{
            'X', Blocks.obsidian, 'Y', resonantIron});
        //Resonant Iron Hoe
        resonantIronHoe = new ItemResonantHoe(resonantIronMaterial);
        GameRegistry.addRecipe(new ItemStack(resonantIronHoe), new Object[]{
            " X",
            " X",
            'X', Blocks.obsidian, 'Y', resonantIron});
        GameRegistry.addRecipe(new ItemStack(resonantIronHoe), new Object[]{
            "X ",
            "X ",
            'X', Blocks.obsidian, 'Y', resonantIron});
        //Resonant Iron Blade
        resonantIronBlade = new ItemResonantBlade(resonantIronMaterial);
        GameRegistry.addRecipe(new ItemStack(resonantIronBlade), new Object[]{
            'X', Blocks.obsidian, 'Y', resonantIron});

  • 2014-06-19 13:52:09
    could you submit a crash log?
  • 2014-06-19 13:53:34
    also, you might as well just try launching it again, if you only launched once, sometimes minecraft forge just derps when starting and crashes.
  • 2014-06-19 16:17:31
    Also, for submiting code better use pastebin
  • 2014-06-27 15:08:39
    it seems you registered the resonant iron hoe recipe twice...
  • 2014-06-30 23:35:04
    mathestar, I've tried it multiple times. It failed to work any of those times. Also,Etn, they are two different recipes, with
    the hoe facing left or right. It is just that this site derps with the formatting. Anyways, here's the crashlog.

    Crashlog from pastebin: http://pastebin.com/yKhm6tV2
  • 2014-07-01 21:50:29
    I tried looking at the source, it does some weird voodoo I don't understand, like:
    int i = 0;
    if (par2ArrayOfObj[i] instanceof String[])
    {while (par2ArrayOfObj[i] instanceof String)
    but I looked at a tutorial, apparently a recipe matches if you register ("ab","ba") and someone puts in the equivalent of " "," ba"," ab"
    also, is having strings of different lengths valid?
  • 2014-07-01 21:55:47
    forget that last part, I thought one of your recipes had two strings of length two, and one of length three, but it actually wasn't
  • 2014-07-03 23:10:27
    Also, another issue I have is that when I attempt to view the source code, it says "source not found". It is quite annoying.
  • 2014-07-03 23:12:49
    Also, that might be because in the minecraft source folder, the files show up as .class files instead of .java files(when viewed from eclipse). Is this supposed to happen?
  • 2014-07-07 13:34:07
    Yea it should show up as .class file.
  • 2014-07-30 17:42:17
    A rather large bump, I just want to say that the reason why I was getting that error was because I was registering my recipes before I registered the item itself. This was due to how my code was organized. I moved the recipes to the bottom of the preInit to avoid this.
  • Log in or sign up to reply to this thread