Jump to content

Recommended Posts

Posted

Whenever I tried to register a Pickaxe, It gives me an error........

 

ModTools class

  Reveal hidden contents

 

PotatoPickaxe class

  Reveal hidden contents

 

Posted

That is not my main class, Sorry. Here it is

 

  Reveal hidden contents

 

I am getting an error towards PotatoPickaxe = new PotatoPickaxe()

there are too many classes to put in here. I thought that would be enough....

 

 

 

Posted

First, please PLEASE organize your code. It looks horrid. Second, don't use the same name as an object when assigning an object's value. Java (and you) will get confused. Do something like this:

 

public static Item potatoPickaxe;

public static void init() {
    potatoPickaxe = new PotatoPickaxe();
    // You don't seem to register your item anywhere. You will need to do something like this, otherwise, your item will not load.
    GameRegistry.addItem(potatoPickaxe, "item.potatoPickaxe");
}

 

You can also pre-assign objects like so:

 

public static Item potatoPickaxe = new PotatoPickaxe();

public static void init() {
    // You still need to register the item, though.
    GameRegistry.registerItem(potatoPickaxe, "item.potatoPickaxe");
}

 

Less code to write, and generally looks nicer.

if (user.hasKnowledgeOfJava) {

    if (user.question.hasCode) {

        return interpetHelpfulResponse(user.getQuestion());

    } else {

        return "Could you post your code please?";

    }

} else {

    return "Learn some freaking Java!";

}

Posted

I'm sorry about my lack of organization. I've fixed it some how. I just removed (Item.ToolMaterial material) and replaced the the material inside the super() with nayoMaterial, also I registered it inside the PotatoPickaxe class. I will try to organize my codes.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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