Jump to content

[Solved][1.6.4] need help with updateTick constructor


Recommended Posts

I need help with my code. I am pretty new to the modding scene beyond making items / blocks ect. Anyway I am having a "Cannot make a static reference to the non-static field". I have tried searching around and found nothing helpful. I will now post the main class file and the block's files. (I removed all imports and crafting recipes)

Main Class =

package net.danydo11.extendedfoodmod;

@Mod(modid = ExtendedFoodMod.modid, name = "Extra Food mod", version = "v0.5 beta")
@NetworkMod(clientSideRequired = true, serverSideRequired = false)
public class ExtendedFoodMod {

public static final String modid = "extendedfood";

public static Item itemTestFood;
public static Item itemApplePie;
public static Item itemChocolateCookie;
public static Item itemToast;
public static Item itemSlicedBread;
public static Item itemDiamondApple;
public static Item itemUberApple;
public static Item itemChickenMushroom;
public static Item itemCMStew;
public static Item itemChickenStew;
public static Item itemSteakStew;
public static Item itemSweetBread;
public static Item itemSteakSandwich;
public static Item itemChickenSandwich;
public static Item itemPorkSandwich;
public static Item itemFishSandwich;
public static CreativeTabs ExtendedFoodTab;

public static Item itemCheese;
public static Item itemHam;
public static Item itemBacon;
public static Item itemFriedEgg;
public static Item itemBaconEggSandwich;
public static Item itemHamCheeseSandwich;
public static Item itemGrilledHamCheeseSandwich;
public static Item itemCheeseToast;
public static Block blockStillEmpty;
public static Block blockCheese;
public static Block blockIluminatedCheese;
public static Item itemChocolatePie;
public static Item itemIronApple;
public static Item itemEpicApple;
public static Item itemCoalApple;
public static Item itemAverageApple;
public static Item itemNetherStarApple;
public static Block blockNetherStar;
public static Item itemHolyApple;
public static BlockHalfSlab slabCheese;
public static Block stairCheese;
public static BlockHalfSlab doubleSlabCheese;

public static Block cakeCarrot;
public static Block cakeChocolate;
public static Block cheeseMelted;
public static CreativeTabs ExtendedFoodITab;
public static CreativeTabs ExtendedFoodUTab;
public static Item untextured;

