Jump to content

Item damage on crafting


mydeblob

Recommended Posts

Ya ya, im sure you get ton of these threads, but for some reason this isn't working. Im using forge 1.6.2, and I want an item to take 1 damage out of 64 when used to craft something. I made some code for it but I can only use it 3 times before it won't let me craft anymore but the item still has durability. Thanks for your help.

Base Mod class (the knife item is the one that should be able to be used more than once)

 

package mydeblob.mineedibles;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;

@Mod(modid="mineedibles", name="MineEdibles", version="1.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class MineEdibles {


        // The instance of your mod that Forge uses.
        @Instance("Sandwich")
        public static MineEdibles instance;
        private static Item breadslice;
        private static Item chickensandwich;
        private static Item steaksandwich;
        private static Item hamsandwich;
        private static Item supersandwich;
        private static Item chickenbit;
        private static Item steakbit;
        private static Item porkbit;
        public static Item tomatoseeds;
        public static Item tomatofruit;
        public static Block tomatocrop;
        public static Item rawbacon;
        private static Item cookedbacon;
        private static Item rawchickenbit;
        private static Item rawsteakbit;
        private static Item rawporkbit;
        public static Item knife;
        
        //Item Ids for the config file
        int breadsliceID;
        int chickensandwichID;
        int steaksandwichID;
        int hamsandwichID;
        int supersandwichID;
        int chickenbitID;
        int steakbitID;
        int porkbitID;
        int tomatoseedsID;
        int tomatocropID;
        int tomatofruitID;
        int rawbaconID;
        int cookedbaconID;
        int rawchickenbitID;
        int rawsteakbitID;
        int rawporkbitID;
        int knifeID;

        
        // Says where the client and server 'proxy' code is loaded.
        @SidedProxy(clientSide="mydeblob.mineedibles.client.ClientProxy", serverSide="mydeblob.mineedibles.CommonProxy")
        public static CommonProxy proxy;
        
        @EventHandler
        public void preInit(FMLPreInitializationEvent event) {
        	//Basic Configuration file
        	Configuration config = new Configuration(event.getSuggestedConfigurationFile());
        	config.load();
        	breadsliceID = config.get("Item IDs", "Bread Slice", 5000).getInt();
        	chickensandwichID = config.get("Item IDs", "Chicken Sandwich", 5001).getInt();
        	steaksandwichID = config.get("Item IDs", "Steak Sandwich", 5002).getInt();
        	hamsandwichID = config.get("Item IDs", "Ham Sandwich", 5003).getInt();
        	supersandwichID = config.get("Item IDs", "Super Sandwich", 5004).getInt();
        	chickenbitID = config.get("Item IDs", "Slice of Chicken", 5005).getInt();
        	steakbitID = config.get("Item IDs", "Slice of Steak", 5006).getInt();
        	porkbitID = config.get("Item IDs", "Slice of Pork", 5007).getInt();
        	tomatoseedsID = config.get("Item IDs", "Tomato Seeds", 5008).getInt();
        	tomatofruitID = config.get("Item IDs", "Tomato Fruit", 5009).getInt();
        	rawbaconID = config.get("Item IDs", "Raw Bacon", 50010).getInt();
        	cookedbaconID = config.get("Item IDs", "Cooked Bacon", 5011).getInt();
        	rawchickenbitID = config.get("Item IDs", "Raw Slice of Chicken", 5012).getInt();
        	rawsteakbitID = config.get("Item IDs", "Raw Slice of Beef", 5013).getInt();
        	rawporkbitID = config.get("Item IDs", "Raw Slice of Ham", 5014).getInt();
        	knifeID = config.get("Item IDs", "Knife", 5015).getInt();
        	config.save();
        }
        
        @EventHandler
        public void load(FMLInitializationEvent event) {
                proxy.registerRenderers();
                //Items
               breadslice = new Item(breadsliceID).setUnlocalizedName("breadslice").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:slicebread");
               chickensandwich = new ItemFood(chickensandwichID, 9, 0.8f, false).setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("chickensandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:chickensandwich");
               steaksandwich = new ItemFood(steaksandwichID, 9, 0.8f, false).setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("steaksandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:steaksandwich");
               hamsandwich = new ItemFood(hamsandwichID, 9, 0.8f, false).setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("hamsandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:hamsandwich");
               supersandwich = new ItemFood(supersandwichID, 18, 1.4f, false).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 6, 1, 0.8f).setPotionEffect(Potion.moveSpeed.id, 6, 1, 0.8f).setUnlocalizedName("supersandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:supersandwich");
               chickenbit = new ItemFood(chickenbitID, 2, 0.4f, false).setUnlocalizedName("chickenbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:chickenbit");
               steakbit = new ItemFood(steakbitID, 2, 0.4f, false).setUnlocalizedName("steakbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:steakbit");
               porkbit = new ItemFood(porkbitID, 2, 0.4f, false).setUnlocalizedName("porkbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:porkbit");
               tomatocrop = new TomatoCrop(tomatocropID).setUnlocalizedName("tomatocrop").func_111022_d("mineedibles:tomatocrop");
               tomatoseeds = new ItemSeeds(tomatoseedsID, tomatocrop.blockID, Block.tilledField.blockID).setUnlocalizedName("tomatoseeds").func_111206_d("mineedibles:tomatoseeds");
               tomatofruit = new ItemFood(tomatofruitID, 6, 0.8f, false).setUnlocalizedName("tomatofruit").func_111206_d("mineedibles:tomatofruit");
               rawbacon = new ItemFood(rawbaconID, 3, 0.3f, false).setUnlocalizedName("baconraw").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawbacon");
               cookedbacon = new ItemFood(cookedbaconID, 7, 0.6f, false).setUnlocalizedName("baconcooked").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:cookedbacon");
               rawchickenbit = new ItemFood(rawchickenbitID, 1, 0.2f, false).setUnlocalizedName("rawchickenbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawchickenbit");
               rawsteakbit = new ItemFood(rawsteakbitID, 1, 0.2f, false).setUnlocalizedName("rawsteakbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawsteakbit");
               rawporkbit = new ItemFood(rawporkbitID, 1, 0.2f, false).setUnlocalizedName("rawporkbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawporkbit");
               knife = new Item(knifeID).setUnlocalizedName("knife").setMaxDamage(64).setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools).func_111206_d("mineedibles:knifeBlack");
               MinecraftForge.addGrassSeed(new ItemStack (tomatoseeds), 10);
               gameRegisters();
               languageRegisters();
               craftingRecipes();
               	//Smelting
               GameRegistry.addSmelting(MineEdibles.rawbacon.itemID, new ItemStack(MineEdibles.cookedbacon, 1), 0.1f);
               GameRegistry.addSmelting(MineEdibles.rawchickenbit.itemID, new ItemStack(MineEdibles.chickenbit, 1), 0.1f);
               GameRegistry.addSmelting(MineEdibles.rawsteakbit.itemID, new ItemStack(MineEdibles.steakbit, 1), 0.1f);
               GameRegistry.addSmelting(MineEdibles.rawporkbit.itemID, new ItemStack(MineEdibles.porkbit, 1), 0.1f);




        }

        //Item and Block registeration
        private static void gameRegisters(){
        	GameRegistry.registerItem(breadslice, "Bread Slice");
        	GameRegistry.registerItem(chickensandwich, "Chicken Sandwich");
        	GameRegistry.registerItem(steaksandwich, "Steak Sandwich");
        	GameRegistry.registerItem(hamsandwich, "Ham Sandwich");
        	GameRegistry.registerItem(supersandwich, "Super Sandwich");
        	GameRegistry.registerItem(chickenbit, "Slice of Chicken");
        	GameRegistry.registerItem(steakbit, "Slice of Steak");
        	GameRegistry.registerItem(porkbit, "Slice of Ham");
        	GameRegistry.registerItem(tomatoseeds, "Tomato Seeds");
        	GameRegistry.registerItem(tomatofruit, "Tomato");
        	GameRegistry.registerBlock(tomatocrop, "Tomato Crop");
        	GameRegistry.registerItem(rawbacon, "Raw Bacon");
        	GameRegistry.registerItem(cookedbacon, "Cooked Bacon");
        	GameRegistry.registerItem(rawchickenbit, "Raw Slice of Chicken");
        	GameRegistry.registerItem(rawsteakbit, "Raw Slice of Steak");
        	GameRegistry.registerItem(rawporkbit, "Raw Slice of Ham");
        	GameRegistry.registerItem(knife, "Knife");
        	GameRegistry.registerCraftingHandler(new KnifeCraftingHandler());
        }
        //Item and Block in game name, languageregistry
        private static void languageRegisters(){
        	LanguageRegistry.addName(breadslice, "Bread Slice");
        	LanguageRegistry.addName(chickensandwich, "Chicken Sandwich");
        	LanguageRegistry.addName(steaksandwich, "Steak Sandwich");
        	LanguageRegistry.addName(hamsandwich, "Ham Sandwich");
        	LanguageRegistry.addName(supersandwich, "Super Sandwich");
        	LanguageRegistry.addName(chickenbit, "Slice of Chicken");
        	LanguageRegistry.addName(steakbit, "Slice of Steak");
        	LanguageRegistry.addName(porkbit, "Slice of Ham");
        	LanguageRegistry.addName(tomatoseeds, "Tomato Seeds");
        	LanguageRegistry.addName(tomatofruit, "Tomato");
        	LanguageRegistry.addName(rawbacon, "Raw Bacon");
        	LanguageRegistry.addName(rawchickenbit, "Raw Slice of Chicken");
        	LanguageRegistry.addName(rawsteakbit, "Raw Slice of Steak");
        	LanguageRegistry.addName(rawporkbit, "Raw Slice of Ham");
        	LanguageRegistry.addName(knife, "Knife");
        }
        //Crafting Recipes
        public void craftingRecipes(){
        	//Cooked meat slices
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.breadslice, 6), new ItemStack(ItemFood.bread));
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.chickenbit, 3), new Object[]{ItemFood.chickenCooked, (new ItemStack(knife, 1, 0 ))});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.steakbit, 3), new Object[]{ItemFood.beefCooked, (new ItemStack(knife, 1, 0))});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.porkbit, 3), new Object[]{ItemFood.porkCooked, (new ItemStack(knife, 1, 0))});
        	//Raw Meat Slices
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawchickenbit, 3), new Object[]{ItemFood.chickenRaw, (new ItemStack(knife, 1, 0))});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawsteakbit, 3), new Object[]{ItemFood.beefRaw, (new ItemStack(knife, 1, 0))});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawporkbit, 3), new Object[]{ItemFood.porkRaw, (new ItemStack(knife, 1, 0))});
        	//Sandwiches
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawchickenbit, 3), new ItemStack(ItemFood.chickenRaw));
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawsteakbit, 3), new ItemStack(ItemFood.beefRaw));
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawporkbit, 3), new ItemStack(ItemFood.porkRaw));
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.chickensandwich, 1), new Object[]{" B ", " C ", " B ", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked });
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.steaksandwich, 1), new Object[]{" B ", " S ", " B ", 'B', MineEdibles.breadslice, 'S', ItemFood.beefCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.hamsandwich, 1), new Object[]{" B ", " P ", " B ", 'B', MineEdibles.breadslice, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CSP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "SCP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "PSC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "SPC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "PSC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CPS", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CSP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CPS", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        
        	
        }
        @EventHandler
        public void postInit(FMLPostInitializationEvent event) {
                
        }
}

 

CraftingHandlerClass for the Item Knife

 

package mydeblob.mineedibles;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.ICraftingHandler;

