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

Hey guys, at first: Sry if my english is bad (i'm just a german :D).

 

I want to make an crafting recipe (shaped or shapeless doesnt matter) where the item i put in don't loose, or tat i get another item back on the crafting table like the cake recipe where you put a milk bucket in and get the empty bucket back. Something like that, i hope you can understand me. :D

I know how to make normal crafting recipes (shaped and shapeless), but i dont know how i should do THIS :D

 

I hope you can help me :D

If it's your own item that should give something back, you need to use the container item system.

 

I've written an example of an unbreaking container item (never breaks) and a breaking container item (breaks after a fixed number of uses). You can see how to use them in recipes here.

 

These examples are for 1.7.10, but should work in 1.8 as well.

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.

  • Author

Yeah, i have created an one item so i know how to use this ContainerItem on my one items, but i don't know how to use that on vanilla items (or blocks) :D

I know, that could be (or is) silly :D

You'll probably need to make your own recipe class that implements

IRecipe

(extending an existing implementation will simplify things) and override

IRecipe#getRemainingItems

to return an array containing the container item for each slot (if any) and your custom remaining item for any slot containing the appropriate vanilla item.

ForgeHooks.defaultRecipeGetRemainingItems

will create and fill an array of the container items, so you can just search for the vanilla item. If you extend an existing shaped/shapeless recipe class, you can probably just call

super.getRemainingItems

instead of the

ForgeHooks

method.

 

Make sure you register your recipe class with

RecipeSorter.register

.

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.

  • Author

Okey, i have tried an own thing...and it worked so i wanna explain how i have done this for anybody who has the same problem, so here it goes:

 

I have made a shapeless crafting recipe where i put my item "braunkohle" in and get an diamond and there will be a stick left, where i have put my item "Braunkohle. It worked for vanilla items only as well, so here is my code so you can see how i have done this:

 

GameRegistry.addShapelessRecipe(new ItemStack(Items.diamond), new ItemStack(braunkohle.setContainerItem(Items.stick)));

GameRegistry.addShapelessRecipe(new ItemStack(Items.blaze_rod), new ItemStack(Items.apple.setContainerItem(Items.stick)));

 

Thanks for all, this thread can be closed now :D

 

PS: Thx Choonster, that works also :D

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.