Jump to content

Creating a ResourceLocation in a coremod


voidzm

Recommended Posts

I have a coremod that needs to load some image assets and draw them on the screen in a GUI. I'm using the OpenGL drawing functions, so I need to get a ResourceLocation for the images before I can bind the textures and draw them.

 

However, upon trying to bind the texture, an error occurs:

 

 

2013-07-13 15:40:42 [WARNING] [Minecraft-Client] Failed to load texture: mymodid:textures/gui/image.png

java.io.FileNotFoundException: mymodid:textures/gui/image.png

at net.minecraft.client.resources.SimpleReloadableResourceManager.func_110536_a(SimpleReloadableResourceManager.java:66)

at net.minecraft.client.renderer.texture.SimpleTexture.func_110551_a(SimpleTexture.java:31)

at net.minecraft.client.renderer.texture.TextureManager.func_110579_a(TextureManager.java:84)

at net.minecraft.client.renderer.texture.TextureManager.func_110577_a(TextureManager.java:41)

at com.voidzm.mymodid.gui.MyGui.drawScreenBackground(MyGui.java:106)

at com.voidzm.mymodid.gui.MyGui.drawScreen(MyGui.java:123)

at net.minecraft.client.renderer.EntityRenderer.updateCameraAndRender(EntityRenderer.java:1036)

at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:934)

at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:826)

at net.minecraft.client.main.Main.main(Main.java:93)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

at java.lang.reflect.Method.invoke(Unknown Source)

at net.minecraft.launchwrapper.Launch.launch(Launch.java:57)

at net.minecraft.launchwrapper.Launch.main(Launch.java:18)

 

 

I'm using this code to create the ResourceLocation:

 

 

ResourceLocation resourceLocation = new ResourceLocation("mymodid:textures/gui/image.png");

 

 

And this code to bind it for drawing:

 

 

this.mc.renderEngine.func_110577_a(resourceLocation);

 

 

"image.png" is located at "/assets/mymodid/textures/gui/image.png". I did read that having an uppercase modid in the file path would cause this error to occur, but the modid is lowercase, so that can't be the problem.

 

Any ideas? I can't seem to make this ResourceLocation stuff work properly, and I don't know if the fact that I don't have a regular @Mod file has anything to do with it. If it does, then this is a really stupid way to have the texture system set up (requiring a @Mod file with a registered modid before the resource engine will find any of your textures.)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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