Posted September 20, 201312 yr 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) Thanks
September 20, 201312 yr Author this? public Item setContainerItem(Item par1Item) { this.containerItem = par1Item; return this; } I undestand how use it
September 20, 201312 yr Author ok solved... but: GameRegistry.addRecipe(new ItemStack(Black, 4), new Object[]{"XX", "XX", 'X', this.Pencil.setContainerItem(Pencil)}); it retutrn 4 pencil(equals of output numbers) How can I return 1 only?
September 20, 201312 yr Author P.S it is possible because the recipe of cake give 1 cake and return 3 bucket
September 21, 201312 yr 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 { @Override 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 } } } } @Override public void onSmelting(EntityPlayer player, ItemStack item) {} }
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.