Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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!

  • Author

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?  ;)

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.