public class KnifeCraftingHandler implements ICraftingHandler {

@Override
public void onCrafting(EntityPlayer player, ItemStack item,
		IInventory craftMatrix) {
	for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {

		if (craftMatrix.getStackInSlot(i) != null) {
			ItemStack j = craftMatrix.getStackInSlot(i);

			if (j.getItem() != null && j.getItem() == MineEdibles.knife) {
				ItemStack k = new ItemStack(MineEdibles.knife, 2, (j.getItemDamage() + 1));

				if (k.getItemDamage() >= k.getMaxDamage()) {
					k.stackSize--;
				}
				craftMatrix.setInventorySlotContents(i, k);
			}
		}
	}

}

@Override
public void onSmelting(EntityPlayer player, ItemStack item) {
	// TODO Auto-generated method stub

}

}

 

Link to comment
Share on other sites

No need for a crafting handler. In your ItemKnife.java:

 

@Override
public ItemStack getContainerItemStack(ItemStack itemStack)
{
	int alter = itemStack.getItemDamage() - 1;
	if(alter >= itemStack.getMaxDamage())
	{
		return null;
	}
	itemStack.setItemDamage(alter);
	return itemStack;
}

 

Will return the same stack that was used with the damage minus 1. If the changed damage is greater/equal compared to the maximum allowed damage, will 'break' the item by returning null.

Link to comment
Share on other sites

Ok, I must be doing something wrong... I copied your code, and removed the craftinghandler class and now when I use the knife to craft something it allows me to use it once and then it disappears. Here is the new code

ItemKnife Class

 

package mydeblob.mineedibles;

import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.block.BlockCocoa;
import net.minecraft.block.BlockColored;
import net.minecraft.block.BlockCrops;
import net.minecraft.block.BlockDirectional;
import net.minecraft.block.BlockLog;
import net.minecraft.block.BlockMushroom;
import net.minecraft.block.BlockSapling;
import net.minecraft.block.BlockStem;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.FakePlayerFactory;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.entity.player.BonemealEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ItemKnife extends Item
{

public ItemKnife(int par1) {
	super(par1);
	setMaxDamage(64);
	setMaxStackSize(1);
	setCreativeTab(CreativeTabs.tabTools);
}
@Override
public ItemStack getContainerItemStack(ItemStack itemStack)
{
	int alter = itemStack.getItemDamage() - 1;
	if(alter >= itemStack.getMaxDamage())
	{
		return null;
	}
	itemStack.setItemDamage(alter);
	return itemStack;
}
    
}

 

MainClass

 

package mydeblob.mineedibles;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;

@Mod(modid="mineedibles", name="MineEdibles", version="1.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class MineEdibles {


        // The instance of your mod that Forge uses.
        @Instance("Sandwich")
        public static MineEdibles instance;
        private static Item breadslice;
        private static Item chickensandwich;
        private static Item steaksandwich;
        private static Item hamsandwich;
        private static Item supersandwich;
        private static Item chickenbit;
        private static Item steakbit;
        private static Item porkbit;
        public static Item tomatoseeds;
        public static Item tomatofruit;
        public static Block tomatocrop;
        public static Item rawbacon;
        private static Item cookedbacon;
        private static Item rawchickenbit;
        private static Item rawsteakbit;
        private static Item rawporkbit;
        public static Item knife;
        
        //Item Ids for the config file
        int breadsliceID;
        int chickensandwichID;
        int steaksandwichID;
        int hamsandwichID;
        int supersandwichID;
        int chickenbitID;
        int steakbitID;
        int porkbitID;
        int tomatoseedsID;
        int tomatocropID;
        int tomatofruitID;
        int rawbaconID;
        int cookedbaconID;
        int rawchickenbitID;
        int rawsteakbitID;
        int rawporkbitID;
        int knifeID;

        
        // Says where the client and server 'proxy' code is loaded.
        @SidedProxy(clientSide="mydeblob.mineedibles.client.ClientProxy", serverSide="mydeblob.mineedibles.CommonProxy")
        public static CommonProxy proxy;
        
        @EventHandler
        public void preInit(FMLPreInitializationEvent event) {
        	//Basic Configuration file
        	Configuration config = new Configuration(event.getSuggestedConfigurationFile());
        	config.load();
        	breadsliceID = config.get("Item IDs", "Bread Slice", 5000).getInt();
        	chickensandwichID = config.get("Item IDs", "Chicken Sandwich", 5001).getInt();
        	steaksandwichID = config.get("Item IDs", "Steak Sandwich", 5002).getInt();
        	hamsandwichID = config.get("Item IDs", "Ham Sandwich", 5003).getInt();
        	supersandwichID = config.get("Item IDs", "Super Sandwich", 5004).getInt();
        	chickenbitID = config.get("Item IDs", "Slice of Chicken", 5005).getInt();
        	steakbitID = config.get("Item IDs", "Slice of Steak", 5006).getInt();
        	porkbitID = config.get("Item IDs", "Slice of Pork", 5007).getInt();
        	tomatoseedsID = config.get("Item IDs", "Tomato Seeds", 5008).getInt();
        	tomatofruitID = config.get("Item IDs", "Tomato Fruit", 5009).getInt();
        	rawbaconID = config.get("Item IDs", "Raw Bacon", 50010).getInt();
        	cookedbaconID = config.get("Item IDs", "Cooked Bacon", 5011).getInt();
        	rawchickenbitID = config.get("Item IDs", "Raw Slice of Chicken", 5012).getInt();
        	rawsteakbitID = config.get("Item IDs", "Raw Slice of Beef", 5013).getInt();
        	rawporkbitID = config.get("Item IDs", "Raw Slice of Ham", 5014).getInt();
        	knifeID = config.get("Item IDs", "Knife", 5015).getInt();
        	config.save();
        }
        
        @EventHandler
        public void load(FMLInitializationEvent event) {
                proxy.registerRenderers();
                //Items
               breadslice = new Item(breadsliceID).setUnlocalizedName("breadslice").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:slicebread");
               chickensandwich = new ItemFood(chickensandwichID, 9, 0.8f, false).setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("chickensandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:chickensandwich");
               steaksandwich = new ItemFood(steaksandwichID, 9, 0.8f, false).setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("steaksandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:steaksandwich");
               hamsandwich = new ItemFood(hamsandwichID, 9, 0.8f, false).setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("hamsandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:hamsandwich");
               supersandwich = new ItemFood(supersandwichID, 18, 1.4f, false).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 6, 1, 0.8f).setPotionEffect(Potion.moveSpeed.id, 6, 1, 0.8f).setUnlocalizedName("supersandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:supersandwich");
               chickenbit = new ItemFood(chickenbitID, 2, 0.4f, false).setUnlocalizedName("chickenbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:chickenbit");
               steakbit = new ItemFood(steakbitID, 2, 0.4f, false).setUnlocalizedName("steakbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:steakbit");
               porkbit = new ItemFood(porkbitID, 2, 0.4f, false).setUnlocalizedName("porkbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:porkbit");
               tomatocrop = new TomatoCrop(tomatocropID).setUnlocalizedName("tomatocrop").func_111022_d("mineedibles:tomatocrop");
               tomatoseeds = new ItemSeeds(tomatoseedsID, tomatocrop.blockID, Block.tilledField.blockID).setUnlocalizedName("tomatoseeds").func_111206_d("mineedibles:tomatoseeds");
               tomatofruit = new ItemFood(tomatofruitID, 6, 0.8f, false).setUnlocalizedName("tomatofruit").func_111206_d("mineedibles:tomatofruit");
               rawbacon = new ItemFood(rawbaconID, 3, 0.3f, false).setUnlocalizedName("baconraw").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawbacon");
               cookedbacon = new ItemFood(cookedbaconID, 7, 0.6f, false).setUnlocalizedName("baconcooked").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:cookedbacon");
               rawchickenbit = new ItemFood(rawchickenbitID, 1, 0.2f, false).setUnlocalizedName("rawchickenbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawchickenbit");
               rawsteakbit = new ItemFood(rawsteakbitID, 1, 0.2f, false).setUnlocalizedName("rawsteakbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawsteakbit");
               rawporkbit = new ItemFood(rawporkbitID, 1, 0.2f, false).setUnlocalizedName("rawporkbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawporkbit");
               knife = new ItemKnife(knifeID).setUnlocalizedName("knife").func_111206_d("mineedibles:knifeBlack");
               MinecraftForge.addGrassSeed(new ItemStack (tomatoseeds), 10);
               gameRegisters();
               languageRegisters();
               craftingRecipes();
               	//Smelting
               GameRegistry.addSmelting(MineEdibles.rawbacon.itemID, new ItemStack(MineEdibles.cookedbacon, 1), 0.1f);
               GameRegistry.addSmelting(MineEdibles.rawchickenbit.itemID, new ItemStack(MineEdibles.chickenbit, 1), 0.1f);
               GameRegistry.addSmelting(MineEdibles.rawsteakbit.itemID, new ItemStack(MineEdibles.steakbit, 1), 0.1f);
               GameRegistry.addSmelting(MineEdibles.rawporkbit.itemID, new ItemStack(MineEdibles.porkbit, 1), 0.1f);




        }

        //Item and Block registeration
        private static void gameRegisters(){
        	GameRegistry.registerItem(breadslice, "Bread Slice");
        	GameRegistry.registerItem(chickensandwich, "Chicken Sandwich");
        	GameRegistry.registerItem(steaksandwich, "Steak Sandwich");
        	GameRegistry.registerItem(hamsandwich, "Ham Sandwich");
        	GameRegistry.registerItem(supersandwich, "Super Sandwich");
        	GameRegistry.registerItem(chickenbit, "Slice of Chicken");
        	GameRegistry.registerItem(steakbit, "Slice of Steak");
        	GameRegistry.registerItem(porkbit, "Slice of Ham");
        	GameRegistry.registerItem(tomatoseeds, "Tomato Seeds");
        	GameRegistry.registerItem(tomatofruit, "Tomato");
        	GameRegistry.registerBlock(tomatocrop, "Tomato Crop");
        	GameRegistry.registerItem(rawbacon, "Raw Bacon");
        	GameRegistry.registerItem(cookedbacon, "Cooked Bacon");
        	GameRegistry.registerItem(rawchickenbit, "Raw Slice of Chicken");
        	GameRegistry.registerItem(rawsteakbit, "Raw Slice of Steak");
        	GameRegistry.registerItem(rawporkbit, "Raw Slice of Ham");
        	GameRegistry.registerItem(knife, "Knife");

        }
        //Item and Block in game name, languageregistry
        private static void languageRegisters(){
        	LanguageRegistry.addName(breadslice, "Bread Slice");
        	LanguageRegistry.addName(chickensandwich, "Chicken Sandwich");
        	LanguageRegistry.addName(steaksandwich, "Steak Sandwich");
        	LanguageRegistry.addName(hamsandwich, "Ham Sandwich");
        	LanguageRegistry.addName(supersandwich, "Super Sandwich");
        	LanguageRegistry.addName(chickenbit, "Slice of Chicken");
        	LanguageRegistry.addName(steakbit, "Slice of Steak");
        	LanguageRegistry.addName(porkbit, "Slice of Ham");
        	LanguageRegistry.addName(tomatoseeds, "Tomato Seeds");
        	LanguageRegistry.addName(tomatofruit, "Tomato");
        	LanguageRegistry.addName(rawbacon, "Raw Bacon");
        	LanguageRegistry.addName(rawchickenbit, "Raw Slice of Chicken");
        	LanguageRegistry.addName(rawsteakbit, "Raw Slice of Steak");
        	LanguageRegistry.addName(rawporkbit, "Raw Slice of Ham");
        	LanguageRegistry.addName(knife, "Knife");
        }
        //Crafting Recipes
        public void craftingRecipes(){
        	//Cooked meat slices
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.breadslice, 6), new ItemStack(ItemFood.bread));
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.chickenbit, 3), new Object[]{ItemFood.chickenCooked, knife});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.steakbit, 3), new Object[]{ItemFood.beefCooked, (new ItemStack(knife, 1, 0))});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.porkbit, 3), new Object[]{ItemFood.porkCooked, (new ItemStack(knife, 1, 0))});
        	//Raw Meat Slices
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawchickenbit, 3), new Object[]{ItemFood.chickenRaw, (new ItemStack(knife, 1, 0))});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawsteakbit, 3), new Object[]{ItemFood.beefRaw, (new ItemStack(knife, 1, 0))});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawporkbit, 3), new Object[]{ItemFood.porkRaw, (new ItemStack(knife, 1, 0))});
        	//Sandwiches
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawchickenbit, 3), new ItemStack(ItemFood.chickenRaw));
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawsteakbit, 3), new ItemStack(ItemFood.beefRaw));
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawporkbit, 3), new ItemStack(ItemFood.porkRaw));
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.chickensandwich, 1), new Object[]{" B ", " C ", " B ", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked });
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.steaksandwich, 1), new Object[]{" B ", " S ", " B ", 'B', MineEdibles.breadslice, 'S', ItemFood.beefCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.hamsandwich, 1), new Object[]{" B ", " P ", " B ", 'B', MineEdibles.breadslice, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CSP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "SCP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "PSC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "SPC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "PSC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CPS", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CSP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CPS", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        
        	
        }
        @EventHandler
        public void postInit(FMLPostInitializationEvent event) {
                
        }
}

 

