holypinkhobo Posted July 11, 2014 Posted July 11, 2014 I'm new to 1.7 coding. I added a block with the local name as copperore and added all the vairable such ass setCreativeTab and setBlockName. Registering the block works fine its just when i use .setBlockHarvestLevel eclipse gives me the error "This Method setBlockHarvestLevel (Block,String,int) is undefined for the type MinecraftForge. I'm sure i just made a small mistake in the coding and can't catch it myself, so any help please? package morefoodandtools; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; 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.EventHandler; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; @Mod(modid = BaseClassMFT.MODID, version = BaseClassMFT.VERSION) public class BaseClassMFT { public static final String MODID = "mft"; public static final String VERSION = "Alpha 1.0 Prerelease 1: Chicken Extension!"; //Initializatiion //Blocks public static final Block copperore = new CopperOre(Material.rock); //Tools //Food //Chicken Salad public static Item chickensalad = new ChickenSalad(2, 2, 0.5f, false). setCreativeTab(CreativeTabs.tabFood).setUnlocalizedName("chickensalad") .setMaxStackSize(.setTextureName(MODID + ":" + "chickensalad"); //Chicken Soup public static Item chickensoup = new ChickenSoup(3, 4, false) .setCreativeTab(CreativeTabs.tabFood).setUnlocalizedName("chickensoup") .setMaxStackSize(.setTextureName(MODID + ":" + "chickensoup"); //Chicken Pot Pie public static Item chickenpotpie = new ChickenPotPie(4, 4, false) .setCreativeTab(CreativeTabs.tabFood).setUnlocalizedName("chickenpotpie") .setMaxStackSize(16).setTextureName(MODID + ":" + "chickenpotpie"); //Pink Slime public static Item pinkslime = new PinkSlime(1, 1, false) .setCreativeTab(CreativeTabs.tabFood).setUnlocalizedName("pinkslime") .setMaxStackSize(64).setTextureName(MODID + ":" + "pinkslime"); //Chicken Nugget public static Item chickennugget = new ChickenNugget(10, 6, true) .setCreativeTab(CreativeTabs.tabFood).setUnlocalizedName("chickennugget") .setMaxStackSize(.setTextureName(MODID + ":" + "chickennugget"); @EventHandler //Crafting and Registering public void preInit(FMLPreInitializationEvent event) { //Food //Chicken Salad GameRegistry.addRecipe(new ItemStack(chickensalad, 3), new Object[]{ " A ", " B ", " C ", ('A'), Items.wheat, ('B'), Items.cooked_chicken, ('C'), Items.bowl, }); GameRegistry.registerItem(chickensalad, "chickensalad"); //Chicken soup GameRegistry.addRecipe(new ItemStack(chickensoup, 3), new Object[]{ " D ", " E ", " F ", ('D'), Items.carrot, ('E'), Items.cooked_chicken, ('F'), Items.bowl, }); GameRegistry.registerItem(chickensoup, "chickensoup"); //Chicken Pot Pie GameRegistry.addRecipe(new ItemStack(chickenpotpie, 3), new Object[]{ "BBB", "BCB", "B#B", ('B'), Items.bread, ('C'), Items.carrot, ('#'), Items.cooked_chicken, }); GameRegistry.registerItem(chickenpotpie, "chickenpotpie"); //Pink Slime GameRegistry.addRecipe(new ItemStack(pinkslime, 3), new Object[]{ " D ", " E ", " F ", ('D'), Items.rotten_flesh, ('E'), Items.cooked_chicken, ('F'), Items.bone, }); GameRegistry.registerItem(pinkslime, "pinkslime"); //Chicken Nugget GameRegistry.addRecipe(new ItemStack(chickennugget, 1), new Object[]{ "BBB", "BCB", "BBB", ('B'), Items.bread, ('C'), pinkslime, }); GameRegistry.registerItem(chickennugget, "chickennugget"); //Blocks GameRegistry.registerBlock(copperore, "copperore"); MinecraftForge.setBlockHarvestLevel(copperore, "pickaxe", 2); }} and for my CopperOre class... package morefoodandtools; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class CopperOre extends Block { public CopperOre(Material p_i45394_1_) { super(p_i45394_1_); setHardness(0.2f); setStepSound(Block.soundTypeStone); setCreativeTab(CreativeTabs.tabBlock); setBlockName("copperore"); Quote
holypinkhobo Posted July 11, 2014 Author Posted July 11, 2014 Then you are doing it wrong. The method exists. No you were right, rookie mistake on my side. Thank you Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.