Jump to content

[1.10.2] Rendering texture showing up pink? [FileNotFoundException]


IceMetalPunk

Recommended Posts

I have a GUI, and part of it is supposed to render a fluid tank. I'm handling the rendering in the custom fluid tank class itself, and passing the gui instance to it. Everything worked fine when I was rendering the fluid as a solid color, but now I'm trying to make it render the actual fluid's still texture and...it's pink. The fluid texture itself is green and animated (literally a re-color of the vanilla water texture), but the rendered fluid is just solid pink.

 

This is the relevant code:

 

			GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
		GlStateManager.disableBlend();
		Minecraft.getMinecraft().getTextureManager().bindTexture(tex);
		GuiUtils.drawTexturedModalRect(left, top, 0, 0, width, renderHeight, zLevel);
		GlStateManager.enableBlend();

 

I've drawn some debug text and verified that "tex" is holding the correct ResourceLocation (specifically, "chaotica:fluids/corrosive_chaos_still", with "chaotica" being the domain; the texture is located in "assets/chaotica/textures/fluids/corrosive_chaos_still.png"). The left, top, width, height and zLevel are all correct as well, which makes sense since the rectangle is being drawn in the correct place and the correct size. It's just...pink.

 

Why is it pink? xD

Whatever Minecraft needs, it is most likely not yet another tool tier.

Link to comment
Share on other sites

If by pink you mean this color:

████████████

Then it's likely just a corner section of the MISSING_TEXTURE texture.

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

Yes, that color. The thought crossed my mind, but since it never rendered the usual black checkerboard either, even after growing pretty tall, I wasn't sure if that was the case.

 

But as I said, I've confirmed the ResourceLocation is correct (or at least its string form is correct), and I have the .png texture file in that same location. I'm wondering: does it *have* to be in a standard directory, such as "blocks" or "items"? I was hoping to keep my workspace more organized by creating my own "fluids" directory, figuring that shouldn't be a problem as long as I coded the proper directory, right?

 

If that's okay, then what else would cause the image not to be found? (Actually, this is an image I'm not assigning as a texture to any block or anything yet; it's just an image file. Could that be the problem? And if so, will I need to create a dummy class to assign the texture to for it to work? That feels very hacky...)

 

*EDIT* I just realized I'd overlooked an error in my log. It does indeed say the corrosive chaos still texture file is not found. Why would it be unable to find it? Or do I need to specify the "textures" part of the path myself? (I'm about to try that, just brainstorming here.)

 

*Update: Nope, specifying the "textures" portion of the path did not, in fact, get rid of the File Not Found error...

Whatever Minecraft needs, it is most likely not yet another tool tier.

Link to comment
Share on other sites

You need the .png on the end.

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

Nope; adding the .png extension didn't help. It's still giving me a FileNotFoundException.

 

If it helps, this whole project has a GitHub repo, where you can look at both the code and the resource paths: https://github.com/IceMetalPunk/Chaotica (This particular piece of code is in the FluidTankChaos() class's render() method; the resource locations are initialized in the individual fluid classes).

 

Any ideas? I don't understand how I can be getting a File Not Found exception when the file is right there...unless I'm misunderstanding something about the way Minecraft parses resource locations?

Whatever Minecraft needs, it is most likely not yet another tool tier.

Link to comment
Share on other sites

The ResourceLocation is wrong. You use

"chaotica:fluids/corrosive_chaos_still.png"
which points to
assets/chaotica/fluids/corrosive_chaos_still.png
The texture is located at
assets/textures/chaotica/fluids/corrosive_chaos_still.png

The correct ResourceLocation would be

"chaotica:textures/fluids/corrosive_chaos_still.png"
Link to comment
Share on other sites

The ResourceLocation is wrong. You use

"chaotica:fluids/corrosive_chaos_still.png"
which points to
assets/chaotica/fluids/corrosive_chaos_still.png
The texture is located at
assets/textures/chaotica/fluids/corrosive_chaos_still.png

The correct ResourceLocation would be

"chaotica:textures/fluids/corrosive_chaos_still.png"

 

*Facepalm* I added "textures", but forgot the extension, then I added the extension and removed "textures"... Thank you! I don't know why I had it in my head that Minecraft would assume parts of the path, such as "textures" and ".png", for ResourceLocations being bound to textures.

 

Thanks again!

Whatever Minecraft needs, it is most likely not yet another tool tier.

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.



×
×
  • Create New...

Important Information

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