Jump to content

Recommended Posts

Posted

I'm having a really odd issue with adding a new recipe. When I try and add a shapeless recipe using my blocks, it won't work. When I try and do it using my items, it works fine. Here are my shapeless recipe adds. The one with asterisks doesn't work. Anyone know why?

 

//Recipe Stuff
            ItemStack bowl = new ItemStack(Item.getItemById(281)); //bowl
            ItemStack redMush = new ItemStack(Block.getBlockById(40)); //red
            ItemStack brownMush = new ItemStack(Block.getBlockById(39)); //brown
            ItemStack yellowMush = new ItemStack(lemoncup);
            ItemStack orangeMush = new ItemStack(orangecap);
            ItemStack mushroomStew = new ItemStack(Item.getItemById(282)); //mushroomstew

            GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, yellowMush, orangeMush});
            GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, yellowMush, redMush});
            GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, yellowMush, brownMush});
            GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, redMush, orangeMush});
            GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, brownMush, orangeMush});
            
            **GameRegistry.addShapelessRecipe(new ItemStack(this.lemoncupPlanks), new ItemStack(this.lemoncupTrunk));**       
            GameRegistry.addShapelessRecipe(new ItemStack(Blocks.dirt), new ItemStack(Blocks.acacia_stairs));

 

EDIT: Solved it! Finally. Like was said below, you have to use the accessor classes Blocks and Items to call vanilla items and blocks to ItemStacks going forward. For some reason, I had to set up my own accessor class to get my blocks to work in ItemStacks as well. I can reference item instances just fine, but I have to reference blocks through my own personal Blocks class (I called it ModBlocks) which included nothing but a bunch of variables for each block (public static block Name = (Block)BlockRegistry.Name;). It somehow changes the accessibility of the block. Don't know why.

Posted

You are modding for Minecraft 1.7.2, no? Item ids (and block ids) are a no-no. Don't use them for that. Items.itemName and Blocks.blockName are the proper methods to refer to vanilla blocks and items.

 

Also, your recipes are not coded sensibly. You do not need array notation to call a var-args method.

GameRegistry.addShapelessRecipe(mushroomStew, new Object[]{bowl, yellowMush, orangeMush});

should be

GameRegistry.addShapelessRecipe(mushroomStew, bowl, yellowMush, orangeMush);

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



×
×
  • Create New...

Important Information

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