I appreciate your help

Link to comment
Share on other sites

Ok, Its only letting me use it once and then it is braking. Maybe something with the crafting recipes?

Heres the new code:

ItemKnife class

 

package mydeblob.mineedibles;

import net.minecraft.item.ItemStack;

public class ItemKnife extends ItemME{

public ItemKnife(int par1, String par2) {
	super(par1, par2);

}
@Override
public boolean hasContainerItem()
{
     return true;
}
@Override
public ItemStack getContainerItemStack(ItemStack itemStack)
{
	int alter = itemStack.getItemDamage() + 1;
	if(alter >= itemStack.getMaxDamage())
	{
		return null;
	}
	itemStack.setItemDamage(alter);
	return itemStack;
}

}

 

Main class

 

package mydeblob.mineedibles;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="mineedibles", name="MineEdibles", version="1.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class MineEdibles {


// The instance of your mod that Forge uses.
@Instance("Sandwich")
public static MineEdibles instance;
private static Item breadslice;
private static Item chickensandwich;
private static Item steaksandwich;
private static Item hamsandwich;
private static Item supersandwich;
private static Item chickenbit;
private static Item steakbit;
private static Item porkbit;
public static Item tomatoseeds;
public static Item tomatofruit;
public static Block tomatocrop;
public static Item rawbacon;
private static Item cookedbacon;
private static Item rawchickenbit;
private static Item rawsteakbit;
private static Item rawporkbit;
public static Item knife;
public static Item cream;

//Item Ids for the config file
int breadsliceID;
int chickensandwichID;
int steaksandwichID;
int hamsandwichID;
int supersandwichID;
int chickenbitID;
int steakbitID;
int porkbitID;
int tomatoseedsID;
int tomatocropID;
int tomatofruitID;
int rawbaconID;
int cookedbaconID;
int rawchickenbitID;
int rawsteakbitID;
int rawporkbitID;
int knifeID;
int creamID;


// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="mydeblob.mineedibles.client.ClientProxy", serverSide="mydeblob.mineedibles.CommonProxy")
public static CommonProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	//Basic Configuration file
	Configuration config = new Configuration(event.getSuggestedConfigurationFile());
	config.load();
	breadsliceID = config.get("Item IDs", "Bread Slice", 5000).getInt();
	chickensandwichID = config.get("Item IDs", "Chicken Sandwich", 5001).getInt();
	steaksandwichID = config.get("Item IDs", "Steak Sandwich", 5002).getInt();
	hamsandwichID = config.get("Item IDs", "Ham Sandwich", 5003).getInt();
	supersandwichID = config.get("Item IDs", "Super Sandwich", 5004).getInt();
	chickenbitID = config.get("Item IDs", "Slice of Chicken", 5005).getInt();
	steakbitID = config.get("Item IDs", "Slice of Steak", 5006).getInt();
	porkbitID = config.get("Item IDs", "Slice of Pork", 5007).getInt();
	tomatoseedsID = config.get("Item IDs", "Tomato Seeds", 5008).getInt();
	tomatocropID = config.get("Block IDs", "Tomato Crop", 500).getInt();
	tomatofruitID = config.get("Item IDs", "Tomato Fruit", 5009).getInt();
	rawbaconID = config.get("Item IDs", "Raw Bacon", 5010).getInt();
	cookedbaconID = config.get("Item IDs", "Cooked Bacon", 5011).getInt();
	rawchickenbitID = config.get("Item IDs", "Raw Slice of Chicken", 5012).getInt();
	rawsteakbitID = config.get("Item IDs", "Raw Slice of Beef", 5013).getInt();
	rawporkbitID = config.get("Item IDs", "Raw Slice of Ham", 5014).getInt();
	knifeID = config.get("Item IDs", "Knife", 5015).getInt();
	knifeID = config.get("Item IDs", "Bucket of Cream", 5016).getInt();
	config.save();
}