    public void Init(FMLInitializationEvent event){
    	System.out.println("EXTENDEDFOOD >> Initilization started");
    	ExtendedFoodTab = new CreativeTabs("ExtendedFood"){
    			public int getTabIconItemIndex(){
    				return ExtendedFoodMod.itemApplePie.itemID;
    	ExtendedFoodITab = new CreativeTabs("ExtendedFoodUnimplimented"){
		public int getTabIconItemIndex(){
			return ExtendedFoodMod.itemUberApple.itemID;
    ExtendedFoodUTab = new CreativeTabs("ExtendedFoodUntextured"){
		public int getTabIconItemIndex(){
			return ExtendedFoodMod.itemUberApple.itemID;
    	LanguageRegistry.instance().addStringLocalization(ExtendedFoodTab.getTranslatedTabLabel(), "Extended Food");
    	LanguageRegistry.instance().addStringLocalization(ExtendedFoodITab.getTranslatedTabLabel(), "Extended Food Unimplimented");
    	itemTestFood = new ItemTFood(7892, 2, false).setUnlocalizedName("foodTest");
    	itemApplePie = new ItemDFood(7893, 8, false).setUnlocalizedName("pieApple");
    	itemChocolateCookie = new ItemDFood(7894, 2, false).setUnlocalizedName("cookieChocolate");
    	itemToast = new ItemDFood(7895, 3, false).setUnlocalizedName("toast");
    	itemSlicedBread = new ItemDFood(7896, 1, false).setUnlocalizedName("breadSliced");
    	itemDiamondApple = new ItemDDApple(7897, 6, false).setUnlocalizedName("appleDiamond");
    	itemUberApple = new ItemDUApple(7898, 6, false).setUnlocalizedName("appleUber");
    	itemChickenMushroom = new ItemDBasic(7899).setUnlocalizedName("mushroomChicken");
    	itemCMStew = new ItemDFood(7900, 12, false).setUnlocalizedName("stewChickenMushroom");
    	itemChickenStew = new ItemDFood(7901, 6, true).setUnlocalizedName("stewChicken");
    	itemSteakStew = new ItemDFood(7902, 8, true).setUnlocalizedName("stewSteak");
    	itemSweetBread = new ItemDFood(7903, 6, true).setUnlocalizedName("breadSweet");
    	itemSteakSandwich = new ItemDFood(7904, 10, true).setUnlocalizedName("sandwichSteak");
    	itemChickenSandwich = new ItemDFood(7905, 8, true).setUnlocalizedName("sandwichChicken");
    	itemPorkSandwich = new ItemDFood(7906, 10, true).setUnlocalizedName("sandwichPork");
    	itemFishSandwich = new ItemDFood(7907, 7, true).setUnlocalizedName("sandwichFish");
    	itemCheese = new ItemDFood(7908, 3, false).setUnlocalizedName("cheese");
    	itemHam = new ItemDFood(7909, 2, true).setUnlocalizedName("ham");
    	itemBacon = new ItemDFood(7910, 3, true).setUnlocalizedName("bacon");
    	itemFriedEgg = new ItemDFood(7911, 4, false).setUnlocalizedName("eggFried");
    	itemBaconEggSandwich = new ItemDFood(7912, 6, false).setUnlocalizedName("sandwichEggBacon");
    	itemHamCheeseSandwich = new ItemDFood(7913, 7, false).setUnlocalizedName("sandwichCheeseHam");
    	itemGrilledHamCheeseSandwich = new ItemDFood(7914, 8, false).setUnlocalizedName("sandwichCheeseHamGrilled");
    	itemCheeseToast = new ItemDFood(7915, 6, false).setUnlocalizedName("toastCheese");
    	blockStillEmpty = new BlockStillEmpty(2001).setUnlocalizedName("emptyStill");
    	blockCheese = new BlockDCheese(2002, Material.ground).setUnlocalizedName("cheeseBlock");
    	blockIluminatedCheese = new BlockDCheese(2003, Material.ground).setUnlocalizedName("cheeseIluminatedBlock").setLightValue(1.0F);
    	itemChocolatePie = new ItemDFood(7916, 6, false).setUnlocalizedName("pieChocolate");
    	itemIronApple = new ItemDIApple(7917, 2, false).setUnlocalizedName("AppleIron");
    	itemEpicApple = new ItemDEApple(7918, 2, false).setUnlocalizedName("AppleEpic");
    	itemCoalApple = new ItemDCApple(7919, 1, false).setUnlocalizedName("AppleCoal");
    	itemAverageApple = new ItemDAApple(7920, 1, false).setUnlocalizedName("AppleAverage");
    	itemNetherStarApple = new ItemDNSApple(7921, 10, false).setUnlocalizedName("AppleStarNether");
    	blockNetherStar = new BlockDBasic(2004, Material.iron).setUnlocalizedName("StarNeather").setHardness(0.8F);
    	itemHolyApple = new ItemDHApple(7922, 10, false).setUnlocalizedName("AppleHoly");
    	stairCheese = new BlockDStairCheese(2005, blockCheese, 1).setUnlocalizedName("CheeseStair");
    	slabCheese = (BlockHalfSlab) (new BlockDSCheese(2006, false, Material.ground, blockCheese)).setUnlocalizedName("CheeseSlab");
    	doubleSlabCheese = (BlockHalfSlab)(new BlockDSCheese(2007, true, Material.ground, blockCheese)).setUnlocalizedName("CheeseSlabDouble");
    	cakeCarrot = new BlockDCake(2008, Material.cake).setUnlocalizedName("CarrotCake");
    	cakeChocolate = new BlockDCake(2009, Material.cake).setUnlocalizedName("ChocolateCake");
    	cheeseMelted = new blockMeltedCheese(2010, Material.ground).setUnlocalizedName("MeltedCheese");
    	untextured = new ItemDBasic(7923).setUnlocalizedName("UntexturedItem");
        registerItem(itemTestFood, "Testingfood");
        registerItem(itemApplePie, "Apple Pie");
        registerItem(itemChocolateCookie, "Chocolate Cookie");
        registerItem(itemToast, "Toast");
        registerItem(itemSlicedBread, "Sliced Bread");
        registerItem(itemDiamondApple, "Diamond Apple(W.I.P use at own risk)");
        registerItem(itemUberApple, "Uber Apple(Not Implimented yet)");
        registerItem(itemChickenMushroom, "Chicken and Mushroom mush");
        registerItem(itemCMStew, "Chicken and Mushroom Stew");
        registerItem(itemChickenStew, "Chicken Stew");
        registerItem(itemSteakStew, "Beef Stew");
        registerItem(itemSweetBread, "Sweet Bread");
        registerItem(itemSteakSandwich, "Beef Sandwich");
        registerItem(itemChickenSandwich, "Chicken Sandwich");
        registerItem(itemPorkSandwich, "PorkSandwich");
        registerItem(itemFishSandwich, "Fish Sandwich");
        registerItem(itemCheese, "Cheese");
        registerItem(itemHam, "Ham");
        registerItem(itemBacon, "Bacon");
        registerItem(itemFriedEgg, "Fried Egg");
        registerItem(itemBaconEggSandwich, "Bacon and Egg Sandwich");
        registerItem(itemHamCheeseSandwich, "Ham and Cheese Sandwich");
        registerItem(itemGrilledHamCheeseSandwich, "Grilled Ham and Cheese Sandwich");
        registerItem(itemCheeseToast, "Cheese on Toast");
        registerBlock(blockStillEmpty, "An Empty Still(Very W.I.P Will Not Be Implimented For a While!!!!!!!!!!)");
        registerBlock(blockCheese, "Cheese Block");
        registerBlock(blockIluminatedCheese, "Iluminated Cheese Block");
        registerItem(itemChocolatePie, "Chocolate Pie");
        registerItem(itemIronApple, "Iron Apple(Very W.I.P Will Not Be Implimented For a While!!!!!!!!!!)");
        registerItem(itemEpicApple, "Not so Epic Apple(Very W.I.P Will Not Be Implimented For a While!!!!!!!!!!)");
        registerItem(itemCoalApple, "Coal Apple(Very W.I.P Will Not Be Implimented For a While!!!!!!!!!!)");
        registerItem(itemAverageApple, "Less than average Apple(Very W.I.P Will Not Be Implimented For a While!!!!!!!!!!)");
        registerItem(itemNetherStarApple, "Nether Star Apple(Very W.I.P Will Not Be Implimented For a While!!!!!!!!!!)");
        registerBlock(blockNetherStar, "Nether Star Block");
        registerItem(itemHolyApple, "Holy Apple(Very W.I.P Will Not Be Implimented For a While!!!!!!!!!!)");
        registerBlock(stairCheese, "Cheese Stair");
        registerBlock(slabCheese, "Cheese Slab");
        registerBlock(doubleSlabCheese, "Double Cheese slab");
        registerBlock(cakeCarrot, "Carrot Cake");
        registerBlock(cakeChocolate, "Chocolate Cake");
        registerBlock(cheeseMelted, "Melted Cheese");
        registerItem(untextured, "Item.Danydo11.get.texture.untextured.item");
        System.out.println("Bacon and egg but no blt ");
        System.out.println("Put the kettle on Gromit");
        System.out.println("EXTENDEDFOOD >> Initilization finished");

public void registerBlock(Block block, String name){
    	GameRegistry.registerBlock(block, block.getUnlocalizedName());
    	LanguageRegistry.addName(block, name);
    public void registerItem(Item item, String name){
    	GameRegistry.registerItem(item, item.getUnlocalizedName());
    	LanguageRegistry.addName(item, name);



BlockDCheese =

package net.danydo11.extendedfoodmod.block;

public class BlockDCheese extends Block{

public BlockDCheese(int id, Material material) {
	super(id, material);

public void harvestBlock(World par1World, EntityPlayer par2EntityPlayer, int par3, int par4, int par5, int par6)
    ItemStack itemstack = this.createStackedBlock(par6);
par2EntityPlayer.addStat(StatList.mineBlockStatArray[this.blockID], 1);
     this.dropBlockAsItem_do(par1World, par3, par4, par5, itemstack);

public int quantityDropped(Random par1Random)
        return 0;

public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
        if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11 - Block.lightOpacity[this.blockID])
            if (par1World.provider.isHellWorld)
                par1World.setBlockToAir(par2, par3, par4);

            this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
            par1World.setBlock(par2, par3, par4, BlockMeltedCheese.blockID);


BlockMeltedCheese =

package net.danydo11.extendedfoodmod.block;

public class BlockMeltedCheese extends Block{

public BlockMeltedCheese(int id, Material material) {
	super(id, material);

public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity)
        par5Entity.motionX *= 0.4D;
        par5Entity.motionZ *= 0.4D;




If you need me to add in the imports I can do that. I hope someone can help me and forgive for being a noob.



-Update It was a derp on my part, all i had to do was change the BlockDCheese class. The only edit I had to make was change BlockMeltedCheese.blockID to ExtendedFoodMod.BlockMeltedCheese.BlockID

Link to comment
Share on other sites

The issue being here:

if (par1World.getSavedLightValue(EnumSkyBlock.Block, par2, par3, par4) > 11 - Block.lightOpacity[this.blockID])

If you don't know what that error is then you're not just a modding noob; you're a java noob too. Direct your question to a google search or a java teacher of some kind, not the modder support forums.

e.g. [lmgtfy]Java Cannot make a static reference to the non-static method[/lmgtfy]

Additionally, you should get out of the habit of using blockIDs, it won't work at all in 1.7.x.

Link to comment
Share on other sites

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.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

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