neoforged / NeoForge

Neo Modding API for Minecraft, based on Forge
https://projects.neoforged.net/neoforged/neoforge
Other
1.13k stars 165 forks source link

The scroll bar blinks with some resource packs that modify Minecraft GUI textures. #185

Closed Lolothepro closed 10 months ago

Lolothepro commented 10 months ago

Minecraft Version: 1.20.1

NeoForge Version: 47.1.79

Vanilla:

https://github.com/neoforged/NeoForge/assets/68275908/d006a134-430a-46f9-b439-30fe148942ff

Neo:

https://github.com/neoforged/NeoForge/assets/68275908/c76b4311-51b1-4695-9602-cf1780144890

RP: https://modrinth.com/resourcepack/minimal (It blinks at the same moment as the search bar cursor)

XFactHD commented 10 months ago

Forge patches in a call to RenderSystem.enabledBlend() here, supposedly to avoid having a white border around the tabs. After the tabs are drawn, the search bar is rendered if it's enabled for the selected tab. The text rendering of the search box cursor and content explicitly disables blend again, which is why the blinking is in tune with the cursor and vanishes entirely when actual text is entered into the search box. Disabling blend again at the end of CreativeModeInventoryScreen#renderTabImage() fixes this, doing it any earlier does not due to the ItemDecoratorHandler re-enabling it.

It's worth noting that I cannot reproduce the issue this patch is supposed to fix and the patch also causes the selected tab background of the linked RP to render incorrectly, so it might be worth re-evaluating whether this patch is needed and why. Removing the patched-in RenderSystem.enableBlend() call and adding an additional RenderSystem.disableBlend() call at the end of CreativeModeInventoryScreen#renderTabImage() fixes both the blinking scroll bar and the incorrect tab background.

sciwhiz12 commented 10 months ago

It seems the erroring piece of code linked by @XFactHD above was removed in 1.20.2: https://github.com/neoforged/NeoForge/blob/22eb3bd07576bb398955c29eb4a0f3768e74b88e/patches/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch#L254

I'm going to close the issue on that basis, as well as not being able to reproduce the issue on 1.20.2 due to the linked resource pack in the issue description being outdated. If the issue can be reproduced on the latest NeoForge 20.2 with an updated resource pack, please leave a comment mentioning me and I'll reopen the issue.

Lolothepro commented 10 months ago

No...

Lolothepro commented 10 months ago

Can be reproduced in 1.20.2

Lolothepro commented 10 months ago

It seems the erroring piece of code linked by @XFactHD above was removed in 1.20.2:

https://github.com/neoforged/NeoForge/blob/22eb3bd07576bb398955c29eb4a0f3768e74b88e/patches/net/minecraft/client/gui/screens/inventory/CreativeModeInventoryScreen.java.patch#L254

I'm going to close the issue on that basis, as well as not being able to reproduce the issue on 1.20.2 due to the linked resource pack in the issue description being outdated. If the issue can be reproduced on the latest NeoForge 20.2 with an updated resource pack, please leave a comment mentioning me and I'll reopen the issue.

https://github.com/Mojang/slicer

sciwhiz12 commented 10 months ago

Can be reproduced in 1.20.2

Please provide a resource pack that can reproduce the issue.

Lolothepro commented 10 months ago

Can be reproduced in 1.20.2

Please provide a resource pack that can reproduce the issue.

MinimalUI-1.20.2.zip

https://github.com/neoforged/NeoForge/assets/68275908/8b57404b-062e-475e-a6c4-76a989e3f93a

AterAnimAvis commented 10 months ago

CreativeModeInventoryScreen#renderTabButton calls GuiGraphics#renderItemDecorations which we modify to render ItemDecoratorHandlers https://github.com/neoforged/NeoForge/blob/78681badc6611d0d2c7cf7e343abeda2af8b98c8/patches/net/minecraft/client/gui/GuiGraphics.java.patch#L49. That render call calls ItemDecoratorHandler#resetRenderState which modifies the GLState enabling blend, which we never revert/cleanup afterwards.

Lolothepro commented 10 months ago

Note: https://cdn.discordapp.com/attachments/313125603924639766/1169241137068904510/2023-11-01_12-46-23.mp4