@EventHandler
public void load(FMLInitializationEvent event) {
	proxy.register();
	//Items
	breadslice = new ItemME(breadsliceID, "breadslice").setUnlocalizedName("breadslice").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood);
	chickensandwich = new ItemFoodME(chickensandwichID, 9, 0.8f, false, "chickensandwich").setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("chickensandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood);
	steaksandwich = new ItemFoodME(steaksandwichID, 9, 0.8f, false, "steaksandwich").setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("steaksandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood);
	hamsandwich = new ItemFoodME(hamsandwichID, 9, 0.8f, false, "hamsandwich").setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("hamsandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood);
	supersandwich = new ItemFoodME(supersandwichID, 18, 1.4f, false, "supersandwich").setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 6, 1, 0.8f).setPotionEffect(Potion.moveSpeed.id, 6, 1, 0.8f).setUnlocalizedName("supersandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood);
	chickenbit = new ItemFoodME(chickenbitID, 2, 0.4f, false, "chickenbit").setUnlocalizedName("chickenbit").setCreativeTab(CreativeTabs.tabFood);
	steakbit = new ItemFoodME(steakbitID, 2, 0.4f, false, "steakbit").setUnlocalizedName("steakbit").setCreativeTab(CreativeTabs.tabFood);
	porkbit = new ItemFoodME(porkbitID, 2, 0.4f, false, "porkbit").setUnlocalizedName("porkbit").setCreativeTab(CreativeTabs.tabFood);
	tomatocrop = new BlockCropME(tomatocropID, "tomatocrop", this.tomatoseedsID, this.tomatocropID).setUnlocalizedName("tomatocrop");
	tomatoseeds = new ItemSeedsME(tomatoseedsID, tomatocrop.blockID, 60).setUnlocalizedName("tomatoseeds").func_111206_d("mineedibles:tomatoseeds");
	tomatofruit = new ItemFoodME(tomatofruitID, 6, 0.8f, false, "tomatofruit").setUnlocalizedName("tomatofruit");
	rawbacon = new ItemFoodME(rawbaconID, 3, 0.3f, false, "rawbacon").setUnlocalizedName("baconraw").setCreativeTab(CreativeTabs.tabFood);
	cookedbacon = new ItemFoodME(cookedbaconID, 7, 0.6f, false, "cookedbacon").setUnlocalizedName("baconcooked").setCreativeTab(CreativeTabs.tabFood);
	rawchickenbit = new ItemFoodME(rawchickenbitID, 1, 0.2f, false, "rawchickenbit").setUnlocalizedName("rawchickenbit").setCreativeTab(CreativeTabs.tabFood);
	rawsteakbit = new ItemFoodME(rawsteakbitID, 1, 0.2f, false, "rawsteakbit").setUnlocalizedName("rawsteakbit").setCreativeTab(CreativeTabs.tabFood);
	rawporkbit = new ItemFoodME(rawporkbitID, 1, 0.2f, false, "rawporkbit").setUnlocalizedName("rawporkbit").setCreativeTab(CreativeTabs.tabFood);
	knife = new ItemME(knifeID, "knifeBlack").setUnlocalizedName("knifeBlack").setMaxDamage(64).setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools);
	cream = new ItemCream(creamID, "cream").setUnlocalizedName("cream");
	MinecraftForge.addGrassSeed(new ItemStack (tomatoseeds), 10);
	gameRegisters();
	languageRegisters();
	craftingRecipes();
	//Smelting
	GameRegistry.addSmelting(MineEdibles.rawbacon.itemID, new ItemStack(MineEdibles.cookedbacon, 1), 0.1f);
	GameRegistry.addSmelting(MineEdibles.rawchickenbit.itemID, new ItemStack(MineEdibles.chickenbit, 1), 0.1f);
	GameRegistry.addSmelting(MineEdibles.rawsteakbit.itemID, new ItemStack(MineEdibles.steakbit, 1), 0.1f);
	GameRegistry.addSmelting(MineEdibles.rawporkbit.itemID, new ItemStack(MineEdibles.porkbit, 1), 0.1f);




}

//Item and Block registeration
private static void gameRegisters(){
	GameRegistry.registerItem(breadslice, "Bread Slice");
	GameRegistry.registerItem(chickensandwich, "Chicken Sandwich");
	GameRegistry.registerItem(steaksandwich, "Steak Sandwich");
	GameRegistry.registerItem(hamsandwich, "Ham Sandwich");
	GameRegistry.registerItem(supersandwich, "Super Sandwich");
	GameRegistry.registerItem(chickenbit, "Slice of Chicken");
	GameRegistry.registerItem(steakbit, "Slice of Steak");
	GameRegistry.registerItem(porkbit, "Slice of Ham");
	GameRegistry.registerItem(tomatoseeds, "Tomato Seeds");
	GameRegistry.registerItem(tomatofruit, "Tomato");
	GameRegistry.registerBlock(tomatocrop, "Tomato Crop");
	GameRegistry.registerItem(rawbacon, "Raw Bacon");
	GameRegistry.registerItem(cookedbacon, "Cooked Bacon");
	GameRegistry.registerItem(rawchickenbit, "Raw Slice of Chicken");
	GameRegistry.registerItem(rawsteakbit, "Raw Slice of Steak");
	GameRegistry.registerItem(rawporkbit, "Raw Slice of Ham");
	GameRegistry.registerItem(knife, "Knife");

}
//Item and Block in game name, languageregistry
private static void languageRegisters(){
	LanguageRegistry.addName(breadslice, "Bread Slice");
	LanguageRegistry.addName(chickensandwich, "Chicken Sandwich");
	LanguageRegistry.addName(steaksandwich, "Steak Sandwich");
	LanguageRegistry.addName(hamsandwich, "Ham Sandwich");
	LanguageRegistry.addName(supersandwich, "Super Sandwich");
	LanguageRegistry.addName(chickenbit, "Slice of Chicken");
	LanguageRegistry.addName(steakbit, "Slice of Steak");
	LanguageRegistry.addName(porkbit, "Slice of Ham");
	LanguageRegistry.addName(tomatoseeds, "Tomato Seeds");
	LanguageRegistry.addName(tomatofruit, "Tomato");
	LanguageRegistry.addName(rawbacon, "Raw Bacon");
	LanguageRegistry.addName(cookedbacon, "Cooked Bacon");
	LanguageRegistry.addName(rawchickenbit, "Raw Slice of Chicken");
	LanguageRegistry.addName(rawsteakbit, "Raw Slice of Steak");
	LanguageRegistry.addName(rawporkbit, "Raw Slice of Ham");
	LanguageRegistry.addName(knife, "Knife");
}
//Crafting Recipes
public void craftingRecipes(){
	//Cooked meat slices
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.breadslice, 6), new ItemStack(ItemFood.bread));
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.chickenbit, 3), new Object[]{ItemFood.chickenCooked, (new ItemStack(knife, 1, 0))});
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.steakbit, 3), new Object[]{ItemFood.beefCooked, (new ItemStack(knife, 1, 0))});
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.porkbit, 3), new Object[]{ItemFood.porkCooked, (new ItemStack(knife, 1, 0))});
	//Raw Meat Slices
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawchickenbit, 3), new Object[]{ItemFood.chickenRaw, (new ItemStack(knife, 1, 0))});
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawsteakbit, 3), new Object[]{ItemFood.beefRaw, (new ItemStack(knife, 1, 0))});
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawporkbit, 3), new Object[]{ItemFood.porkRaw, (new ItemStack(knife, 1, 0))});
	//Sandwiches
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawchickenbit, 3), new ItemStack(ItemFood.chickenRaw));
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawsteakbit, 3), new ItemStack(ItemFood.beefRaw));
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawporkbit, 3), new ItemStack(ItemFood.porkRaw));
	GameRegistry.addRecipe(new ItemStack(MineEdibles.chickensandwich, 1), new Object[]{" B ", " C ", " B ", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked });
	GameRegistry.addRecipe(new ItemStack(MineEdibles.steaksandwich, 1), new Object[]{" B ", " S ", " B ", 'B', MineEdibles.breadslice, 'S', ItemFood.beefCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.hamsandwich, 1), new Object[]{" B ", " P ", " B ", 'B', MineEdibles.breadslice, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CSP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "SCP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "PSC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "SPC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "PSC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CPS", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CSP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CPS", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	//cream
	GameRegistry.addShapelessRecipe(new ItemStack(MineEdibles.cream, 1), new Object []{ItemFood.bucketMilk, ItemFood.sugar});

}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {

}

 

Link to comment
Share on other sites

Your knife has to have a maxDamage lol. In the constructor or the initialization, add:

 

setMaxDamage(maxDmgInteger);

 

Also, unless you make a new IRecipe instance, you'll have to do this to add your recipes:

 

for(int i = 0; i < knife.getMaxDamage(); i++)
{
     GameRegistry.addRecipe(new ItemStack(myCarvedItem), new Object[]
     {
          "top", "mid", "bot", 't', new ItemStack(knife, 1, i)
     });
}

Obviously that wouldn't be your recipe but any character that represents your knife will need to use i as the damage. This will actually add as many recipes as your item has max damage.

 

Remove:

if(alter > stack.getMaxDamage())
{
	return null;
}

Link to comment
Share on other sites

Still doesn't work :/ I have no idea what I'm doing wrong. Spent about a hour looking through my code looking for any error that would cause it to not work. It still only lets me use it once.

ItemKnife Class

 

package mydeblob.mineedibles;

import net.minecraft.item.ItemStack;

public class ItemKnife extends ItemME{

public ItemKnife(int par1, String par2) {
	super(par1, par2);
	this.setMaxDamage(64);


}
@Override
public boolean hasContainerItem()
{
     return true;
}
@Override
public ItemStack getContainerItemStack(ItemStack itemStack)
{
	int alter = itemStack.getItemDamage() + 1;
	itemStack.setItemDamage(alter);
	return itemStack;
}


}

 

Main Class

 

package mydeblob.mineedibles;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid="mineedibles", name="MineEdibles", version="1.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class MineEdibles {


// The instance of your mod that Forge uses.
@Instance("Sandwich")
public static MineEdibles instance;
public static Item breadslice;
public static Item chickensandwich;
public static Item steaksandwich;
public static Item hamsandwich;
public static Item supersandwich;
public static Item chickenbit;
public static Item steakbit;
public static Item porkbit;
public static Item tomatoseeds;
public static Item tomatofruit;
public static Block tomatocrop;
public static Item rawbacon;
public static Item cookedbacon;
public static Item rawchickenbit;
public static Item rawsteakbit;
public static Item rawporkbit;
public static Item knife;
public static Item cream;
public static Item lettuceseeds;
public static Item lettuce;
public static Block lettucecrop;
public static Item fertilizer;
public static Item manure;


//Item Ids for the config file
int breadsliceID;
int chickensandwichID;
int steaksandwichID;
int hamsandwichID;
int supersandwichID;
int chickenbitID;
int steakbitID;
int porkbitID;
int tomatoseedsID;
int tomatocropID;
int tomatofruitID;
int rawbaconID;
int cookedbaconID;
int rawchickenbitID;
int rawsteakbitID;
int rawporkbitID;
int knifeID;
int creamID;
int lettuceseedsID;
int lettuceID;
int lettucecropID;
int fertilizerID;
int manureID;

public static CreativeTabs tabMineEdibles = new CreativeTabs("tabMineEdibles")
{
	public ItemStack getIconItemStack()
	{
		return new ItemStack(hamsandwich, 1);
	}
};


// Says where the client and server 'proxy' code is loaded.
@SidedProxy(clientSide="mydeblob.mineedibles.client.ClientProxy", serverSide="mydeblob.mineedibles.CommonProxy")
public static CommonProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	//Basic Configuration file
	Configuration config = new Configuration(event.getSuggestedConfigurationFile());
	config.load();
	breadsliceID = config.get("Item IDs", "Bread Slice", 5000).getInt();
	chickensandwichID = config.get("Item IDs", "Chicken Sandwich", 5001).getInt();
	steaksandwichID = config.get("Item IDs", "Steak Sandwich", 5002).getInt();
	hamsandwichID = config.get("Item IDs", "Ham Sandwich", 5003).getInt();
	supersandwichID = config.get("Item IDs", "Super Sandwich", 5004).getInt();
	chickenbitID = config.get("Item IDs", "Slice of Chicken", 5005).getInt();
	steakbitID = config.get("Item IDs", "Slice of Steak", 5006).getInt();
	porkbitID = config.get("Item IDs", "Slice of Pork", 5007).getInt();
	tomatoseedsID = config.get("Item IDs", "Tomato Seeds", 5008).getInt();
	tomatocropID = config.get("Block IDs", "Tomato Crop", 500).getInt();
	tomatofruitID = config.get("Item IDs", "Tomato Fruit", 5009).getInt();
	rawbaconID = config.get("Item IDs", "Raw Bacon", 5010).getInt();
	cookedbaconID = config.get("Item IDs", "Cooked Bacon", 5011).getInt();
	rawchickenbitID = config.get("Item IDs", "Raw Slice of Chicken", 5012).getInt();
	rawsteakbitID = config.get("Item IDs", "Raw Slice of Beef", 5013).getInt();
	rawporkbitID = config.get("Item IDs", "Raw Slice of Ham", 5014).getInt();
	knifeID = config.get("Item IDs", "Knife", 5015).getInt();
	creamID = config.get("Item IDs", "Bucket of Cream", 5016).getInt();
	lettuceseedsID = config.get("Item IDs", "Lettuce Seeds", 5017).getInt();
	lettuceID = config.get("Item IDs", "Lettuce", 5018).getInt();
	lettucecropID = config.get("Block IDs", "Lettuce Crop", 501).getInt();
	fertilizerID = config.get("Item IDs", "Fertilizer", 5019).getInt();
	manureID = config.get("Item IDs", "Manure", 5020).getInt();
	config.save();
}

@EventHandler
public void load(FMLInitializationEvent event) {
	proxy.register();
	//Items
	breadslice = new ItemME(breadsliceID, "breadslice").setUnlocalizedName("breadslice").setMaxStackSize(64).setCreativeTab(tabMineEdibles);
	chickensandwich = new ItemFoodME(chickensandwichID, 9, 0.8f, false, "chickensandwich").setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("chickensandwich").setMaxStackSize(64).setCreativeTab(tabMineEdibles);
	steaksandwich = new ItemFoodME(steaksandwichID, 9, 0.8f, false, "steaksandwich").setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("steaksandwich").setMaxStackSize(64).setCreativeTab(tabMineEdibles);
	hamsandwich = new ItemFoodME(hamsandwichID, 9, 0.8f, false, "hamsandwich").setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("hamsandwich").setMaxStackSize(64).setCreativeTab(tabMineEdibles);
	supersandwich = new ItemFoodME(supersandwichID, 18, 1.4f, false, "supersandwich").setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 6, 1, 0.8f).setPotionEffect(Potion.moveSpeed.id, 6, 1, 0.8f).setUnlocalizedName("supersandwich").setMaxStackSize(64).setCreativeTab(tabMineEdibles);
	chickenbit = new ItemFoodME(chickenbitID, 2, 0.4f, false, "chickenbit").setUnlocalizedName("chickenbit").setCreativeTab(tabMineEdibles);
	steakbit = new ItemFoodME(steakbitID, 2, 0.4f, false, "steakbit").setUnlocalizedName("steakbit").setCreativeTab(tabMineEdibles);
	porkbit = new ItemFoodME(porkbitID, 2, 0.4f, false, "porkbit").setUnlocalizedName("porkbit").setCreativeTab(tabMineEdibles);
	tomatocrop = new BlockCropME(tomatocropID, "tomatocrop", this.tomatoseedsID, this.tomatocropID, .setUnlocalizedName("tomatocrop");
	tomatoseeds = new ItemSeedsME(tomatoseedsID, tomatocrop.blockID, 60, "tomatoseeds").setUnlocalizedName("tomatoseeds").setCreativeTab(tabMineEdibles);
	tomatofruit = new ItemFoodME(tomatofruitID, 6, 0.8f, false, "tomatofruit").setUnlocalizedName("tomatofruit").setCreativeTab(tabMineEdibles);
	rawbacon = new ItemFoodME(rawbaconID, 3, 0.3f, false, "rawbacon").setUnlocalizedName("baconraw").setCreativeTab(tabMineEdibles);
	cookedbacon = new ItemFoodME(cookedbaconID, 7, 0.6f, false, "cookedbacon").setUnlocalizedName("baconcooked").setCreativeTab(tabMineEdibles);
	rawchickenbit = new ItemFoodME(rawchickenbitID, 1, 0.2f, false, "rawchickenbit").setUnlocalizedName("rawchickenbit").setCreativeTab(tabMineEdibles);
	rawsteakbit = new ItemFoodME(rawsteakbitID, 1, 0.2f, false, "rawsteakbit").setUnlocalizedName("rawsteakbit").setCreativeTab(tabMineEdibles);
	rawporkbit = new ItemFoodME(rawporkbitID, 1, 0.2f, false, "rawporkbit").setUnlocalizedName("rawporkbit").setCreativeTab(tabMineEdibles);
	knife = new ItemME(knifeID, "knifeBlack").setUnlocalizedName("knifeBlack").setMaxStackSize(1).setCreativeTab(tabMineEdibles);
	cream = new ItemCream(creamID, "cream").setUnlocalizedName("cream").setCreativeTab(tabMineEdibles);
	lettucecrop = new BlockCropME(lettucecropID, "lettucecrop", this.lettuceseedsID, this.lettucecropID, 5).setUnlocalizedName("lettucecrop");
	lettuceseeds = new ItemSeedsME(lettuceseedsID, lettucecrop.blockID, 60, "lettuceseeds").setUnlocalizedName("lettuceseeds").setCreativeTab(tabMineEdibles);
	lettuce = new ItemFoodME(lettuceID, 6, 0.8f, false, "lettuce").setUnlocalizedName("lettuce").setCreativeTab(tabMineEdibles);
	fertilizer = new ItemFertilizer(fertilizerID, "fertilizer").setUnlocalizedName("fertilizer").setCreativeTab(tabMineEdibles);
	manure = new ItemME(manureID, "manure").setUnlocalizedName("manure").setCreativeTab(tabMineEdibles);
	MinecraftForge.addGrassSeed(new ItemStack (tomatoseeds), 10);
	gameRegisters();
	languageRegisters();
	craftingRecipes();
	//Smelting
	GameRegistry.addSmelting(MineEdibles.rawbacon.itemID, new ItemStack(MineEdibles.cookedbacon, 1), 0.1f);
	GameRegistry.addSmelting(MineEdibles.rawchickenbit.itemID, new ItemStack(MineEdibles.chickenbit, 1), 0.1f);
	GameRegistry.addSmelting(MineEdibles.rawsteakbit.itemID, new ItemStack(MineEdibles.steakbit, 1), 0.1f);
	GameRegistry.addSmelting(MineEdibles.rawporkbit.itemID, new ItemStack(MineEdibles.porkbit, 1), 0.1f);




}

