I'm currently fooling around with forge figuring out the basics of mod development. Although I'm quite a fluent programmer in java, I've found it very difficult to get a texture loaded and the error messages only tell me that it failed to load, not where it looks for the texture I specified.
As such, could somebody please explain how to load a single, 16x16 png image as a texture, and how to tell forge where to load it from. I have already made a custom item and an image.
You MUST put a texture file inside the Minecraft.jar for it to load correctly if you are using ModLoader/MCP. Forge requires you to put all textures in an extension like this:
Alright, well I'm currently working in eclipse and I call 'mySword.setTextureName("examplemod:mySword.png");'. I've also tried without '.png'
I have tried placing the icon at: src/assets/minecraft/examplemod/textures/items and at src/minecraft/assets/examplemod/textures/items.
Neither one loads properly and I receive the following errors:
[18:39:49] [Client thread/ERROR]: Couldn't set icon
javax.imageio.IIOException: Can't read input file!
at javax.imageio.ImageIO.read(Unknown Source) ~[?:1.7.0_17]
at net.minecraft.client.Minecraft.readImage(Minecraft.java:680) ~[Minecraft.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:509) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:931) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_17]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_17]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_17]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_17]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
[18:40:35] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/items/MISSING_ICON_ITEM_4096_mySword.png
java.io.FileNotFoundException: minecraft:textures/items/MISSING_ICON_ITEM_4096_mySword.png
at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[SimpleReloadableResourceManager.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:128) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:93) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTickableTexture(TextureManager.java:71) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTextureMap(TextureManager.java:58) [TextureManager.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:621) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:931) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(Main.java:112) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_17]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_17]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_17]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_17]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]
at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]
Where exactly do I place my texture file? What method do I call to load it? I've looked up numerous threads about textures failing to load and although many of them give me a directory to place the file in, it doesn't load the texture and gives me the two errors above.
Hey CraftMuch, thanks for your reply
I won't have access to my computer for a day or two, but I'll try it out as soon as I can and respond with the results good or bad. By the look of it, you've got a solution that should work, and I had been wondering why forge completely ignored my every attempt to specify a file path. With luck, that's exactly my problem.
As such, could somebody please explain how to load a single, 16x16 png image as a texture, and how to tell forge where to load it from. I have already made a custom item and an image.
Thanks for any insight you can give me
(Mod Name).jar/mods/(I Think Package Name?)/textures/(armor|blocks|gui|items)
U◦N◦I
U‣N‣I
I have tried placing the icon at: src/assets/minecraft/examplemod/textures/items and at src/minecraft/assets/examplemod/textures/items.
Neither one loads properly and I receive the following errors:
Where exactly do I place my texture file? What method do I call to load it? I've looked up numerous threads about textures failing to load and although many of them give me a directory to place the file in, it doesn't load the texture and gives me the two errors above.
I won't have access to my computer for a day or two, but I'll try it out as soon as I can and respond with the results good or bad. By the look of it, you've got a solution that should work, and I had been wondering why forge completely ignored my every attempt to specify a file path. With luck, that's exactly my problem.