Jump to content

Recommended Posts

Posted

Hi, I am just wondering how you would go about Crafting Handlers to make them only apply to recipes in the vanilla workbench. Like one item getting damaged if used in a recipe in the vanilla workbench and just getting destroyed when used in a custom workbench recipe.

Posted

I have made a item that I use in recipes and each time it is used it gets damaged, but only when used in the vanilla crafting table. When I use it in a recipe in my custom crafting table I want it to get destroyed.

Posted

There is no need for a CraftingHandler there.

Use Item#getContainerItemStack. Then make your own SlotCrafting and don't call that method from there.

 

Could you please give me an example in a recipe?

Posted

I made it work like this :

 

int i = OreDictionary.WILDCARD_VALUE;

Item gem = duplicatorGem.setContainerItem(duplicatorGem);

GameRegistry.addShapelessRecipe(new ItemStack(Item.coal, 2, 0), new ItemStack(Item.coal, 1, 0), new ItemStack(stack, 1, i));

 

How does that look?

Posted

This turns out to be a better way than using a CraftingHandler, which is what I had also been doing and advising others to do. I worked it out from someone else's code, somewhere, and it worked, so I had no reason to suspect it was not the "right" way to do ti.

What's wrong with using the CraftingHandler, anyway?

 

There really needs to be a "Best Practices" guide for Forge, because one really has no way of knowing if someone else's code that one is learning from is good code or not.  Or is modding like Perl: "There's more than one way to do it"?

 

Now, on to a related problem: if a tool is not consumed by a recipe (because of hasContainerItem()/getContainerItemStack()), how do you keep the repair function of the crafting table from turning into a tool duping machine?

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.