Jump to content

Joeman7

Members
  • Posts

    9
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • Personal Text
    Herro Dere

Joeman7's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Since I am rather new to modding minecraft with forge, and to using java in general, I have decided to just create a knife that does not have a durability so I can easily just use .setContainerItem to make it return to me each time I craft. Thank you both for all of your help.
  2. Rich, I am sort of new to modding with java, so by any chance could you guide me through that?
  3. Goto Link, I think you are missing the point. I am trying to make shears and pork craft bacon. The whole point of .setContainerItem for me was so I didn't loose the shears when I craft bacon. If I use .setContainerItem(Item.Shears) for bacon, it would return shears when I craft with bacon, opposite of my goal. I either need to modify/extend minecrafts files to allow .setContainerItem to except parameters, or I need to find an alternative method to return shears to the crafting table or my inventory.
  4. How else can I allow it to return the shears though? I would not like to have to spend 2 iron every time I need bacon...
  5. Adding the wildcard value and reorganizing the ItemStack stuff (Originally I used the item itself in the crafting recipe, but now I am using the itemStack) did allow any shears to work in the crafting recipe, thanks! However, I am still unsure how to make the recipe damage the shears. Currently, if I use fully repaired shears and craft it with raw pork, I get raw bacon. However, it returns me shears undamaged. When I use already damaged shears and craft them in the recipe for bacon, it gives me raw bacon, but it returns me fully repaired shears. Currently with the .setContainerItem, I just have it set it to regular shears. It doesn't seem to allow me to add extra parameters to the .setContainerItem(Item.shears) and it does not except item stacks. Is there any way to fix it? Or is there an alternative method to returning shears? Thanks for your help. Here's new relevant source: ItemStack porkRawStack = new ItemStack(Item.porkRaw); ItemStack shearStack = new ItemStack(Item.shears.setContainerItem(Item.shears), 1, OreDictionary.WILDCARD_VALUE); GameRegistry.addShapelessRecipe(new ItemStack(baconRaw), porkRawStack, shearStack);
  6. I am currently attempting to add bacon to minecraft by adding a recipe using shears and a raw pork chop. I have successfully added the recipe and allowed it to return the shears to my inventory after crafting by using .setContainerItem, but I would like to be able to use shears of any durability and for the recipe to slightly lower the durability of the shears each time you craft. Thank you for your consideration. Here are the source files. package breakfast.craft; // This Import list will grow longer with each additional tutorial. // It's not pruned between full class postings, unlike other tutorial code. import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemSeeds; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.Mod; //import cpw.mods.fml.common.Mod.Init; //Used in 1.5.2 and before import cpw.mods.fml.common.Mod.Instance; //import cpw.mods.fml.common.Mod.PostInit; //Used in 1.5.2 and before //import cpw.mods.fml.common.Mod.PreInit; //Used in 1.5.2 and before import cpw.mods.fml.common.Mod.EventHandler; //Added for 1.6.X 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.minecraft.item.crafting.FurnaceRecipes ; import net.minecraft.item.ItemFood; import net.minecraft.creativetab.*; import net.minecraftforge.common.MinecraftForge; import breakfast.craft.Items; @Mod(modid="breakfastCraft", name="Breakfast Craft", version="0.0.0") @NetworkMod(clientSideRequired=true, serverSideRequired=false) public class Breakfast { @Instance("Breakfast") public static Breakfast instance; public static Item syrup = (new Food(5000, 1)).setUnlocalizedName("syrup").setCreativeTab(CreativeTabs.tabFood).func_111206_d("breakfastcraft:Syrup"); public static Item eggyBread = (new Food(5001, 2)).setUnlocalizedName("eggyBread").setCreativeTab(CreativeTabs.tabFood).func_111206_d("breakfastcraft:EggyBread"); public static Item pancakeBatter = (new Food(5002, 2)).setUnlocalizedName("pancakeBatter").setCreativeTab(CreativeTabs.tabFood).func_111206_d("breakfastcraft:PancakeBatter"); public static Item waffleBatter = (new Food(5003, 2)).setUnlocalizedName("waffleBatter").setCreativeTab(CreativeTabs.tabFood).func_111206_d("breakfastcraft:WaffleBatter"); public static Item frenchToast = (new Food(5004, 6)).setUnlocalizedName("frenchToast").setCreativeTab(CreativeTabs.tabFood).func_111206_d("breakfastcraft:FrenchToast"); public static Item frenchToastSyrup = (new Food(5005, ).setUnlocalizedName("frenchToast").setCreativeTab(CreativeTabs.tabFood).func_111206_d("breakfastcraft:FrenchToastSyrup"); public static Item pancake = (new Food(5006, 10)).setUnlocalizedName("pancake").setCreativeTab(CreativeTabs.tabFood).func_111206_d("breakfastcraft:Pancake"); public static Item pancakeSyrup = (new Food(5007, 12)).setUnlocalizedName("pancakeSyrup").setCreativeTab(CreativeTabs.tabFood).func_111206_d("breakfastcraft:PancakeSyrup"); public static Item waffle = (new Food(5008, ).setUnlocalizedName("waffle").setCreativeTab(CreativeTabs.tabFood).func_111206_d("breakfastcraft:Waffle"); public static Item waffleSyrup = (new Food(5009, 10)).setUnlocalizedName("waffleSyrup").setCreativeTab(CreativeTabs.tabFood).func_111206_d("breakfastcraft:WaffleSyrup"); public static Item baconRaw = (new Food(5010, 10)).setUnlocalizedName("baconRaw").setCreativeTab(CreativeTabs.tabFood).func_111206_d("breakfastcraft:BaconRaw"); @SidedProxy(clientSide="breakfast.craft.client.ClientProxy", serverSide="breakfast.craft.CommonProxy") public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { // Stub Method } @EventHandler public void load(FMLInitializationEvent event) { ItemStack eggStack = new ItemStack(Item.egg); ItemStack breadStack = new ItemStack(Item.bread); ItemStack bucketMilkStack = new ItemStack(Item.bucketMilk); ItemStack wheatStack = new ItemStack(Item.wheat); ItemStack sugarStack = new ItemStack(Item.sugar); ItemStack syrupStack = new ItemStack(syrup); ItemStack reedStack = new ItemStack(Item.reed); ItemStack porkRawStack = new ItemStack(Item.porkRaw); ItemStack shearStack = new ItemStack(Item.shears); GameRegistry.addShapelessRecipe(new ItemStack(eggyBread), eggStack, breadStack, eggStack); GameRegistry.addRecipe(new ItemStack(pancakeBatter), "xxx", "yzy", "vzv", 'x', wheatStack, 'y', sugarStack, 'v', eggStack, 'z', bucketMilkStack); GameRegistry.addRecipe(new ItemStack(waffleBatter), "xxx", "yyy", "vzv", 'x', wheatStack, 'y', sugarStack, 'v', eggStack, 'z', bucketMilkStack); GameRegistry.addSmelting(eggyBread.itemID, new ItemStack(frenchToast), 0.1f); GameRegistry.addSmelting(pancakeBatter.itemID, new ItemStack(pancake), 0.1f); GameRegistry.addSmelting(waffleBatter.itemID, new ItemStack(waffle), 0.1f); GameRegistry.addShapelessRecipe(new ItemStack(frenchToastSyrup), syrup, frenchToast); GameRegistry.addShapelessRecipe(new ItemStack(pancakeSyrup), syrup, pancake); GameRegistry.addShapelessRecipe(new ItemStack(waffleSyrup), syrup, waffle); GameRegistry.addShapelessRecipe(new ItemStack(syrup), reedStack, reedStack, reedStack, reedStack, reedStack, reedStack); GameRegistry.addShapelessRecipe(new ItemStack(baconRaw), porkRawStack, Item.shears.setContainerItem(Item.shears)); LanguageRegistry.addName(eggyBread, "Eggy Bread"); LanguageRegistry.addName(pancakeBatter, "Pancake Batter"); LanguageRegistry.addName(waffleBatter, "Waffle Batter"); LanguageRegistry.addName(pancake, "Pancake"); LanguageRegistry.addName(frenchToast, "French Toast"); LanguageRegistry.addName(waffle, "Waffle"); LanguageRegistry.addName(syrup, "Syrup"); LanguageRegistry.addName(frenchToastSyrup, "French Toast"); LanguageRegistry.addName(pancakeSyrup, "Pancake"); LanguageRegistry.addName(waffleSyrup, "Waffle"); LanguageRegistry.addName(baconRaw, "Raw Bacon"); } @EventHandler public void postInit(FMLPostInitializationEvent event) { // Stub Method } }
  7. I found the answer. Instead of putting Item.genericItem, I should have put just generic.Item Thanks anyways.
  8. Sorry, I should've just posted it in the first place. When I attempt to start the game, it gets the mojang loading screen, then immediately crashes. Tell me if you'd like any more files. package tutorial.generic; // This Import list will grow longer with each additional tutorial. // It's not pruned between full class postings, unlike other tutorial code. import java.util.Random; 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.ItemStack; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.Mod; //import cpw.mods.fml.common.Mod.Init; //Used in 1.5.2 and before import cpw.mods.fml.common.Mod.Instance; //import cpw.mods.fml.common.Mod.PostInit; //Used in 1.5.2 and before //import cpw.mods.fml.common.Mod.PreInit; //Used in 1.5.2 and before import cpw.mods.fml.common.Mod.EventHandler; //Added for 1.6.X 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="Generic", name="Generic", version="0.0.0") @NetworkMod(clientSideRequired=true, serverSideRequired=false) public class Generic { @Instance("Generic") public static Generic instance; private final static Item genericItem = new GenericItem(5000); public final static Item genericIngot = new GenericItem(5001) .setMaxStackSize(16).setUnlocalizedName("genericIngot"); public final static Block genericDirt = new GenericBlock(500, Material.ground) .setHardness(0.5F).setStepSound(Block.soundGravelFootstep) .setUnlocalizedName("genericDirt").setCreativeTab(CreativeTabs.tabBlock); public final static Block genericOre = new GenericOre(501, Material.rock); public int idDropped(int par1, Random random, int zero) { return Generic.genericIngot.itemID; } @SidedProxy(clientSide="tutorial.generic.client.ClientProxy", serverSide="tutorial.generic.CommonProxy") public static CommonProxy proxy; @EventHandler public void preInit(FMLPreInitializationEvent event) { // Stub Method } @EventHandler public void load(FMLInitializationEvent event) { LanguageRegistry.addName(genericItem, "Generic Item"); LanguageRegistry.addName(genericIngot, "Generic Ingot"); GameRegistry.registerBlock(genericDirt, "genericDirt"); LanguageRegistry.addName(genericDirt, "Generic Dirt"); MinecraftForge.setBlockHarvestLevel(genericDirt, "shovel", 0); LanguageRegistry.addName(genericOre, "Generic Ore"); MinecraftForge.setBlockHarvestLevel(genericOre, "pickaxe", 3); GameRegistry.registerBlock(genericOre, "genericOre"); ItemStack fishRawStack = new ItemStack (Item.fishRaw); ItemStack ingotGoldStack = new ItemStack (Item.ingotGold); ItemStack genericItem = new ItemStack (Item.genericItem); GameRegistry.addRecipe(new ItemStack(Item.genericItem), "xxx", "xyx", "xxx", 'x', fishRawStack, 'y', ingotGoldStack); } @EventHandler public void postInit(FMLPostInitializationEvent event) { // Stub Method } }
  9. While following the generic mod tutorial, I decided to go off on my own way when I started the crafting recipe section. When I tried to create a crafting recipe, everything went well except for the output. I have successfully created an item called "genericItem". Just for testing purposes, I wanted to see if I could make a recipe to craft it. However, it will not recognize "genericItem" even after I try to recognize it with " ItemStack genericItem = new ItemStack (Item.genericItem);" The generic mod was completely useable up to the point where I added the recipe. Here is the relevant code snippet. ItemStack fishRawStack = new ItemStack (Item.fishRaw); ItemStack ingotGoldStack = new ItemStack (Item.ingotGold); ItemStack genericItem = new ItemStack (Item.genericItem); GameRegistry.addRecipe(new ItemStack(Item.genericItem), "xxx", "xyx", "xxx", 'x', fishRawStack, 'y', ingotGoldStack);
×
×
  • Create New...

Important Information

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