Jump to content

[Solved] [1.14.4] TextureManager.bindTexture (ResourceLocation) does not work well


Recommended Posts

Posted (edited)

I am trying to draw the texture of the signboard on the screen using TextureManager.bindTexture () when hovering over the signboard.
In 1.12.2
 

[1.12.2]
public class SignReader extends HudBase {
    private static final ResourceLocation SIGN_TEXTURE = new ResourceLocation ("textures / entity / sign.png");

    @Override
    public Rect render (Event event) {

        Minecraft.getInstance (). GetTextureManager (). BindTexture (SIGN_TEXTURE);

                / * ....... my code ....... * /
    }
}



And it was drawing normally.
In 1.14.4, the texture of the signboard was divided for each wood
SIGN_TEXTURE in the above code

[1.14.4]
new ResourceLocation ("textures / entity / signs / oak.png");


Changed to
However, these codes do not work properly, and a black rectangle is drawn on the screen.
Is the ResourceLocation of oak.png wrong?
Or has bindTexture () changed its usage?

 

988f823cc4aaee24e55e397ff4ad1a15.png3201b939f600493b0e78679c6ad072e7.png

Edited by tokuhausu
solved
Posted

In 1.14, the ResourceLocation definition required two arguments :

you may use this instead :

ResourceLocation SIGN_TEXTURE = new ResourceLocation(YourMod.MODID,"textures/entity/signs/oak.png");

the MODID is how you name your mod

Posted
15 minutes ago, matt1999rd said:

you needn't to do a mod for changing the texture of sign you can change it using only a resource pack

That isn't the goal here.

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.

Posted (edited)
4 hours ago, tokuhausu said:

Umm
MODID, in this case the default texture, so I tried both "minecraft" but couldn't draw correctly.
TextureManager.getTexture () seems to return null.

 

What happens if you cal getTexture() after bind() ?  And what appears in the log?

 

Looking at TextureManager, bind() will load the texture if the texture is not already in the manager's internal map.  getTexture() will not - it is just a reach into the map and return whatever is (or is not) there.  So if getTexture() is still returning null after the bind() ( or loadTexture() ), that'll give you a hint of where things could be going wrong.

 

That said, loadTexture() does log a warning if there in an IOException, and crashes outright if there is some other exception, so I'd expect there to be a note in the log if something were going wrong here.

 

Edit: And those spaces in the ResourceLocation path... there are just there for the convenience of those reading the post, right?  If you're getting a ResourceLocationException in the logs, well, that would go a long way to explain why the later bind() is not working.

Edited by Ommina
Add ResourceLocation path edit
Posted

 

4 hours ago, Ommina said:

Looking at TextureManager, bind() will load the texture if the texture is not already in the manager's internal map.  getTexture() will not - it is just a reach into the map and return whatever is (or is not) there.  So if getTexture() is still returning null after the bind() ( or loadTexture() ), that'll give you a hint of where things could be going wrong.

As you say, getTexture () after bind () did not return null.

4 hours ago, Ommina said:

That said, loadTexture() does log a warning if there in an IOException, and crashes outright if there is some other exception, so I'd expect there to be a note in the log if something were going wrong here.

No exception is raised at runtime.

 

 

I considered another drawing method.
So, refer to

net.minecraft.client.gui.screen.EditSignScreen

TileEntityRendererDispatcher.instance.render (TileEntity, Double, Double, Double, Float);


By using, the texture was successfully drawn.
However, when text is written on the signboard, the texture is not drawn correctly and the text texture is displayed (see image).

cc82082c869f93260605155754e7a4b7.png8f527cc7fc2aaee16b382d22aa7a363b.png
Is there a solution for this?

Posted

While working with the code, I noticed that when I upgraded, the color settings were incorrect.
This was not because the texture was not drawn, but because the texture was painted black.
After modifying the code, it was successfully drawn.
Sorry for the trouble.

Posted
13 hours ago, matt1999rd said:

 

what is your problem ?

Its not my problem. But if you felt like knowing, its drawing the existing sign texture into a GUI.

As you might notice from the included images in the first post.

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.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Hi, I've been having trouble trying to use forge as it shows a black screen when I open the game, but I can still interact with it and hear the music.  I've done all of the step by steps and most common fixes like updating drivers, keeping up to date with Java, deleting and reinstalling minecraft, restarting my computer MANY times, even smaller things like splash.properties (I didn't have that file so I added it and set it to false thinking it would do something, definitely not) and making sure to prioritize my rtx 3070 in the settings but with no luck. Minecraft works as intended when I uninstall forge and I also don't have any mods currently, it just gives me this issue when I install forge. I also increased the ram usage, made sure my hardware isn't full or anything, and even changed the resolution in hopes it would fix things. I checked my antivirus and firewall but that isn't the issue either. Trust me, I've done everything I can think of. For some reason the black screen does flicker a little into the main menu, but obviously unplayable. I couldn't even make my way to the settings with how little it flickered. I'm not sure if it flickered randomly or if it was because I was messing around moving and clicking a bunch, I didn't really test it that much.  
    • I've had a really weird issue recently,  I wanted to add the Depper and Darker mod on my dedicated server (MC 1.21 with Fabric 0.16.9, hosted on nitroserv.com) but whenever I do add the mod the sever stops doing anything after listing the mods, and I get no crash or error or anything, just a stuck server. Here's a normal log of the server booting up: https://pastebin.com/JipFF2Eh and here's the log of the server doing the weird thing: https://pastebin.com/W4JBh3eX I just don't understand it. I've tried removing other mods (somewhat randomly) but deeper and darker still breaks my server whenever I add it. NitroServ support staff is about as confused as I am and I've had no response from the Deeper and Darker support staff... Now I know this is the Forge support not the Fabric support but I'm just trying to know if anyone has any kind of idea to fix this (aside from not using the mod obviously) Also I still have a bunch of errors and warnings whenever the server does start properly, are there any of them I should be worried about?
    • Delete the config of RandomTweaker (config folder) If there is no change, remove this mod
    • Hello! So i have been trying to make a mod that adds plant fiber to minecraft 1.16.5 (i believe there are mods that add plant fiber but not for 1.16.5) but the problem is that i want to modify the loot table of grass to always drop plant fiber but also keep the vanilla drops. Most common answer i have seen is GlobalLootModifiers. But my tiny brain cant understand any tutorials. So any help is appreciated.
    • Minecraft forge 1.12.2 does not load. Here is both logs. I assume its because of a mod that i have, idk. (L521)
  • Topics

×
×
  • Create New...

Important Information

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