//Item and Block registeration
private static void gameRegisters(){
	GameRegistry.registerItem(breadslice, "Bread Slice");
	GameRegistry.registerItem(chickensandwich, "Chicken Sandwich");
	GameRegistry.registerItem(steaksandwich, "Steak Sandwich");
	GameRegistry.registerItem(hamsandwich, "Ham Sandwich");
	GameRegistry.registerItem(supersandwich, "Super Sandwich");
	GameRegistry.registerItem(chickenbit, "Slice of Chicken");
	GameRegistry.registerItem(steakbit, "Slice of Steak");
	GameRegistry.registerItem(porkbit, "Slice of Ham");
	GameRegistry.registerItem(tomatoseeds, "Tomato Seeds");
	GameRegistry.registerItem(tomatofruit, "Tomato");
	GameRegistry.registerBlock(tomatocrop, "Tomato Crop");
	GameRegistry.registerItem(rawbacon, "Raw Bacon");
	GameRegistry.registerItem(cookedbacon, "Cooked Bacon");
	GameRegistry.registerItem(rawchickenbit, "Raw Slice of Chicken");
	GameRegistry.registerItem(rawsteakbit, "Raw Slice of Steak");
	GameRegistry.registerItem(rawporkbit, "Raw Slice of Ham");
	GameRegistry.registerItem(knife, "Knife");
	GameRegistry.registerItem(lettuceseeds, "Lettuce Seeds");
	GameRegistry.registerItem(lettuce, "Lettuce Fruit");
	GameRegistry.registerBlock(lettucecrop, "Lettuce Crop");
	GameRegistry.registerItem(fertilizer, "Fertilizer");
	GameRegistry.registerItem(manure, "Manure");

}
//Item and Block in game name, language registry
private static void languageRegisters(){
	LanguageRegistry.addName(breadslice, "Bread Slice");
	LanguageRegistry.addName(chickensandwich, "Chicken Sandwich");
	LanguageRegistry.addName(steaksandwich, "Steak Sandwich");
	LanguageRegistry.addName(hamsandwich, "Ham Sandwich");
	LanguageRegistry.addName(supersandwich, "Super Sandwich");
	LanguageRegistry.addName(chickenbit, "Slice of Chicken");
	LanguageRegistry.addName(steakbit, "Slice of Steak");
	LanguageRegistry.addName(porkbit, "Slice of Ham");
	LanguageRegistry.addName(tomatoseeds, "Tomato Seeds");
	LanguageRegistry.addName(tomatofruit, "Tomato");
	LanguageRegistry.addName(rawbacon, "Raw Bacon");
	LanguageRegistry.addName(cookedbacon, "Cooked Bacon");
	LanguageRegistry.addName(rawchickenbit, "Raw Slice of Chicken");
	LanguageRegistry.addName(rawsteakbit, "Raw Slice of Steak");
	LanguageRegistry.addName(rawporkbit, "Raw Slice of Ham");
	LanguageRegistry.addName(knife, "Knife");
	LanguageRegistry.addName(lettuceseeds, "Lettuce Seeds");
	LanguageRegistry.addName(lettuce, "Lettuce");
	LanguageRegistry.addName(fertilizer, "Fertilizer");
	LanguageRegistry.addName(manure, "Manure");
	LanguageRegistry.instance().addStringLocalization("itemGroup.tabMineEdibles", "en_US", "MineEdibles");
}
//Crafting Recipes
public void craftingRecipes(){
	//Cooked meat slices
	for(int i = 0; i < knife.getMaxDamage(); i++)

	{
		GameRegistry.addShapelessRecipe(new ItemStack(MineEdibles.chickenbit, 3), new Object[]{ItemFood.chickenCooked, (new ItemStack(knife, 1, i))});
	}
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.breadslice, 6), new ItemStack(ItemFood.bread));
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.chickenbit, 3), new Object[]{ItemFood.chickenCooked, (new ItemStack(knife, 1, 0))});
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.steakbit, 3), new Object[]{ItemFood.beefCooked, (new ItemStack(knife, 1, 0))});
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.porkbit, 3), new Object[]{ItemFood.porkCooked, (new ItemStack(knife, 1, 0))});
	//Raw Meat Slices
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawchickenbit, 3), new Object[]{ItemFood.chickenRaw, (new ItemStack(knife, 1, 0))});
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawsteakbit, 3), new Object[]{ItemFood.beefRaw, (new ItemStack(knife, 1, 0))});
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawporkbit, 3), new Object[]{ItemFood.porkRaw, (new ItemStack(knife, 1, 0))});
	//Sandwiches
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawchickenbit, 3), new ItemStack(ItemFood.chickenRaw));
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawsteakbit, 3), new ItemStack(ItemFood.beefRaw));
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawporkbit, 3), new ItemStack(ItemFood.porkRaw));
	GameRegistry.addRecipe(new ItemStack(MineEdibles.chickensandwich, 1), new Object[]{" B ", " C ", " B ", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked });
	GameRegistry.addRecipe(new ItemStack(MineEdibles.steaksandwich, 1), new Object[]{" B ", " S ", " B ", 'B', MineEdibles.breadslice, 'S', ItemFood.beefCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.hamsandwich, 1), new Object[]{" B ", " P ", " B ", 'B', MineEdibles.breadslice, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CSP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "SCP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "PSC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "SPC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "PSC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CPS", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CSP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CPS", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
	//creamy goodness
	GameRegistry.addShapelessRecipe(new ItemStack(MineEdibles.cream, 1), new Object []{ItemFood.bucketMilk, ItemFood.sugar});
	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.fertilizer), new Object []{ItemFood.fishRaw, MineEdibles.manure});

}
@EventHandler
public void postInit(FMLPostInitializationEvent event) {

}

 

Link to comment
Share on other sites

Guff is right but his code has mistakes!

 

First everything else 1 which is in the Item class is right.

You should change the - into a + (inside of the getContainerItemStack function) or you get problems^^

But eveything else is wrong what he made!

 

So first you register your item like that:

 

public static Item test = new yourItem(ItemID).setContainerItem(test);

 

now the Recipe!

You do not need to make a for loop. That make only lag. (I know it i made with this way about 2Million Recipes)

Its alot easier!

GameRegistry.addRecipe(new ItemStack(Item.diamond), new Object[]{"X", 'X', new ItemStack(test, 1, OreDictionary.WildCardValue)});

 

The WildCardValue or something like that (look inside of forge ordictionary class for the right name).

Is like 1.4.7 new ItemStack(item, 1,-1) this means he uses any damage he gets.

I hope it helps you,

 

Now to Guff.

You can use ForLoops. But at 100.000 Recipes the craftingtable starts to lag everytime you place or drag an item in/out of the craftingtabel.

 

So why don't you change your recipe because the way i explained makes only 1 recipe instead of how many your ItemDamage is.

Good Luck

Link to comment
Share on other sites

Ya ya, im sure you get ton of these threads, but for some reason this isn't working. Im using forge 1.6.2, and I want an item to take 1 damage out of 64 when used to craft something. I made some code for it but I can only use it 3 times before it won't let me craft anymore but the item still has durability. Thanks for your help.

Base Mod class (the knife item is the one that should be able to be used more than once)

 

package mydeblob.mineedibles;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemFood;
import net.minecraft.item.ItemSeeds;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Init;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PostInit;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.network.NetworkMod;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.MinecraftForge;

@Mod(modid="mineedibles", name="MineEdibles", version="1.0.0")
@NetworkMod(clientSideRequired=true, serverSideRequired=false)
public class MineEdibles {


        // The instance of your mod that Forge uses.
        @Instance("Sandwich")
        public static MineEdibles instance;
        private static Item breadslice;
        private static Item chickensandwich;
        private static Item steaksandwich;
        private static Item hamsandwich;
        private static Item supersandwich;
        private static Item chickenbit;
        private static Item steakbit;
        private static Item porkbit;
        public static Item tomatoseeds;
        public static Item tomatofruit;
        public static Block tomatocrop;
        public static Item rawbacon;
        private static Item cookedbacon;
        private static Item rawchickenbit;
        private static Item rawsteakbit;
        private static Item rawporkbit;
        public static Item knife;
        
        //Item Ids for the config file
        int breadsliceID;
        int chickensandwichID;
        int steaksandwichID;
        int hamsandwichID;
        int supersandwichID;
        int chickenbitID;
        int steakbitID;
        int porkbitID;
        int tomatoseedsID;
        int tomatocropID;
        int tomatofruitID;
        int rawbaconID;
        int cookedbaconID;
        int rawchickenbitID;
        int rawsteakbitID;
        int rawporkbitID;
        int knifeID;

        
        // Says where the client and server 'proxy' code is loaded.
        @SidedProxy(clientSide="mydeblob.mineedibles.client.ClientProxy", serverSide="mydeblob.mineedibles.CommonProxy")
        public static CommonProxy proxy;
        
        @EventHandler
        public void preInit(FMLPreInitializationEvent event) {
        	//Basic Configuration file
        	Configuration config = new Configuration(event.getSuggestedConfigurationFile());
        	config.load();
        	breadsliceID = config.get("Item IDs", "Bread Slice", 5000).getInt();
        	chickensandwichID = config.get("Item IDs", "Chicken Sandwich", 5001).getInt();
        	steaksandwichID = config.get("Item IDs", "Steak Sandwich", 5002).getInt();
        	hamsandwichID = config.get("Item IDs", "Ham Sandwich", 5003).getInt();
        	supersandwichID = config.get("Item IDs", "Super Sandwich", 5004).getInt();
        	chickenbitID = config.get("Item IDs", "Slice of Chicken", 5005).getInt();
        	steakbitID = config.get("Item IDs", "Slice of Steak", 5006).getInt();
        	porkbitID = config.get("Item IDs", "Slice of Pork", 5007).getInt();
        	tomatoseedsID = config.get("Item IDs", "Tomato Seeds", 5008).getInt();
        	tomatofruitID = config.get("Item IDs", "Tomato Fruit", 5009).getInt();
        	rawbaconID = config.get("Item IDs", "Raw Bacon", 50010).getInt();
        	cookedbaconID = config.get("Item IDs", "Cooked Bacon", 5011).getInt();
        	rawchickenbitID = config.get("Item IDs", "Raw Slice of Chicken", 5012).getInt();
        	rawsteakbitID = config.get("Item IDs", "Raw Slice of Beef", 5013).getInt();
        	rawporkbitID = config.get("Item IDs", "Raw Slice of Ham", 5014).getInt();
        	knifeID = config.get("Item IDs", "Knife", 5015).getInt();
        	config.save();
        }
        
