Jump to content

Item Crafting Damage with Vanilla Items


Cloud

Recommended Posts

So I'm trying to create a crafting recipe, in which you put cobblestone and a pickaxe into a crafting menu to get gravel, and the cobblestone is consumed and the pickaxe takes one durability damage. I'm just getting into modding so I search through the internet for help but I can only find articles about taking crafting damage for custom items. So my question is; is it possible to do such a thing with vanilla tools, and if so, how? Help is much appreciated!!!  ;) Thanks!

Link to comment
Share on other sites

Okay, so I think I'm in the right place! I poked around in the GameRegistry around IRecipe and I think I'm on track, but still a bit lost! ;D Here's what I got set up:

 

public class GravelCrafting implements IRecipe{

@Override
public boolean matches(InventoryCrafting p_77569_1_, World worldIn) {
	// TODO Auto-generated method stub
	return false;
}

@Override
public ItemStack getCraftingResult(InventoryCrafting p_77572_1_) {
	// TODO Auto-generated method stub
	return null;
}

@Override
public int getRecipeSize() {
	// TODO Auto-generated method stub
	return 0;
}

@Override
public ItemStack getRecipeOutput() {
	// TODO Auto-generated method stub
	return null;
}

@Override
public ItemStack[] getRemainingItems(InventoryCrafting p_179532_1_) {
	// TODO Auto-generated method stub
	return null;
}

}

 

So I apologize greatly for asking silly questions, but if I'm making sense of this right, I need to access the array generated by getRemainingItems, so how would I do that?  ;)

Link to comment
Share on other sites

This is easier if you extend an existing recipe class like

ShapedRecipes

or

ShapelessRecipes

(or the equivalent ore recipe classes), this way you only need to override

getRemainingItems

to return the appropriate array and don't need to re-implement the

matches

method.

 

I have an example of this here.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.

Announcements



×
×
  • Create New...

Important Information

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