Jump to content

Recipe for custom item not working consistently


lionel5116

Recommended Posts

I have an issue concerning a recipe that I created for rendering an item that I created based on the itemPickAxe class. I don't think it has to do with the class that it extends itself, but with the way the recipe is working. I have attached the code on GitHub (like you suggested) at: https://gist.github.com/lionel5116/

If you look at the file "ModRecipes.java", you notice a block of code:

 

For some reason, If I use a pattern:

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

    "R",

    "RR",

    'R', Blocks.cobblestone[/b]

  });

 

It will not create the item using the pattern shown, but the weird thing is, it will create the pickaxe if I remove the segment on the second row of the pattern, like the pattern shown below:

 

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

    "R",

    "R",

      'R', Blocks.cobblestone

  });

 

If look at the code for sword here:

//let's make a recipe for my bad ass sword

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

    "SS",

    "SS",

    "SS",

    'S', Blocks.cobblestone

  });

 

This pattern works as it should using the pattern outlined.

I have attached all of my main files on Git as mentioned:

https://gist.github.com/lionel5116/

 

 

 

Link to comment
Share on other sites

Thanks for the response, based on your observation and "me" looking at the code closer (a second pair of eyes), there were "2" mistakes I was making, first "all" of the strings for each row in the grid "MUST" be of the same size (or you will get an indexOutRangeException), then the last row item for the common character must be in ' ' (single quotes), I don't know how I missed that.. (looking at to hard I guess), now "all of my patterns work"... so even if I use:

GameRegistry.addRecipe(new ItemStack(ModItems.ljonesbadasspickaxe), "R", "RR", 'R', Blocks.cobblestone); - that crashed...,

but once I modified the code to:

GameRegistry.addRecipe(new ItemStack(ModItems.ljonesbadasspickaxe), "R ", "RR", 'R', Blocks.cobblestone); - that worked !!

 

Thanks guys..

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.