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



×
×
  • Create New...

Important Information

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