0
\$\begingroup\$

I am attempting to make an item using the latest version of Forge. For some reason, the setTextureName method gives me an error that says:

The method setTextureName(String) is undefined for the type ItemKey

I have been trying to fix this for a while, and notice that when I remove the quotation marks from the colon the error for setTextureName disappears, but I get an error on the colon that says:

Syntax error on token ":", delete this token

an error on the + sign that says

The operator + is undefined for the argument type(s) String

and finally an error on "key" that says

The method setTextureName(String) is undefined for the type ItemKey

This is my first time trying to make an item, so help would be greatly appreciated.

EDIT: I just figured out that if I change MODID to modid in the setTextureName method I stop getting an error message for setTextureName but instead get an error for modid saying that

modid cannot be resolved or is not a field

package com.arti.artismod;

import net.minecraft.item.Item;
import net.minecraft.creativetab.CreativeTabs;

public class ItemKey extends Item {
    private String name = "key";
    public ItemKey() {
        setUnlocalizedName(ArtisMod.MODID + "_" + "key");
        setTextureName(ArtisMod.MODID + ":" + "key");
        setCreativeTab(CreativeTabs.tabMisc);
    }
}
\$\endgroup\$
  • 1
    \$\begingroup\$ Forge 1.8 uses a completely different method of managing textures. See here. \$\endgroup\$ – newton1212 Jun 25 '15 at 21:54
0
\$\begingroup\$

First off, it would be greatly beneficial to learn Java before attempting to create a minecraft mod. There are many great tutorials out there (I personally started out learning with thenewboston's tutorials on youtube) and you'll gain a new useful skill!

Now onto your question. As newton1212 said, texture management has changed in 1.8. In fact, nearly everything related to rendering as a whole has been changed in the base game. JSON is now used for almost the entire system. This tutorial covers updating a mod to 1.8 rather than creating one, however the updated files should be helpful to you anyways.

Good luck and feel free to ask any more questions you have.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the link! It looks like just what I need. (Oh and by the way, I am pretty familiar with java, this is just the first time I'm making a mod with an item.) \$\endgroup\$ – Arti Schmidt Jun 27 '15 at 23:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.