[1.20.4] Fix GUI far plane calculation to match vanilla #507
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the screen-layer-aware GUI far plane calculation to fully match the vanilla GUI far plane again and adjusts the layer rendering the actually make use of the increased per-layer depth.
This fixes the VanillaTweaks "No Spyglass Overlay" resource pack not working on NeoForge.
It is worth noting though that, while it fixes this RP in an almost-vanilla environment (i.e. only NeoForge installed), there's no guarantee that it will work when other mods are involved as they can trivially insert a custom HUD component under the spy glass overlay and offset its depth such that the shader's detection doesn't work anymore or even breaks other HUD components. There is nothing NeoForge can do about this other than entirely removing a very valuable feature, which is not a viable solution, especially considering mods can achieve the RP's effect in a trivial and clean way as well.
The test mod used to test screen layering was also adjusted to match how screens are now supposed to be drawn and was used to test that layering to absurd levels still works fine.
Fixes #445