Jump to content

[Solved] [1.12.2] Transparent text with shadow only transparent where both overlap


Recommended Posts

Posted (edited)

The goal of my mod is to replace heldItemTooltips with the ones from Console Edition which show enchantments and certain nbt tags in addition to the name of the current object. My replacement is supposed to fade away after a short time like the vanilla heldItemTooltips do.

I'm having a problem with text that is supposed to be transparent. There is also a shadow behind it which currently leads to an interesting effect, but not my desired result: The text is only transparent where the coloured text and its shadow overlap. 

2018-07-16_14_16.43_2.png.69e4439d70ee0da99a4504a0c3d8bb6a.png

I'm using RenderGameOverlayEvent.Pre to render the text. Nothing is changed with GlStateManager before rendering, I'm guessing that my problem is caused by that and that I need to configure some GlStateManager settings, but I'm not finding the correct one. But maybe it's something completely else.

My code for this project can be found in this file on Github.

I hope that someone is able to point me to the problem since I've really tried a lot and so far nothing is making everything fade away like it is supposed to. Thank you guys in advance!

__________________________________________________________________________________________________________________

EDIT a very long time later for anyone who stumbles across this post trying to fix a similar issue in their own mod like I do all the time on this forum:

The issue was simply the text being rendered every time RenderGameOverlayEvent.Pre is called. I just forgot to check for

event.getType() == RenderGameOverlayEvent.ElementType.ALL

Because in the end running on Pre for ALL is actually a lot better for this purpose than using the Text event recommended below.

Edited by Fusseel
found the solution by now
Posted
15 minutes ago, Fusseel said:

The goal of my mod is to replace heldItemTooltips with the ones from Console Edition which show enchantments and certain nbt tags in addition to the name of the current object. My replacement is supposed to fade away after a short time like the vanilla heldItemTooltips do.

I'm having a problem with text that is supposed to be transparent. There is also a shadow behind it which currently leads to an interesting effect, but not my desired result: The text is only transparent where the coloured text and its shadow overlap. 

2018-07-16_14_16.43_2.png.69e4439d70ee0da99a4504a0c3d8bb6a.png

I'm using RenderGameOverlayEvent.Pre to render the text. Nothing is changed with GlStateManager before rendering, I'm guessing that my problem is caused by that and that I need to configure some GlStateManager settings, but I'm not finding the correct one. But maybe it's something completely else.

My code for this project can be found in this file on Github.

I hope that someone is able to point me to the problem since I've really tried a lot and so far nothing is making everything fade away like it is supposed to. Thank you guys in advance!

Take a look at GuiIngame#renderSelectedItem(ScaledResolution) lines 694-699

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)

Thanks a lot for your quick reply, but that doesn't really help. I've actually started from the vanilla code. But it's a bit different when working with RenderGameOverlayEvent.Pre since the GlStateManager settings are different. enableBlend() and tryBlendFuncSeparate() are already set the way they should be and pushMatrix or pushMatrix don't have any effect at this point.

So it has to be something else.

Edited by Fusseel
Posted
45 minutes ago, Fusseel said:

Thanks a lot for your quick reply, but that doesn't really help. I've actually started from the vanilla code. But it's a bit different when working with RenderGameOverlayEvent.Pre since the GlStateManager settings are different. enableBlend() and tryBlendFuncSeparate() are already set the way they should be and pushMatrix or pushMatrix don't have any effect at this point.

So it has to be something else.

it seems you need to use RenderGameOverlayEvent.Text to render text. So you may need both RenderGameOverlayEvent.Pre to cancel the item tooltips, and RenderGameOverlayEvent.Text to actually render.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
39 minutes ago, Animefan8888 said:

it seems you need to use RenderGameOverlayEvent.Text to render text. So you may need both RenderGameOverlayEvent.Pre to cancel the item tooltips, and RenderGameOverlayEvent.Text to actually render.

Wow, that's actually it. Thank you so much! Calling RenderGameOverlayEvent.Pre won't be necessary at all then since heldItemTooltips can only be disabled using a vanilla setting.

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.