        @EventHandler
        public void load(FMLInitializationEvent event) {
                proxy.registerRenderers();
                //Items
               breadslice = new Item(breadsliceID).setUnlocalizedName("breadslice").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:slicebread");
               chickensandwich = new ItemFood(chickensandwichID, 9, 0.8f, false).setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("chickensandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:chickensandwich");
               steaksandwich = new ItemFood(steaksandwichID, 9, 0.8f, false).setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("steaksandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:steaksandwich");
               hamsandwich = new ItemFood(hamsandwichID, 9, 0.8f, false).setPotionEffect(Potion.moveSpeed.id, 4, 0, 0.8f).setUnlocalizedName("hamsandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:hamsandwich");
               supersandwich = new ItemFood(supersandwichID, 18, 1.4f, false).setAlwaysEdible().setPotionEffect(Potion.regeneration.id, 6, 1, 0.8f).setPotionEffect(Potion.moveSpeed.id, 6, 1, 0.8f).setUnlocalizedName("supersandwich").setMaxStackSize(64).setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:supersandwich");
               chickenbit = new ItemFood(chickenbitID, 2, 0.4f, false).setUnlocalizedName("chickenbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:chickenbit");
               steakbit = new ItemFood(steakbitID, 2, 0.4f, false).setUnlocalizedName("steakbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:steakbit");
               porkbit = new ItemFood(porkbitID, 2, 0.4f, false).setUnlocalizedName("porkbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:porkbit");
               tomatocrop = new TomatoCrop(tomatocropID).setUnlocalizedName("tomatocrop").func_111022_d("mineedibles:tomatocrop");
               tomatoseeds = new ItemSeeds(tomatoseedsID, tomatocrop.blockID, Block.tilledField.blockID).setUnlocalizedName("tomatoseeds").func_111206_d("mineedibles:tomatoseeds");
               tomatofruit = new ItemFood(tomatofruitID, 6, 0.8f, false).setUnlocalizedName("tomatofruit").func_111206_d("mineedibles:tomatofruit");
               rawbacon = new ItemFood(rawbaconID, 3, 0.3f, false).setUnlocalizedName("baconraw").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawbacon");
               cookedbacon = new ItemFood(cookedbaconID, 7, 0.6f, false).setUnlocalizedName("baconcooked").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:cookedbacon");
               rawchickenbit = new ItemFood(rawchickenbitID, 1, 0.2f, false).setUnlocalizedName("rawchickenbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawchickenbit");
               rawsteakbit = new ItemFood(rawsteakbitID, 1, 0.2f, false).setUnlocalizedName("rawsteakbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawsteakbit");
               rawporkbit = new ItemFood(rawporkbitID, 1, 0.2f, false).setUnlocalizedName("rawporkbit").setCreativeTab(CreativeTabs.tabFood).func_111206_d("mineedibles:rawporkbit");
               knife = new Item(knifeID).setUnlocalizedName("knife").setMaxDamage(64).setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools).func_111206_d("mineedibles:knifeBlack");
               MinecraftForge.addGrassSeed(new ItemStack (tomatoseeds), 10);
               gameRegisters();
               languageRegisters();
               craftingRecipes();
               	//Smelting
               GameRegistry.addSmelting(MineEdibles.rawbacon.itemID, new ItemStack(MineEdibles.cookedbacon, 1), 0.1f);
               GameRegistry.addSmelting(MineEdibles.rawchickenbit.itemID, new ItemStack(MineEdibles.chickenbit, 1), 0.1f);
               GameRegistry.addSmelting(MineEdibles.rawsteakbit.itemID, new ItemStack(MineEdibles.steakbit, 1), 0.1f);
               GameRegistry.addSmelting(MineEdibles.rawporkbit.itemID, new ItemStack(MineEdibles.porkbit, 1), 0.1f);




        }

        //Item and Block registeration
        private static void gameRegisters(){
        	GameRegistry.registerItem(breadslice, "Bread Slice");
        	GameRegistry.registerItem(chickensandwich, "Chicken Sandwich");
        	GameRegistry.registerItem(steaksandwich, "Steak Sandwich");
        	GameRegistry.registerItem(hamsandwich, "Ham Sandwich");
        	GameRegistry.registerItem(supersandwich, "Super Sandwich");
        	GameRegistry.registerItem(chickenbit, "Slice of Chicken");
        	GameRegistry.registerItem(steakbit, "Slice of Steak");
        	GameRegistry.registerItem(porkbit, "Slice of Ham");
        	GameRegistry.registerItem(tomatoseeds, "Tomato Seeds");
        	GameRegistry.registerItem(tomatofruit, "Tomato");
        	GameRegistry.registerBlock(tomatocrop, "Tomato Crop");
        	GameRegistry.registerItem(rawbacon, "Raw Bacon");
        	GameRegistry.registerItem(cookedbacon, "Cooked Bacon");
        	GameRegistry.registerItem(rawchickenbit, "Raw Slice of Chicken");
        	GameRegistry.registerItem(rawsteakbit, "Raw Slice of Steak");
        	GameRegistry.registerItem(rawporkbit, "Raw Slice of Ham");
        	GameRegistry.registerItem(knife, "Knife");
        	GameRegistry.registerCraftingHandler(new KnifeCraftingHandler());
        }
        //Item and Block in game name, languageregistry
        private static void languageRegisters(){
        	LanguageRegistry.addName(breadslice, "Bread Slice");
        	LanguageRegistry.addName(chickensandwich, "Chicken Sandwich");
        	LanguageRegistry.addName(steaksandwich, "Steak Sandwich");
        	LanguageRegistry.addName(hamsandwich, "Ham Sandwich");
        	LanguageRegistry.addName(supersandwich, "Super Sandwich");
        	LanguageRegistry.addName(chickenbit, "Slice of Chicken");
        	LanguageRegistry.addName(steakbit, "Slice of Steak");
        	LanguageRegistry.addName(porkbit, "Slice of Ham");
        	LanguageRegistry.addName(tomatoseeds, "Tomato Seeds");
        	LanguageRegistry.addName(tomatofruit, "Tomato");
        	LanguageRegistry.addName(rawbacon, "Raw Bacon");
        	LanguageRegistry.addName(rawchickenbit, "Raw Slice of Chicken");
        	LanguageRegistry.addName(rawsteakbit, "Raw Slice of Steak");
        	LanguageRegistry.addName(rawporkbit, "Raw Slice of Ham");
        	LanguageRegistry.addName(knife, "Knife");
        }
        //Crafting Recipes
        public void craftingRecipes(){
        	//Cooked meat slices
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.breadslice, 6), new ItemStack(ItemFood.bread));
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.chickenbit, 3), new Object[]{ItemFood.chickenCooked, (new ItemStack(knife, 1, 0 ))});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.steakbit, 3), new Object[]{ItemFood.beefCooked, (new ItemStack(knife, 1, 0))});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.porkbit, 3), new Object[]{ItemFood.porkCooked, (new ItemStack(knife, 1, 0))});
        	//Raw Meat Slices
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawchickenbit, 3), new Object[]{ItemFood.chickenRaw, (new ItemStack(knife, 1, 0))});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawsteakbit, 3), new Object[]{ItemFood.beefRaw, (new ItemStack(knife, 1, 0))});
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawporkbit, 3), new Object[]{ItemFood.porkRaw, (new ItemStack(knife, 1, 0))});
        	//Sandwiches
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawchickenbit, 3), new ItemStack(ItemFood.chickenRaw));
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawsteakbit, 3), new ItemStack(ItemFood.beefRaw));
        	GameRegistry.addShapelessRecipe(new ItemStack (MineEdibles.rawporkbit, 3), new ItemStack(ItemFood.porkRaw));
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.chickensandwich, 1), new Object[]{" B ", " C ", " B ", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked });
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.steaksandwich, 1), new Object[]{" B ", " S ", " B ", 'B', MineEdibles.breadslice, 'S', ItemFood.beefCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.hamsandwich, 1), new Object[]{" B ", " P ", " B ", 'B', MineEdibles.breadslice, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CSP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "SCP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "PSC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "SPC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "PSC", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CPS", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CSP", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        	GameRegistry.addRecipe(new ItemStack(MineEdibles.supersandwich, 1), new Object []{"BBB", "CPS", "BBB", 'B', MineEdibles.breadslice, 'C', ItemFood.chickenCooked, 'S', ItemFood.beefCooked, 'P', ItemFood.porkCooked});
        
        	
        }
        @EventHandler
        public void postInit(FMLPostInitializationEvent event) {
                
        }
}

 

CraftingHandlerClass for the Item Knife

 

package mydeblob.mineedibles;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.ICraftingHandler;

public class KnifeCraftingHandler implements ICraftingHandler {

@Override
public void onCrafting(EntityPlayer player, ItemStack item,
		IInventory craftMatrix) {
	for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {

		if (craftMatrix.getStackInSlot(i) != null) {
			ItemStack j = craftMatrix.getStackInSlot(i);

			if (j.getItem() != null && j.getItem() == MineEdibles.knife) {
				ItemStack k = new ItemStack(MineEdibles.knife, 2, (j.getItemDamage() + 1));

				if (k.getItemDamage() >= k.getMaxDamage()) {
					k.stackSize--;
				}
				craftMatrix.setInventorySlotContents(i, k);
			}
		}
	}

}

@Override
public void onSmelting(EntityPlayer player, ItemStack item) {
	// TODO Auto-generated method stub

}

}

 

 

Ok look here buddy. I'm going to rock your world just use this. The code is a bit outdated but it should work mostly. Hope it works!

 

Crafting Handler:

package cyphereion.mods.patches.yogpack;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.ICraftingHandler;

public class CraftingHandler implements ICraftingHandler {
@Override
public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) {
	for (int i = 0; i < craftMatrix.getSizeInventory(); i++)
	{
		if (craftMatrix.getStackInSlot(i) != null)
		{
			ItemStack j = craftMatrix.getStackInSlot(i);
			if (j.getItem() != null && j.getItem() == ITEM) 
			{
				ItemStack k = new ItemStack(ITEM, 2, (j.getItemDamage() + 1)); 
				if (k.getItemDamage() >= k.getMaxDamage()) { 
					k.stackSize--; 
				}
				craftMatrix.setInventorySlotContents(i, k);
			}
		}
	}

}


@Override
public void onSmelting(EntityPlayer player, ItemStack item) {
}
}

 

Item Class (Just for reference):

package cyphereion.mods.patches.yogpack;

import java.util.List;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;

public class ItemTransmorgrificationCrystal extends Item {
private int index;
public ItemTransmorgrificationCrystal(int par1, int index)
{
	super(par1);
	this.index = index;
	this.setMaxStackSize(1);
	this.setMaxDamage(150);
	this.setCreativeTab(CreativeTabs.tabMaterials);
}
@SideOnly(Side.CLIENT)
public String getTextureFile(){
	return "/cyphereion/mods/patches/yogpack/Cyphereion.png";
}

public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
	par3List.add("Stone brick to hold it together.");
	par3List.add("Obsidian to make it tough to break");
	par3List.add("Diamond for good looks.");
}

@SideOnly(Side.CLIENT)
public int getIconFromDamage(int i){
	return index;
}

}

 

 

Recipes:

GameRegistry.addShapelessRecipe(new ItemStack(TransmorgrificationCrystal, 1, 0), Block.stoneBrick, Block.stoneBrick, Block.stoneBrick, Block.stoneBrick, Block.obsidian, Block.obsidian, Block.obsidian, Block.obsidian, Item.diamond);

GameRegistry.addRecipe(new ItemStack(Item.blazeRod, 7),new Object[] { "OTG",'O', Block.obsidian, 'G', Block.blockGold, 'T', (new ItemStack(TransmorgrificationCrystal,1,-1))});

Link to comment
Share on other sites

@deadrecon98, did you even read his post? you posted exactly the same code he was already using

 

@OP

just do a combination of what guff and moritz said. don't use a crafting handler since you don't need one. use hasContainerItem and getContainerItemStack like guff said. and like moritz said, you don't need the for loop when registering the recipe. but, you don't need to register the item in the way moritz suggested since you're already overriding getContainerItemStack(ItemStack).

 

anyway, wrote the following to make absolutely sure it works and it does. just replace the stuff there with what you need. if you want it to stay in the crafting grid, use doesContainerItemLeaveCraftingGrid(ItemStack)

 

package pelep.zzzzz;

import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = "ZZZZZ", name = "ZZZZZ", version = "ZZZZZ")

