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

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

  • Author

this?

    public Item setContainerItem(Item par1Item)

    {

        this.containerItem = par1Item;

        return this;

    }

 

xD I undestand how use it

  • 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?

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.

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.