From be3ccae7c11ab2d79317115a7bf5f308eb17490c Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Mon, 23 Sep 2024 18:52:15 -0400 Subject: [PATCH] Hide Block Outline When GUI Is Hidden --- docs/CHANGELOG.md | 1 + launcher/src/client/available-feature-flags | 3 ++- mods/src/misc/graphics.cpp | 9 +++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 8403bb6ef2..d2fa489f5a 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -43,6 +43,7 @@ * `Allow High-Resolution Title` (Enabled By Default) * `Improved Classic Title Positioning` (Enabled By Default) * `Use Updated Title` (Enabled By Default) + * `Hide Block Outline When GUI Is Hidden` (Enabled By Default) * Existing Functionality (All Enabled By Default) * `Fix Screen Rendering When Hiding HUD` * `Sanitize Usernames` diff --git a/launcher/src/client/available-feature-flags b/launcher/src/client/available-feature-flags index 2fb56a46f2..8e5c0db08e 100644 --- a/launcher/src/client/available-feature-flags +++ b/launcher/src/client/available-feature-flags @@ -105,4 +105,5 @@ TRUE Fix Camera Functionality TRUE Property Scale Animated Textures TRUE Allow High-Resolution Title TRUE Improved Classic Title Positioning -TRUE Use Updated Title \ No newline at end of file +TRUE Use Updated Title +TRUE Hide Block Outline When GUI Is Hidden \ No newline at end of file diff --git a/mods/src/misc/graphics.cpp b/mods/src/misc/graphics.cpp index 50b8e2d00e..918810b0d2 100644 --- a/mods/src/misc/graphics.cpp +++ b/mods/src/misc/graphics.cpp @@ -288,6 +288,15 @@ void _init_misc_graphics() { overwrite_call((void *) 0x4d764, (void *) LevelRenderer_render_AABB_glColor4f_injection); } + // Properly Hide Block Outline + if (feature_has("Hide Block Outline When GUI Is Hidden", server_disabled)) { + overwrite_calls(LevelRenderer_renderHitSelect, [](LevelRenderer_renderHitSelect_t original, LevelRenderer *self, Player *player, const HitResult &hit_result, const int i, void *vp, const float f) { + if (!self->minecraft->options.hide_gui) { + original(self, player, hit_result, i, vp, f); + } + }); + } + // Java Light Ramp if (feature_has("Use Java Beta 1.3 Light Ramp", server_disabled)) { overwrite_calls(Dimension_updateLightRamp, Dimension_updateLightRamp_injection);