Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix hotbar turning dark in third-person when Project Red is installed #60

Merged
merged 1 commit into from
Apr 24, 2022

Conversation

embeddedt
Copy link
Contributor

This fixes an annoying issue which causes the hotbar to darken when the player switches to third person mode. I believe the root cause is that lighting is re-enabled in RenderWorldLastEvent by MrTJPCore, when the HUD renderer expects it to be disabled. The workaround is to keep lighting disabled, which is what is done here.

Can someone confirm that they see the issue without the fix applied?

Before:

before

After:

after

Offending code in MrTJPCore: https://github.com/MrTJP/MrTJPCore/blob/adbfa1fe6eff596250949ff13ee3195218db3292/src/mrtjp/core/fx/FXEngine.scala#L140-L144

@Glease
Copy link
Contributor

Glease commented Apr 24, 2022

Are you sure it should be kept disabled? NEI's WorldOverlayRenderer is explicitly turning GL_LIGHTING back on as part of its clean up routine in both renderChunkBounds and renderMobSpawnOverlay, which are all called in codechicken.nei.ClientHandler#renderLastEvent, also an event handler for that event you mentioned.

I can see quite a few people just using glPushAttrib (e.g. ae2) and have 0 idea on what is the actual initial state.

@embeddedt
Copy link
Contributor Author

embeddedt commented Apr 24, 2022

There's a good chance that 1.7 should be disabling it again somewhere in vanilla code and isn't. The number of GL bugs in these older Minecraft versions is quite astounding. What I know is that I ran the mod in isolation, without any other mods except dependencies, and the hotbar darkening was happening. As soon I disabled the renderParticles event handler here, the bug went away. That's how I figured out that enabling lighting here was the culprit, or at least appeared to be.

Is injecting glPushAttrib/glPopAttrib calls at the beginning and end of this handler a preferable solution?

@@ -3,6 +3,7 @@ dependencies {
compile("com.github.GTNewHorizons:StructureLib:1.0.15:dev")
compile("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
compile("com.github.GTNewHorizons:AppleCore:3.1.9:dev")
compile("com.github.GTNewHorizons:ProjectRed:master-SNAPSHOT:dev")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you really need to pull ProjectRed? Wouldn't compile("mrtjp:MrTJPCore:1.7.10-1.1.0.33:dev" suffice?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No snapshot Masters. Pick a tag like glow said

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed by using MrTJPCore as glow suggested. Regarding the snapshot issue, I used this gradle script as a reference so I don't know if that needs updating.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

basically, by using snaptshots from master, you compile with the latest code availiable on master. That sounds interesting when you don't want to update the deps in the build script often, but it's actually a bad idea, as your builds become unreproductible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We haven't updated all repos, the one you linked is indeed out of date.

Copy link
Contributor

@mitchej123 mitchej123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tag all deps

Copy link
Contributor

@mitchej123 mitchej123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable

@Dream-Master Dream-Master merged commit 37bbb9a into GTNewHorizons:master Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants