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

[1.11.2] Recipe that takes any ItemPickaxe


Guest
 Share

Recommended Posts

Hi again, 

 

I'd like to make a crafting recipe that will take any registered pickaxe + 8 sand, results in a new mod item (in this case castPA), and returns the EXACT pickaxe used to the player's inventory. 

 

Here's my current code: (currently works just as intended for an undamaged diamond pick but not a damaged one)

 

GameRegistry.addShapedRecipe(new ItemStack(moditems.castPA),
						"SSS",
						"STS",
						"SSS",
						
						'S', Blocks.SAND, 'T', Items.DIAMOND_PICKAXE.setContainerItem(Items.DIAMOND_PICKAXE));

 

Really all I want for now is for a damaged or enchanted diamond pickaxe to be able to be used and returned, but if you guys know how to make all ItemPickaxe's able to be used (without just replacing Items.DIAMOND_PICKAXE with Items.IRON_PICKAXE etc) I would be super grateful. Similar ideas I've found are outdated and don't seem to work with the current forge/minecraft. 

 

Thanks in advance 

Link to comment
Share on other sites

First of all, do not call setContainerItem like that. It does not do what you think it does.

 

You will have to write a custom IRecipe implementation. In there I recommend you check for the "pickaxe" tool class (Item::getToolClasses) so you will supported modded tools as well.

  • Like 1
Link to comment
Share on other sites

To answer your other question, you can use the ore dictionary to use varied items into your recipe. I would write the recipe like this:

 

GameRegistry.addShapedRecipe(new ItemStack(moditems.castPA, 1), "SSS", "SDS", "SSS", 'S', Blocks.SAND, 'D', new ItemStack(Items.DIAMOND_PICKAXE, 1, OreDictionary.WILDCARD_VALUE));

 

Changing T to D is my OCD kicking in. :P I'm actually torn between using D or P. I need help...

Link to comment
Share on other sites

@DimensionsInTime: that doesn't do what the OP wants. That CONSUMES the pickaxe, they want to leave the pickaxe in the crafting grid. 

 

K4yfour:

You can see an example of a custom recipe implementation here, this being the only method you need to modify:

 

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/hardlib/api/recipes/RecipeToolMold.java#L171

 

Note that my recipe looks for items with a very wide definition of "tool" and you are only interested in pickaxes (or even alternatively, an item passed to the recipe constructor: mine does not because the recipe declaration takes in iron tools as a template, but wooden tools can be used in game). The magic principle is the same, though. 

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

11 hours ago, Draco18s said:

@DimensionsInTime: that doesn't do what the OP wants. That CONSUMES the pickaxe, they want to leave the pickaxe in the crafting grid. 

 

K4yfour:

You can see an example of a custom recipe implementation here, this being the only method you need to modify:

 

https://github.com/Draco18s/ReasonableRealism/blob/master/src/main/java/com/draco18s/hardlib/api/recipes/RecipeToolMold.java#L171

 

Note that my recipe looks for items with a very wide definition of "tool" and you are only interested in pickaxes (or even alternatively, an item passed to the recipe constructor: mine does not because the recipe declaration takes in iron tools as a template, but wooden tools can be used in game). The magic principle is the same, though. 

Any idea why "The return type is incompatible with IRecipe.getRemainingItems(InventoryCrafting)"? This is the same error I got when trying to implement my own version of the code also 

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

 Share



×
×
  • Create New...

Important Information

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