tokuhausu Posted December 21, 2019 Posted December 21, 2019 (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 woodSIGN_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? Edited December 22, 2019 by tokuhausu solved Quote
matt1999rd Posted December 21, 2019 Posted December 21, 2019 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 Quote
tokuhausu Posted December 21, 2019 Author Posted December 21, 2019 Umm MODID, in this case the default texture, so I tried both "minecraft" but couldn't draw correctly.TextureManager.getTexture () seems to return null. Quote
matt1999rd Posted December 21, 2019 Posted December 21, 2019 you needn't to do a mod for changing the texture of sign you can change it using only a resource pack 1 Quote
Draco18s Posted December 21, 2019 Posted December 21, 2019 On 12/21/2019 at 4:59 PM, matt1999rd said: you needn't to do a mod for changing the texture of sign you can change it using only a resource pack Expand That isn't the goal here. Quote 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.
matt1999rd Posted December 21, 2019 Posted December 21, 2019 On 12/21/2019 at 5:14 PM, Draco18s said: That isn't the goal here. Expand what is your problem ? Quote
Ommina Posted December 21, 2019 Posted December 21, 2019 (edited) On 12/21/2019 at 4:40 PM, 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. Expand 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 December 21, 2019 by Ommina Add ResourceLocation path edit Quote
tokuhausu Posted December 22, 2019 Author Posted December 22, 2019 On 12/21/2019 at 9:04 PM, 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. Expand As you say, getTexture () after bind () did not return null. On 12/21/2019 at 9:04 PM, 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. Expand 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). Is there a solution for this? Quote
tokuhausu Posted December 22, 2019 Author Posted December 22, 2019 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. Quote
Draco18s Posted December 22, 2019 Posted December 22, 2019 On 12/21/2019 at 5:19 PM, matt1999rd said: what is your problem ? Expand 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. Quote 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.
Recommended Posts
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.