Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.7.10] [SOLVED] Can't Load Texture!


Graystripe
 Share

Recommended Posts

Hello,

I'm brand new to mod development, and have a bit of background in Java.

I've been trying to get a simple mod to work and the textures aren't loading!

 

This is the error:

[10:11:22] [Client thread/ERROR]: Using missing texture, unable to load lunamod:textures/items/wand.png
java.io.FileNotFoundException: lunamod:textures/items/wand.png

 

I've tried looking up the issue, and the only other problems that people have are messed up directories or capitalized mod IDs.

 

File directory structure:

├── java

│  └── lunamod

│      ├── LunaMod.java

│      ├── ModInformation.java

│      ├── config

│      │  └── ConfigHandler.java

│      ├── items

│      │  ├── ItemInformation.java

│      │  ├── ItemWand.java

│      │  └── Items.java

│      └── proxies

│          ├── ClientProxy.java

│          └── CommonProxy.java

├── mcmod.info

└── resources

    └── assets

        └── lunamod

            ├── lang

            │  └── en_US.lang

            └── textures

                └── items

                    └── wand.png

 

(I've excluded the imports to save space)

Main mod file:

package lunamod;

@Mod(modid = ModInformation.ID, name = ModInformation.NAME, version = ModInformation.VERSION)

public class LunaMod {

    @Mod.Instance(ModInformation.ID)
    public static LunaMod instance;

    @SidedProxy(clientSide = "lunamod.proxies.ClientProxy", serverSide = "lunamod.proxies.CommonProxy")
    public static CommonProxy proxy;

    @Mod.EventHandler
    public void preInit(FMLPreInitializationEvent initializationEvent) {
        //Loads configuration
        ConfigHandler.init(initializationEvent.getSuggestedConfigurationFile());

        Items.initializeItems();

        //Empty methods... for now
        proxy.initSounds();
        proxy.initRenderers();

    }

    @Mod.EventHandler
    public void init(FMLInitializationEvent event) {
        Items.registerItems();
    }

    @Mod.EventHandler
    public void postinit(FMLPostInitializationEvent event) {
   
    }

}

 

ModInformation.java

package lunamod;

public class ModInformation {
    public static final String ID = "lunamod";
    public static final String NAME = "Luna Mod";
    public static final String VERSION = "0.0.1";
}

 

Items.java

package lunamod.items;

public class Items {

    public static Item wand;

    public static void initializeItems() {
        //Initializes items
        wand = new ItemWand(ItemInformation.WAND_ID);
    }

    public static void registerItems() {
        //Registers items
        GameRegistry.registerItem(wand, ItemInformation.WAND_NAME);
    }
}

 

ConfigHandler.java

package lunamod.config;

public class ConfigHandler {
    public static void init(File file) {
        Configuration config = new Configuration(file);
        config.load();

        ItemInformation.WAND_ID = config.get("Weapons",
                                        ItemInformation.WAND_KEY,
                                        ItemInformation.WAND_DEFAULT_ID).getInt() - 256;
        config.save();
    }

}

 

Items.java

package lunamod.items;

public class Items {

    public static Item wand;

    public static void initializeItems() {
        //Initializes items
        wand = new ItemWand(ItemInformation.WAND_ID);

    }

    public static void registerItems() {
        //Registers items
        GameRegistry.registerItem(wand, ItemInformation.WAND_NAME);
    }
}

 

ItemInformation.java

package lunamod.items;

public class ItemInformation {

    //Wand
    public static int WAND_ID;
    public static final String WAND_KEY = "wand";
    public static final String WAND_NAME = "Wand";
    public static final String WAND_DEFAULT_ID = "4400";
    public static final String WAND_UNLOCALIZED_NAME = "wand";
    public static final String WAND_ICON = "wand";
}

 

ItemWand.java

package lunamod.items;

public class ItemWand extends Item {
    public ItemWand(int id) {
        super();
        setUnlocalizedName(ModInformation.ID + "_" + ItemInformation.WAND_UNLOCALIZED_NAME);
        setTextureName(ModInformation.ID + ":" + ItemInformation.WAND_ICON);
        setCreativeTab(CreativeTabs.tabCombat);
        setMaxStackSize(1);
    }

    @Override
    public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase target) {
        //Checks to see if the entity is on the client or server
        //If on server, do stuff. If on client, ignore.
        if (!target.worldObj.isRemote) {
            target.motionY = 0.5;
            target.motionX = 3;
        }

        return false;
    }

}

 

 

Link to comment
Share on other sites

Ok, that looks alright (except that your mcmod.info file should be in src/main/resources).

I am assuming that you just excluded src/main from your filetree here. If not, you should fix that.

 

Then you should be registering Items in preInit, not init.

 

Sorry about that, and yes - it's in src/main

Updated filetree:

 

└── src

    └── main

        ├── java

        │   └── lunamod

        │      ├── LunaMod.java

        │      ├── ModInformation.java

        │      ├── config

        │      │   └── ConfigHandler.java

        │      ├── items

        │      │   ├── ItemInformation.java

        │      │   ├── ItemWand.java

        │      │   └── Items.java

        │      └── proxies

        │          ├── ClientProxy.java

        │          └── CommonProxy.java

        └── resources

            ├── assets

            │   └── lunamod

            │      ├── lang

            │      │   └── en_US.lang

            │      └── textures

            │          └── items

            │              └── wand.png

            └── mcmod.info

 

I moved the registerItems() method into the preInit, but I'm still getting the same error....

 

 

Link to comment
Share on other sites

I am using IntelliJ Idea 14.0.2 and Mac OS X 10.10.1.

 

I installed like this:

1) Downlaoded Forge src (Recommended build forge-1.7.10-10.13.2.1230)

2) ./gradlew setupDecompWorkspace --refresh-dependencies

3) Open IntelliJ and let it install dependencies

4) ./gradlew genIntellijRuns

5) Code!

Link to comment
Share on other sites

  • 2 years later...
9 minutes ago, RareScrap said:

Link is broken

That link (and this thread) is 2 years old. The forum changed what software it runs on.

This thread is for 1.7.10 is no longer supported here.

Edited by Draco18s

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share



×
×
  • Create New...

Important Information

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