From 518dd2802981cbd985289cacc89ec9190e6eaa17 Mon Sep 17 00:00:00 2001 From: Fireblade <3+fireblade@noreply.neolegacy.dev> Date: Sun, 2 Aug 2026 19:21:53 -0400 Subject: [PATCH] fix: panorama path bug --- .../Common/UI/UIComponent_Panorama.cpp | 37 ++++++++++++++++++- .../Common/UI/UIComponent_Panorama.h | 1 + 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp b/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp index 8b0f8d09..1aa5b77a 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp @@ -6,6 +6,8 @@ #include "../../../Minecraft.World/net.minecraft.world.level.dimension.h" #include "../../../Minecraft.World/net.minecraft.world.level.storage.h" #include "Tesselator.h" +#include "TexturePackRepository.h" +#include "TexturePack.h" #include "Textures.h" #include "BufferedImage.h" #include "../GameRules/LevelGenerationOptions.h" @@ -197,6 +199,8 @@ static wstring GetPanoramaTexturePath() const char *mountedPanoramaRoots[] = { + "TPACK:/Data/ControlType/Panorama/", + "WPACK:/Data/ControlType/Panorama/", "TPACK:Data/ControlType/Panorama/", "WPACK:Data/ControlType/Panorama/", }; @@ -206,6 +210,16 @@ static wstring GetPanoramaTexturePath() wstring mountedPath = convStringToWstring(StorageManager.GetMountedPath(mountedRoot)); if(mountedPath.empty()) continue; + if(mountedPath.find(L"Data/ControlType/Panorama/") != wstring::npos) + { + // slash check cause for some reason its not always there + size_t pos = mountedPath.find(L"Data/ControlType/Panorama/"); + if(pos != wstring::npos && pos > 0 && mountedPath[pos-1] != L'/' && mountedPath[pos-1] != L'\\') + { + mountedPath.insert(pos, 1, L'/'); + } + } + wstring sampleDay = mountedPath + L"Panorama_S.png"; wstring sampleNight = mountedPath + L"Panorama_N.png"; if(GetFileAttributesW(sampleDay.c_str()) != INVALID_FILE_ATTRIBUTES || @@ -229,6 +243,25 @@ static wstring GetPanoramaTexturePath() return PANORAMA_TEXTURE_RELPATH; } +static wstring GetPanoramaTexturePathKey() +{ + wstring key = GetPanoramaTexturePath(); + + Minecraft *pMinecraft = Minecraft::GetInstance(); + if(pMinecraft != nullptr && pMinecraft->skins != nullptr) + { + TexturePack *selected = pMinecraft->skins->getSelected(); + if(selected != nullptr) + { + wchar_t buffer[32]; + swprintf(buffer, 32, L"|TPACKID=%u", static_cast(selected->getId())); + key += buffer; + } + } + + return key; +} + // opengl time :v static int LoadPanoramaQuadTexture(const wstring &fileName, float blurSigma, int &outWidth, int &outHeight) { @@ -478,7 +511,8 @@ void UIComponent_Panorama::tick() void UIComponent_Panorama::EnsurePanoramaTexturesLoaded() { wstring currentRoot = GetPanoramaTexturePath(); - if(m_bPanoramaTexturesLoaded && currentRoot == m_panoramaTextureRoot) return; + wstring currentRootKey = GetPanoramaTexturePathKey(); + if(m_bPanoramaTexturesLoaded && currentRoot == m_panoramaTextureRoot && currentRootKey == m_panoramaTextureRootKey) return; if(m_texPanoramaDay >= 0) { @@ -492,6 +526,7 @@ void UIComponent_Panorama::EnsurePanoramaTexturesLoaded() } m_panoramaTextureRoot = currentRoot; + m_panoramaTextureRootKey = currentRootKey; m_bPanoramaTexturesLoaded = false; // search for panorama.xml diff --git a/Minecraft.Client/Common/UI/UIComponent_Panorama.h b/Minecraft.Client/Common/UI/UIComponent_Panorama.h index d5465694..d40a528b 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Panorama.h +++ b/Minecraft.Client/Common/UI/UIComponent_Panorama.h @@ -15,6 +15,7 @@ private: bool m_bPanoramaTexturesLoaded = false; wstring m_panoramaTextureRoot; + wstring m_panoramaTextureRootKey; float m_panoramaAspect = 1.0f; DWORD m_lastScrollTickMs = 0; float m_panoramaScroll = 0.0f;