Jump to content

Item into a recipe...


Recommended Posts

Hello i created a recipe with an custom item but I need that this item as for the MininumStone of EE3, once craftated the item of recipe the custom item does not disappear ... How can I do?

(So: If I put 1 block of land and of stone and I craft a block... in the crafting  grid there is still the block of dirt)


Link to comment
Share on other sites

Here is my ICraftingHandler. Its a bit excessive, but it works. Replace the CarbonMod.chisel with Item.bucket and CarbonMod.chisel.itemID with Item.bucket.itemID. If that doesn't work look at the code and toy with it until it works. The code returns a damaged (not lol) version of the item, but you could also make it return something different, like make it so if you have a milk bucket in there make it return a bucket. Just play with it. BTW jmanpenilla is my in game name.


package com.jmanpenilla.carbonmod.core.handlers;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;

import com.jmanpenilla.carbonmod.CarbonMod;

import cpw.mods.fml.common.ICraftingHandler;

* CarbonMod
* @author jmanpenilla

public class CraftingHandler implements ICraftingHandler {

public void onCrafting(EntityPlayer player, ItemStack item,
IInventory craftMatrix) {
	for(int i=0; i < craftMatrix.getSizeInventory(); i++) //Checks all the slots
	if(craftMatrix.getStackInSlot(i) != null) //If there is an item
	ItemStack j = craftMatrix.getStackInSlot(i); //Gets the item
	if(j.getItem() != null && j.getItem() == CarbonMod.chisel) //If it's a Chisel
	         ItemStack k = new ItemStack(CarbonMod.chisel.itemID, 2, (j.getItemDamage() + 0)); //Makes a new itemstack that's been damaged and has 2 items
	         if(k.getItemDamage() >= k.getMaxDamage()){ //If it is destroyed
	         k.stackSize--; //Removes the added item
	         craftMatrix.setInventorySlotContents(i, k); //Sets the slot to the new item
public void onSmelting(EntityPlayer player, ItemStack item) {}

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.

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.


  • Create New...

Important Information

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