public class ZZZZZ
{
@Instance("ZZZZZ")
public static ZZZZZ instance;

@EventHandler
public void init(FMLInitializationEvent e)
{
	GameRegistry.registerItem(new ItemDamageable(ID), "itemDamageable");
	GameRegistry.addRecipe(new ItemStack(1, 1, 0), new Object[] {"d", 'd', new ItemStack(IDSHIFTEDINDEX, 1, OreDictionary.WILDCARD_VALUE)});
}
}

 

package pelep.zzzzz;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

public class ItemDamageable extends Item
{
public ItemDamageable(int id)
{
	super(id);
	this.setMaxDamage(64);
}

@Override
public boolean hasContainerItem()
{
	return true;
}

@Override
public ItemStack getContainerItemStack(ItemStack ist)
{
	ist.setItemDamage(ist.getItemDamage() + 1);

	if (ist.getItemDamage() > ist.getMaxDamage())
	{
		ist = null;
	}

	return ist;
}
}

Link to comment
Share on other sites

I did this with an item that has 2048 max damage just to help him, and it doesn't make the crafting table lag. The only time it lags is if you shift-click the output.

 

I Said at 100.000 recipes everything what the craftingManager uses start to lag!

But 2048 recipes are to much!

 

Link to comment
Share on other sites

package pelep.zzzzz;
@Override
public ItemStack getContainerItemStack(ItemStack ist)
{
	ist.setItemDamage(ist.getItemDamage() + 1);

	if (ist.getItemDamage() > ist.getMaxDamage())
	{
		ist = null;
	}

	return ist;
}

Don't return a null itemstack. I attempted that at first but I had him change it since it was giving a NPE. The crafting bench attempts to check for item damage already for some reason, and if you return null and it tries to check it, it doesn't protect itself against NPE. Damaging the item and returning the stack will suffice. If you didn't get a NPE then that's just weird because I had to trace it back to this and remove setting the return to null.

Link to comment
Share on other sites

well, to be honest, i didn't test it all the way until the item went past the max damage.. kinda got too lazy. lol. anyway, just checked it now and you're right.

 

@OP

just take this part out

	if (ist.getItemDamage() > ist.getMaxDamage())
	{
		ist = null;
	}

Link to comment
Share on other sites

well, to be honest, i didn't test it all the way until the item went past the max damage.. kinda got too lazy. lol. anyway, just checked it now and you're right.

 

@OP

just take this part out

	if (ist.getItemDamage() > ist.getMaxDamage())
	{
		ist = null;
	}

 

Yeah lol I kept trying it with something similar and I took it out and it worked.

Link to comment
Share on other sites

@deadrecon98, did you even read his post? you posted exactly the same code he was already using

 

@OP

just do a combination of what guff and moritz said. don't use a crafting handler since you don't need one. use hasContainerItem and getContainerItemStack like guff said. and like moritz said, you don't need the for loop when registering the recipe. but, you don't need to register the item in the way moritz suggested since you're already overriding getContainerItemStack(ItemStack).

 

anyway, wrote the following to make absolutely sure it works and it does. just replace the stuff there with what you need. if you want it to stay in the crafting grid, use doesContainerItemLeaveCraftingGrid(ItemStack)

 

package pelep.zzzzz;

import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;

@Mod(modid = "ZZZZZ", name = "ZZZZZ", version = "ZZZZZ")

public class ZZZZZ
{
@Instance("ZZZZZ")
public static ZZZZZ instance;

@EventHandler
public void init(FMLInitializationEvent e)
{
	GameRegistry.registerItem(new ItemDamageable(ID), "itemDamageable");
	GameRegistry.addRecipe(new ItemStack(1, 1, 0), new Object[] {"d", 'd', new ItemStack(IDSHIFTEDINDEX, 1, OreDictionary.WILDCARD_VALUE)});
}
}

 

package pelep.zzzzz;

import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;

public class ItemDamageable extends Item
{
public ItemDamageable(int id)
{
	super(id);
	this.setMaxDamage(64);
}

@Override
public boolean hasContainerItem()
{
	return true;
}

@Override
public ItemStack getContainerItemStack(ItemStack ist)
{
	ist.setItemDamage(ist.getItemDamage() + 1);

	if (ist.getItemDamage() > ist.getMaxDamage())
	{
		ist = null;
	}

	return ist;
}
}

 

