From 9481c9aa8be5663d60e80662c953977a604de320 Mon Sep 17 00:00:00 2001 From: Zasus Date: Sun, 1 Mar 2026 17:08:31 +0000 Subject: [PATCH 1/5] remove 4j source control warning when opening the solution --- MinecraftConsoles.sln | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/MinecraftConsoles.sln b/MinecraftConsoles.sln index 4d3b37f2..59897afe 100644 --- a/MinecraftConsoles.sln +++ b/MinecraftConsoles.sln @@ -9,18 +9,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Minecraft.Client", "Minecra EndProjectSection EndProject Global - GlobalSection(TeamFoundationVersionControl) = preSolution - SccNumberOfProjects = 3 - SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C} - SccTeamFoundationServer = https://tfs4jstudios.visualstudio.com/defaultcollection - SccLocalPath0 = . - SccProjectUniqueName1 = Minecraft.World\\Minecraft.World.vcxproj - SccProjectName1 = Minecraft.World - SccLocalPath1 = Minecraft.World - SccProjectUniqueName2 = Minecraft.Client\\Minecraft.Client.vcxproj - SccProjectName2 = Minecraft.Client - SccLocalPath2 = Minecraft.Client - EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution ContentPackage_NO_TU|Durango = ContentPackage_NO_TU|Durango ContentPackage_NO_TU|ORBIS = ContentPackage_NO_TU|ORBIS From fa254306949eec458cdff71c3867ded0e7494d2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=CE=9EV=CE=9BR?= Date: Sun, 1 Mar 2026 18:19:38 +0100 Subject: [PATCH 2/5] Fix for exe not running, not founding the project directory In _tWinMain (Windows64_Minecraft.cpp) add logic to detect if the executable path contains "\\x64\\". If found, truncate the path at that position, append "\\Minecraft.Client" and call SetCurrentDirectoryA to set the process working directory. This ensures relative resource paths resolve correctly when running from an x64 build output directory; the change is guarded by a substring check and uses MAX_PATH-safe APIs. --- Minecraft.Client/Windows64/Windows64_Minecraft.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 931e7f17..50791c02 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -716,6 +716,16 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); + + char exePath[MAX_PATH]; + GetModuleFileNameA(NULL, exePath, MAX_PATH); + char* x64_pos = strstr(exePath, "\\x64\\"); + if (x64_pos) { + *x64_pos = 0; + strcat_s(exePath, MAX_PATH, "\\Minecraft.Client"); + SetCurrentDirectoryA(exePath); + } + // Declare DPI awareness so GetSystemMetrics returns physical pixels SetProcessDPIAware(); g_iScreenWidth = GetSystemMetrics(SM_CXSCREEN); From 6cba5705dd24a3266cbfc729af0a96b06234fc34 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Mon, 2 Mar 2026 01:21:56 +0800 Subject: [PATCH 3/5] fix: fix sprinting --- Minecraft.Client/Input.cpp | 17 ++++++++++++----- Minecraft.Client/Input.h | 4 +++- Minecraft.Client/LocalPlayer.cpp | 24 ++++++++++++++++++------ 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/Minecraft.Client/Input.cpp b/Minecraft.Client/Input.cpp index 7fce9360..c1a3bb31 100644 --- a/Minecraft.Client/Input.cpp +++ b/Minecraft.Client/Input.cpp @@ -12,9 +12,11 @@ Input::Input() { xa = 0; ya = 0; + sprintForward = 0; wasJumping = false; jumping = false; sneaking = false; + usingKeyboardMovement = false; lReset = false; rReset = false; @@ -40,16 +42,18 @@ void Input::tick(LocalPlayer *player) ya = InputManager.GetJoypadStick_LY(iPad); else ya = 0.0f; + sprintForward = ya; + usingKeyboardMovement = false; #ifdef _WINDOWS64 // WASD movement (combine with gamepad) if (iPad == 0) { float kbX = 0.0f, kbY = 0.0f; - if (KMInput.IsKeyDown('W')) kbY += 1.0f; - if (KMInput.IsKeyDown('S')) kbY -= 1.0f; - if (KMInput.IsKeyDown('A')) kbX += 1.0f; // inverted like gamepad - if (KMInput.IsKeyDown('D')) kbX -= 1.0f; + if (KMInput.IsKeyDown('W')) { kbY += 1.0f; sprintForward += 1.0f; usingKeyboardMovement = true; } + if (KMInput.IsKeyDown('S')) { kbY -= 1.0f; sprintForward -= 1.0f; usingKeyboardMovement = true; } + if (KMInput.IsKeyDown('A')) { kbX += 1.0f; usingKeyboardMovement = true; } // inverted like gamepad + if (KMInput.IsKeyDown('D')) { kbX -= 1.0f; usingKeyboardMovement = true; } // Normalize diagonal if (kbX != 0.0f && kbY != 0.0f) { kbX *= 0.707f; kbY *= 0.707f; } if (pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_LEFT) || pMinecraft->localgameModes[iPad]->isInputAllowed(MINECRAFT_ACTION_RIGHT)) @@ -58,11 +62,13 @@ void Input::tick(LocalPlayer *player) ya = max(min(ya + kbY, 1.0f), -1.0f); } #endif + sprintForward = max(min(sprintForward, 1.0f), -1.0f); #ifndef _CONTENT_PACKAGE if (app.GetFreezePlayers()) { xa = ya = 0.0f; + sprintForward = 0.0f; player->abilities.flying = true; } #endif @@ -74,6 +80,7 @@ void Input::tick(LocalPlayer *player) lReset = true; } xa = ya = 0.0f; + sprintForward = 0.0f; } // 4J - in flying mode, don't actually toggle sneaking @@ -168,4 +175,4 @@ void Input::tick(LocalPlayer *player) #endif //OutputDebugString("INPUT: End input tick\n"); -} \ No newline at end of file +} diff --git a/Minecraft.Client/Input.h b/Minecraft.Client/Input.h index ef1dcd0c..d8dedd57 100644 --- a/Minecraft.Client/Input.h +++ b/Minecraft.Client/Input.h @@ -6,10 +6,12 @@ class Input public: float xa; float ya; + float sprintForward; bool wasJumping; bool jumping; bool sneaking; + bool usingKeyboardMovement; Input(); // 4J - added @@ -20,4 +22,4 @@ private: bool lReset; bool rReset; bool m_gamepadSneaking; -}; \ No newline at end of file +}; diff --git a/Minecraft.Client/LocalPlayer.cpp b/Minecraft.Client/LocalPlayer.cpp index aabd6a2b..ed286cd9 100644 --- a/Minecraft.Client/LocalPlayer.cpp +++ b/Minecraft.Client/LocalPlayer.cpp @@ -274,11 +274,13 @@ void LocalPlayer::aiStep() if (changingDimensionDelay > 0) changingDimensionDelay--; bool wasJumping = input->jumping; float runTreshold = 0.8f; + float sprintForward = input->sprintForward; - bool wasRunning = input->ya >= runTreshold; + bool wasRunning = sprintForward >= runTreshold; //input->tick( dynamic_pointer_cast( shared_from_this() ) ); // 4J-PB - make it a localplayer input->tick( this ); + sprintForward = input->sprintForward; if (isUsingItem()) { input->xa *= 0.2f; @@ -302,9 +304,20 @@ void LocalPlayer::aiStep() // world with low food, then reload it in creative. if(abilities.mayfly || isAllowedToFly() ) enoughFoodToSprint = true; + bool forwardEnoughToTriggerSprint = sprintForward >= runTreshold; + bool forwardReturnedToDeadzone = sprintForward == 0.0f; + bool forwardEnoughToContinueSprint = sprintForward >= runTreshold; + +#ifdef _WINDOWS64 + if (GetXboxPad() == 0 && input->usingKeyboardMovement) + { + forwardEnoughToContinueSprint = sprintForward > 0.0f; + } +#endif + #ifdef _WINDOWS64 // Keyboard sprint: Ctrl held while moving forward - if (GetXboxPad() == 0 && KMInput.IsKeyDown(VK_CONTROL) && input->ya > 0.0f && + if (GetXboxPad() == 0 && input->usingKeyboardMovement && KMInput.IsKeyDown(VK_CONTROL) && sprintForward > 0.0f && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness) && onGround) { if (!isSprinting()) setSprinting(true); @@ -314,7 +327,7 @@ void LocalPlayer::aiStep() // 4J - altered this slightly to make sure that the joypad returns to below returnTreshold in between registering two movements up to runThreshold if (onGround && !isSprinting() && enoughFoodToSprint && !isUsingItem() && !hasEffect(MobEffect::blindness)) { - if( !wasRunning && input->ya >= runTreshold ) + if( !wasRunning && forwardEnoughToTriggerSprint ) { if (sprintTriggerTime == 0) { @@ -331,7 +344,7 @@ void LocalPlayer::aiStep() } } } - else if( ( sprintTriggerTime > 0 ) && ( input->ya == 0.0f ) ) // ya of 0.0f here signifies that we have returned to the deadzone + else if( ( sprintTriggerTime > 0 ) && forwardReturnedToDeadzone ) // zero sprintForward here signifies that we have returned to the deadzone { sprintTriggerRegisteredReturn = true; } @@ -339,7 +352,7 @@ void LocalPlayer::aiStep() if (isSneaking()) sprintTriggerTime = 0; // 4J-PB - try not stopping sprint on collision //if (isSprinting() && (input->ya < runTreshold || horizontalCollision || !enoughFoodToSprint)) - if (isSprinting() && (input->ya < runTreshold || !enoughFoodToSprint)) + if (isSprinting() && (!forwardEnoughToContinueSprint || !enoughFoodToSprint || isSneaking() || isUsingItem())) { setSprinting(false); } @@ -1622,4 +1635,3 @@ void LocalPlayer::SetPlayerAdditionalModelParts(vectorpAdditionalMo { m_pAdditionalModelParts=pAdditionalModelParts; } - From 31e993d6eeb3e93f47617224e4ee6f015ca58913 Mon Sep 17 00:00:00 2001 From: rtm516 Date: Sun, 1 Mar 2026 17:29:59 +0000 Subject: [PATCH 4/5] Fix game exit --- Minecraft.Client/Common/UI/UIScene_MainMenu.cpp | 4 ++-- Minecraft.Client/Windows64/Windows64_App.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp index 7724aaaf..c909fbc6 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp @@ -334,7 +334,6 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) m_eAction=eAction_RunUnlockOrDLC; signInReturnedFunc = &UIScene_MainMenu::UnlockFullGame_SignInReturned; break; -#if defined _XBOX case eControl_Exit: if( ProfileManager.IsFullVersion() ) { @@ -345,13 +344,14 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) } else { +#ifdef _XBOX #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif ui.NavigateToScene(primaryPad,eUIScene_TrialExitUpsell); +#endif } break; -#endif #ifdef _DURANGO case eControl_XboxHelp: diff --git a/Minecraft.Client/Windows64/Windows64_App.cpp b/Minecraft.Client/Windows64/Windows64_App.cpp index ef9f6cf6..a8b2d9cc 100644 --- a/Minecraft.Client/Windows64/Windows64_App.cpp +++ b/Minecraft.Client/Windows64/Windows64_App.cpp @@ -26,6 +26,8 @@ void CConsoleMinecraftApp::StoreLaunchData() } void CConsoleMinecraftApp::ExitGame() { + // This is likely not the correct way to exit the game, but it will do for now + ExitProcess(0); } void CConsoleMinecraftApp::FatalLoadError() { From e23945a020f6483202e21df360f615b1ea55b119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?N=CE=9EV=CE=9BR?= Date: Sun, 1 Mar 2026 18:40:09 +0100 Subject: [PATCH 5/5] Fixed performance issue thx to @void2012 --- .../Windows64/Windows64_Minecraft.cpp | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp index 50791c02..42fb2d44 100644 --- a/Minecraft.Client/Windows64/Windows64_Minecraft.cpp +++ b/Minecraft.Client/Windows64/Windows64_Minecraft.cpp @@ -717,13 +717,23 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, UNREFERENCED_PARAMETER(lpCmdLine); - char exePath[MAX_PATH]; - GetModuleFileNameA(NULL, exePath, MAX_PATH); - char* x64_pos = strstr(exePath, "\\x64\\"); - if (x64_pos) { - *x64_pos = 0; - strcat_s(exePath, MAX_PATH, "\\Minecraft.Client"); - SetCurrentDirectoryA(exePath); + WCHAR exePath[MAX_PATH] = { 0 }; + GetModuleFileNameW(NULL, exePath, MAX_PATH); + WCHAR* lastSlash = wcsrchr(exePath, L'\\'); + if (lastSlash) { + *lastSlash = L'\0'; + + WCHAR devCheckPath[MAX_PATH] = { 0 }; + swprintf_s(devCheckPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client\\Minecraft.Client.vcxproj", exePath); + + if (GetFileAttributesW(devCheckPath) != INVALID_FILE_ATTRIBUTES) { + WCHAR projectPath[MAX_PATH] = { 0 }; + swprintf_s(projectPath, MAX_PATH, L"%s\\..\\..\\Minecraft.Client", exePath); + SetCurrentDirectoryW(projectPath); + } + else { + SetCurrentDirectoryW(exePath); + } } // Declare DPI awareness so GetSystemMetrics returns physical pixels