Jump to content

Ore Dictionary static error in eclipse


volcomrj

Recommended Posts

Cannot make a static reference to the non-static method registerOre(String, ItemStack) from the type IOreHandler

 

Line of declaration (did import):

 

IOreHandler.registerOre("ingotRefinedIron", ingotSteelStack);

 

 

ingotSteelStack Declaration:

 

ItemStack ingotSteelStack = new ItemStack(ingotSteel);

 

 

ingotSteel Declaration (Don't bug me for using default Modloader sprites, gonna fix):

 

public final Item ingotSteel = new itemSteel(144).setIconIndex(ModLoader.addOverride("/gui/items.png", "/physicraft/items/ingotSteel.png")).setItemName("ingotSteel");

 

 

itemSteel Class:

 

package net.minecraft.src;

 

public class itemSteel extends Item

{

        public itemSteel(int i)

        {

                super(i);

        }

}

 

 

Link to comment
Share on other sites

  • 2 weeks later...

IOreHandler.registerOre("ingotRefinedIron", ingotSteelStack);

You are calling an abstract static method that does not exist.  IOreHandler (hence the I on the front for Interface) means that 'you' need to implement it.  This is how you handle callbacks.  :)

 

Actually, here is an idea, look at the IronChest mods source code (https://github.com/cpw/ironchest/), it uses the IOreHandler callback to set up recipes for mod added copper/tin/etc...

 

You also need to register your ores, there should be a method for that on the MinecraftForge class or ForgeHooks or something.

Link to comment
Share on other sites

  • 2 weeks later...

if you are using MForge you should consider making a sprite sheet like what minecraft has, a 256x256 png file

 

add this line to your load() method

MinecraftForgeClient.preloadTexture("Directory Here");

 

also have the item code look something like this

public final Item ingotSteel = new itemSteel(144).setIconIndex(0).setItemName("ingotSteel");

0 is the first 16x16 section on the sprite sheet

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.

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

×   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.

Announcements



×
×
  • Create New...

Important Information

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