It doesn't matter how you do it because I know for a fact my way works. It may just take a little tweaking but it is working fine for me.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hello, I'm trying to modify the effects of native enchantments for bows and arrows in Minecraft. After using a decompilation tool, I found that the specific implementations of native bow and arrow enchantments (including `ArrowDamageEnchantment`, `ArrowKnockbackEnchantment`, `ArrowFireEnchantment`, `ArrowInfiniteEnchantment`, `ArrowPiercingEnchantment`) do not contain any information about the enchantment effects (such as the `getDamageProtection` function for `ProtectionEnchantment`, `getDamageBonus` function for `DamageEnchantment`, etc.). Upon searching for the base class of arrows, `AbstractArrow`, I found a function named setEnchantmentEffectsFromEntity`, which seems to be used to retrieve the enchantment levels of the tool held by a `LivingEntity` and calculate the specific values of the enchantment effects. However, after testing with the following code, I found that this function is not being called:   @Mixin(AbstractArrow.class) public class ModifyArrowEnchantmentEffects {     private static final Logger LOGGER = LogUtils.getLogger();     @Inject(         method = "setEnchantmentEffectsFromEntity",         at = @At("HEAD")     )     private void logArrowEnchantmentEffectsFromEntity(CallbackInfo ci) {         LOGGER.info("Arrow enchantment effects from entity");     } }   Upon further investigation, I found that within the onHitEntity method, there are several lines of code:               if (!this.level().isClientSide &amp;&amp; entity1 instanceof LivingEntity) {                EnchantmentHelper.doPostHurtEffects(livingentity, entity1);                EnchantmentHelper.doPostDamageEffects((LivingEntity)entity1, livingentity);             }   These lines of code actually call the doPostHurt and doPostAttack methods of each enchantment in the enchantment list. However, this leads back to the issue because native bow and arrow enchantments do not implement these functions. Although their base class defines the functions, they are empty. At this point, I'm completely stumped and seeking assistance. Thank you.
    • I have been trying to make a server with forge but I keep running into an issue. I have jdk 22 installed as well as Java 8. here is the debug file  
    • it crashed again     What the console says : [00:02:03] [Server thread/INFO] [Easy NPC/]: [EntityManager] Server started! [00:02:03] [Server thread/INFO] [co.gi.al.ic.IceAndFire/]: {iceandfire:fire_dragon_roost=true, iceandfire:fire_lily=true, iceandfire:spawn_dragon_skeleton_fire=true, iceandfire:lightning_dragon_roost=true, iceandfire:spawn_dragon_skeleton_lightning=true, iceandfire:ice_dragon_roost=true, iceandfire:ice_dragon_cave=true, iceandfire:lightning_dragon_cave=true, iceandfire:cyclops_cave=true, iceandfire:spawn_wandering_cyclops=true, iceandfire:spawn_sea_serpent=true, iceandfire:frost_lily=true, iceandfire:hydra_cave=true, iceandfire:lightning_lily=true, iceandfireixie_village=true, iceandfire:myrmex_hive_jungle=true, iceandfire:myrmex_hive_desert=true, iceandfire:silver_ore=true, iceandfire:siren_island=true, iceandfire:spawn_dragon_skeleton_ice=true, iceandfire:spawn_stymphalian_bird=true, iceandfire:fire_dragon_cave=true, iceandfire:sapphire_ore=true, iceandfire:spawn_hippocampus=true, iceandfire:spawn_death_worm=true} [00:02:03] [Server thread/INFO] [co.gi.al.ic.IceAndFire/]: {TROLL_S=true, HIPPOGRYPH=true, AMPHITHERE=true, COCKATRICE=true, TROLL_M=true, DREAD_LICH=true, TROLL_F=true} [00:02:03] [Server thread/INFO] [ne.be.lo.WeaponRegistry/]: Encoded Weapon Attribute registry size (with package overhead): 41976 bytes (in 5 string chunks with the size of 10000) [00:02:03] [Server thread/INFO] [patchouli/]: Sending reload packet to clients [00:02:03] [Server thread/WARN] [voicechat/]: [voicechat] Running in offline mode - Voice chat encryption is not secure! [00:02:03] [VoiceChatServerThread/INFO] [voicechat/]: [voicechat] Using server-ip as bind address: 0.0.0.0 [00:02:03] [Server thread/WARN] [ModernFix/]: Dedicated server took 22.521 seconds to load [00:02:03] [VoiceChatServerThread/INFO] [voicechat/]: [voicechat] Voice chat server started at 0.0.0.0:25565 [00:02:03] [Server thread/WARN] [minecraft/SynchedEntityData]: defineId called for: class net.minecraft.world.entity.player.Player from class tschipp.carryon.common.carry.CarryOnDataManager [00:02:03] [Server thread/INFO] [ne.mi.co.AdvancementLoadFix/]: Using new advancement loading for net.minecraft.server.PlayerAdvancements@2941ffd5 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 0 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 1 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 2 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 3 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 4 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 5 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 6 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 7 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 8 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 9 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 10 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 11 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 12 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 13 [00:02:10] [Netty Epoll Server IO #2/INFO] [Calio/]: Received acknowledgment for login packet with id 14 [00:02:19] [Server thread/INFO] [ne.mi.co.AdvancementLoadFix/]: Using new advancement loading for net.minecraft.server.PlayerAdvancements@ebc7ef2 [00:02:19] [Server thread/INFO] [minecraft/PlayerList]: ZacAdos[/90.2.17.162:49242] logged in with entity id 1062 at (-1848.6727005281205, 221.0, -3054.2468255848935) [00:02:19] [Server thread/ERROR] [ModernFix/]: Skipping entity ID sync for com.talhanation.smallships.world.entity.ship.Ship: java.lang.NoClassDefFoundError: net/minecraft/client/CameraType [00:02:19] [Server thread/INFO] [minecraft/MinecraftServer]: - Gloop - ZacAdos joined the game [00:02:19] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Updating all forceload tickets for cc56befd-d376-3526-a760-340713c478bd [00:02:19] [Server thread/INFO] [se.mi.te.da.DataManager/]: Sending data to client: ZacAdos [00:02:19] [Server thread/INFO] [voicechat/]: [voicechat] Received secret request of - Gloop - ZacAdos (17) [00:02:19] [Server thread/INFO] [voicechat/]: [voicechat] Sent secret to - Gloop - ZacAdos [00:02:21] [VoiceChatPacketProcessingThread/INFO] [voicechat/]: [voicechat] Successfully authenticated player cc56befd-d376-3526-a760-340713c478bd [00:02:22] [VoiceChatPacketProcessingThread/INFO] [voicechat/]: [voicechat] Successfully validated connection of player cc56befd-d376-3526-a760-340713c478bd [00:02:22] [VoiceChatPacketProcessingThread/INFO] [voicechat/]: [voicechat] Player - Gloop - ZacAdos (cc56befd-d376-3526-a760-340713c478bd) successfully connected to voice chat stop [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping the server [00:02:34] [Server thread/INFO] [mo.pl.ar.ArmourersWorkshop/]: stop local service [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Stopping server [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving players [00:02:34] [Server thread/INFO] [minecraft/ServerGamePacketListenerImpl]: ZacAdos lost connection: Server closed [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: - Gloop - ZacAdos left the game [00:02:34] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Updating all forceload tickets for cc56befd-d376-3526-a760-340713c478bd [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving worlds [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:overworld [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_end [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: Saving chunks for level 'ServerLevel[world]'/minecraft:the_nether [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (world): All chunks are saved [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (DIM1): All chunks are saved [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage (DIM-1): All chunks are saved [00:02:34] [Server thread/INFO] [minecraft/MinecraftServer]: ThreadedAnvilChunkStorage: All dimensions are saved [00:02:34] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Stopping IO worker... [00:02:34] [Server thread/INFO] [xa.pa.OpenPartiesAndClaims/]: Stopped IO worker! [00:02:34] [Server thread/INFO] [Calio/]: Removing Dynamic Registries for: net.minecraft.server.dedicated.DedicatedServer@7dc879e1 [MineStrator Daemon]: Checking server disk space usage, this could take a few seconds... [MineStrator Daemon]: Updating process configuration files... [MineStrator Daemon]: Ensuring file permissions are set correctly, this could take a few seconds... [MineStrator Daemon]: Pulling Docker container image, this could take a few minutes to complete... [MineStrator Daemon]: Finished pulling Docker container image container@pterodactyl~ java -version openjdk version "17.0.10" 2024-01-16 OpenJDK Runtime Environment Temurin-17.0.10+7 (build 17.0.10+7) OpenJDK 64-Bit Server VM Temurin-17.0.10+7 (build 17.0.10+7, mixed mode, sharing) container@pterodactyl~ java -Xms128M -Xmx6302M -Dterminal.jline=false -Dterminal.ansi=true -Djline.terminal=jline.UnsupportedTerminal -p libraries/cpw/mods/bootstraplauncher/1.1.2/bootstraplauncher-1.1.2.jar:libraries/cpw/mods/securejarhandler/2.1.4/securejarhandler-2.1.4.jar:libraries/org/ow2/asm/asm-commons/9.5/asm-commons-9.5.jar:libraries/org/ow2/asm/asm-util/9.5/asm-util-9.5.jar:libraries/org/ow2/asm/asm-analysis/9.5/asm-analysis-9.5.jar:libraries/org/ow2/asm/asm-tree/9.5/asm-tree-9.5.jar:libraries/org/ow2/asm/asm/9.5/asm-9.5.jar:libraries/net/minecraftforge/JarJarFileSystems/0.3.16/JarJarFileSystems-0.3.16.jar --add-modules ALL-MODULE-PATH --add-opens java.base/java.util.jar=cpw.mods.securejarhandler --add-opens java.base/java.lang.invoke=cpw.mods.securejarhandler --add-exports java.base/sun.security.util=cpw.mods.securejarhandler --add-exports jdk.naming.dns/com.sun.jndi.dns=java.naming -Djava.net.preferIPv6Addresses=system -DignoreList=bootstraplauncher-1.1.2.jar,securejarhandler-2.1.4.jar,asm-commons-9.5.jar,asm-util-9.5.jar,asm-analysis-9.5.jar,asm-tree-9.5.jar,asm-9.5.jar,JarJarFileSystems-0.3.16.jar -DlibraryDirectory=libraries -DlegacyClassPath=libraries/cpw/mods/securejarhandler/2.1.4/securejarhandler-2.1.4.jar:libraries/org/ow2/asm/asm/9.5/asm-9.5.jar:libraries/org/ow2/asm/asm-commons/9.5/asm-commons-9.5.jar:libraries/org/ow2/asm/asm-tree/9.5/asm-tree-9.5.jar:libraries/org/ow2/asm/asm-util/9.5/asm-util-9.5.jar:libraries/org/ow2/asm/asm-analysis/9.5/asm-analysis-9.5.jar:libraries/net/minecraftforge/accesstransformers/8.0.4/accesstransformers-8.0.4.jar:libraries/org/antlr/antlr4-runtime/4.9.1/antlr4-runtime-4.9.1.jar:libraries/net/minecraftforge/eventbus/6.0.3/eventbus-6.0.3.jar:libraries/net/minecraftforge/forgespi/6.0.0/forgespi-6.0.0.jar:libraries/net/minecraftforge/coremods/5.0.1/coremods-5.0.1.jar:libraries/cpw/mods/modlauncher/10.0.8/modlauncher-10.0.8.jar:libraries/net/minecraftforge/unsafe/0.2.0/unsafe-0.2.0.jar:libraries/com/electronwill/night-config/core/3.6.4/core-3.6.4.jar:libraries/com/electronwill/night-config/toml/3.6.4/toml-3.6.4.jar:libraries/org/apache/maven/maven-artifact/3.8.5/maven-artifact-3.8.5.jar:libraries/net/jodah/typetools/0.8.3/typetools-0.8.3.jar:libraries/net/minecrell/terminalconsoleappender/1.2.0/terminalconsoleappender-1.2.0.jar:libraries/org/jline/jline-reader/3.12.1/jline-reader-3.12.1.jar:libraries/org/jline/jline-terminal/3.12.1/jline-terminal-3.12.1.jar:libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar:libraries/org/openjdk/nashorn/nashorn-core/15.3/nashorn-core-15.3.jar:libraries/net/minecraftforge/JarJarSelector/0.3.16/JarJarSelector-0.3.16.jar:libraries/net/minecraftforge/JarJarMetadata/0.3.16/JarJarMetadata-0.3.16.jar:libraries/net/minecraftforge/fmlloader/1.19.2-43.3.0/fmlloader-1.19.2-43.3.0.jar:libraries/net/minecraft/server/1.19.2-20220805.130853/server-1.19.2-20220805.130853-extra.jar:libraries/com/github/oshi/oshi-core/5.8.5/oshi-core-5.8.5.jar:libraries/com/google/code/gson/gson/2.8.9/gson-2.8.9.jar:libraries/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar:libraries/com/google/guava/guava/31.0.1-jre/guava-31.0.1-jre.jar:libraries/com/mojang/authlib/3.11.49/authlib-3.11.49.jar:libraries/com/mojang/brigadier/1.0.18/brigadier-1.0.18.jar:libraries/com/mojang/datafixerupper/5.0.28/datafixerupper-5.0.28.jar:libraries/com/mojang/javabridge/1.2.24/javabridge-1.2.24.jar:libraries/com/mojang/logging/1.0.0/logging-1.0.0.jar:libraries/commons-io/commons-io/2.11.0/commons-io-2.11.0.jar:libraries/io/netty/netty-buffer/4.1.77.Final/netty-buffer-4.1.77.Final.jar:libraries/io/netty/netty-codec/4.1.77.Final/netty-codec-4.1.77.Final.jar:libraries/io/netty/netty-common/4.1.77.Final/netty-common-4.1.77.Final.jar:libraries/io/netty/netty-handler/4.1.77.Final/netty-handler-4.1.77.Final.jar:libraries/io/netty/netty-resolver/4.1.77.Final/netty-resolver-4.1.77.Final.jar:libraries/io/netty/netty-transport/4.1.77.Final/netty-transport-4.1.77.Final.jar:libraries/io/netty/netty-transport-classes-epoll/4.1.77.Final/netty-transport-classes-epoll-4.1.77.Final.jar:libraries/io/netty/netty-transport-native-epoll/4.1.77.Final/netty-transport-native-epoll-4.1.77.Final-linux-x86_64.jar:libraries/io/netty/netty-transport-native-epoll/4.1.77.Final/netty-transport-native-epoll-4.1.77.Final-linux-aarch_64.jar:libraries/io/netty/netty-transport-native-unix-common/4.1.77.Final/netty-transport-native-unix-common-4.1.77.Final.jar:libraries/it/unimi/dsi/fastutil/8.5.6/fastutil-8.5.6.jar:libraries/net/java/dev/jna/jna/5.10.0/jna-5.10.0.jar:libraries/net/java/dev/jna/jna-platform/5.10.0/jna-platform-5.10.0.jar:libraries/net/sf/jopt-simple/jopt-simple/5.0.4/jopt-simple-5.0.4.jar:libraries/org/apache/commons/commons-lang3/3.12.0/commons-lang3-3.12.0.jar:libraries/org/apache/logging/log4j/log4j-api/2.17.0/log4j-api-2.17.0.jar:libraries/org/apache/logging/log4j/log4j-core/2.17.0/log4j-core-2.17.0.jar:libraries/org/apache/logging/log4j/log4j-slf4j18-impl/2.17.0/log4j-slf4j18-impl-2.17.0.jar:libraries/org/slf4j/slf4j-api/1.8.0-beta4/slf4j-api-1.8.0-beta4.jar cpw.mods.bootstraplauncher.BootstrapLauncher --launchTarget forgeserver --fml.forgeVersion 43.3.0 --fml.mcVersion 1.19.2 --fml.forgeGroup net.minecraftforge --fml.mcpVersion 20220805.130853 [00:02:42] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--launchTarget, forgeserver, --fml.forgeVersion, 43.3.0, --fml.mcVersion, 1.19.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20220805.130853] [00:02:42] [main/INFO] [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 10.0.8+10.0.8+main.0ef7e830 starting: java version 17.0.10 by Eclipse Adoptium; OS Linux arch amd64 version 6.1.0-12-amd64 [00:02:43] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/home/container/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2363!/ Service=ModLauncher Env=SERVER [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/fmlcore/1.19.2-43.3.0/fmlcore-1.19.2-43.3.0.jar is missing mods.toml file [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/javafmllanguage/1.19.2-43.3.0/javafmllanguage-1.19.2-43.3.0.jar is missing mods.toml file [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/lowcodelanguage/1.19.2-43.3.0/lowcodelanguage-1.19.2-43.3.0.jar is missing mods.toml file [00:02:43] [main/WARN] [ne.mi.fm.lo.mo.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/mclanguage/1.19.2-43.3.0/mclanguage-1.19.2-43.3.0.jar is missing mods.toml file [00:02:44] [main/WARN] [ne.mi.ja.se.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File: and Mod File: . Using Mod File: [00:02:44] [main/WARN] [ne.mi.ja.se.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: resourcefullib. Using Mod File: /home/container/mods/resourcefullib-forge-1.19.2-1.1.24.jar [00:02:44] [main/INFO] [ne.mi.fm.lo.mo.JarInJarDependencyLocator/]: Found 13 dependencies adding them to mods collection Latest log [29Mar2024 00:02:42.803] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--launchTarget, forgeserver, --fml.forgeVersion, 43.3.0, --fml.mcVersion, 1.19.2, --fml.forgeGroup, net.minecraftforge, --fml.mcpVersion, 20220805.130853] [29Mar2024 00:02:42.805] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 10.0.8+10.0.8+main.0ef7e830 starting: java version 17.0.10 by Eclipse Adoptium; OS Linux arch amd64 version 6.1.0-12-amd64 [29Mar2024 00:02:43.548] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.5 Source=union:/home/container/libraries/org/spongepowered/mixin/0.8.5/mixin-0.8.5.jar%2363!/ Service=ModLauncher Env=SERVER [29Mar2024 00:02:43.876] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/fmlcore/1.19.2-43.3.0/fmlcore-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:43.877] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/javafmllanguage/1.19.2-43.3.0/javafmllanguage-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:43.877] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/lowcodelanguage/1.19.2-43.3.0/lowcodelanguage-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:43.878] [main/WARN] [net.minecraftforge.fml.loading.moddiscovery.ModFileParser/LOADING]: Mod file /home/container/libraries/net/minecraftforge/mclanguage/1.19.2-43.3.0/mclanguage-1.19.2-43.3.0.jar is missing mods.toml file [29Mar2024 00:02:44.033] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select two dependency jars from JarJar which have the same identification: Mod File: and Mod File: . Using Mod File: [29Mar2024 00:02:44.034] [main/WARN] [net.minecraftforge.jarjar.selection.JarSelector/]: Attempted to select a dependency jar for JarJar which was passed in as source: resourcefullib. Using Mod File: /home/container/mods/resourcefullib-forge-1.19.2-1.1.24.jar [29Mar2024 00:02:44.034] [main/INFO] [net.minecraftforge.fml.loading.moddiscovery.JarInJarDependencyLocator/]: Found 13 dependencies adding them to mods collection
    • I am unable to do that. Brigadier is a mojang library that parses commands.
  • Topics

×
×
  • Create New...

Important Information

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