Jump to content

Recommended Posts

Posted

Hello everyone today I bring an issue to the forums about an error I cannot seem to fix on my mod... Here is the code with the error

package com.ioppy.industrialrevolution.init;

import net.minecraft.item.Item;

public class IndustrialRevolutionItems {

public static Item pocket_watch;

public static void register() {
	pocket_watch = new Item().setUnlocalizedName(pocket_watch);
}

}

 

It is the line "pocket_watch = new Item().setUnlocalizedName(pocket_watch);" I keep getting the error: "The method setUnlocalizedName(String) in the type Item is not applicable for the arguments (Item)" As you can probably tell I am brand new to mod creation and I was hoping someone could help me resolve this so that I can learn from it....

 

Note: if you need to see any other part of my mod please let me know!

 

Regards,

 

 

~Ops

Posted

Item#setUnlocalizedName

takes a

String

argument, but you're trying to pass it the value of the

pocket_watch

field (an

Item

). String literals are delimited by double quotes (

"

).

 

This is an extremely basic concept of Java. You can't write a mod until you understand Java properly.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Thanks Choonster this has fixed my problem... Also I tried learning java in several different places but none seem seem to stick recommend any places?

Posted

I learned Java at university, so I don't really know of any good tutorials for it from personal experience. You could try

or Vswe's Summer Courses (covers Java and Forge).

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.