Minecraft Consoles latest changes + Better shadow for water in Extra mode

Culling for water need more work in extra graphics mode.
This commit is contained in:
GabsPuNs
2026-04-08 23:47:27 -04:00
parent 23102c65b6
commit 4dfedbffd1
12 changed files with 453 additions and 102 deletions

View File

@@ -28,6 +28,7 @@
#include "../../Minecraft.World/TilePos.h"
#include "../../Minecraft.World/compression.h"
#include "../../Minecraft.World/OldChunkStorage.h"
#include "../../Minecraft.World/ConsoleSaveFileOriginal.h"
#include "../../Minecraft.World/net.minecraft.world.level.tile.h"
#include "../../Minecraft.World/Random.h"
@@ -183,10 +184,10 @@ using ServerRuntime::WorldBootstrapResult;
static bool ParseIntArg(const char *value, int *outValue)
{
if (value == NULL || *value == 0)
if (value == nullptr || *value == 0)
return false;
char *end = NULL;
char *end = nullptr;
long parsed = strtol(value, &end, 10);
if (end == value || *end != 0)
return false;
@@ -197,10 +198,10 @@ static bool ParseIntArg(const char *value, int *outValue)
static bool ParseInt64Arg(const char *value, __int64 *outValue)
{
if (value == NULL || *value == 0)
if (value == nullptr || *value == 0)
return false;
char *end = NULL;
char *end = nullptr;
__int64 parsed = _strtoi64(value, &end, 10);
if (end == value || *end != 0)
return false;
@@ -277,9 +278,9 @@ static bool ParseCommandLine(int argc, char **argv, DedicatedServerConfig *confi
static void SetExeWorkingDirectory()
{
char exePath[MAX_PATH] = {};
GetModuleFileNameA(NULL, exePath, MAX_PATH);
GetModuleFileNameA(nullptr, exePath, MAX_PATH);
char *slash = strrchr(exePath, '\\');
if (slash != NULL)
if (slash != nullptr)
{
*(slash + 1) = 0;
SetCurrentDirectoryA(exePath);
@@ -288,7 +289,7 @@ static void SetExeWorkingDirectory()
static void ApplyServerPropertiesToDedicatedConfig(const ServerPropertiesConfig &serverProperties, DedicatedServerConfig *config)
{
if (config == NULL)
if (config == nullptr)
{
return;
}
@@ -325,6 +326,7 @@ static void TickCoreSystems()
g_NetworkManager.DoWork();
ProfileManager.Tick();
StorageManager.Tick();
ConsoleSaveFileOriginal::flushPendingBackgroundSave();
}
/**
@@ -420,7 +422,7 @@ int main(int argc, char **argv)
#endif
LogStartupStep("registering hidden window class");
HINSTANCE hInstance = GetModuleHandle(NULL);
HINSTANCE hInstance = GetModuleHandle(nullptr);
MyRegisterClass(hInstance);
LogStartupStep("creating hidden window");
@@ -490,7 +492,7 @@ int main(int argc, char **argv)
LogStartupStep("creating Minecraft singleton");
Minecraft::main();
Minecraft *minecraft = Minecraft::GetInstance();
if (minecraft == NULL)
if (minecraft == nullptr)
{
LogError("startup", "Minecraft initialization failed.");
CleanupDevice();
@@ -655,7 +657,7 @@ int main(int argc, char **argv)
break;
}
if (autosaveRequested && app.GetXuiServerAction(kServerActionPad) == eXuiServerAction_Idle)
if (autosaveRequested && app.GetXuiServerAction(kServerActionPad) == eXuiServerAction_Idle && !ConsoleSaveFileOriginal::hasPendingBackgroundSave())
{
LogWorldIO("autosave completed");
autosaveRequested = false;
@@ -669,7 +671,7 @@ int main(int argc, char **argv)
DWORD now = GetTickCount();
if ((LONG)(now - nextAutosaveTick) >= 0)
{
if (app.GetXuiServerAction(kServerActionPad) == eXuiServerAction_Idle)
if (app.GetXuiServerAction(kServerActionPad) == eXuiServerAction_Idle && !ConsoleSaveFileOriginal::hasPendingBackgroundSave())
{
LogWorldIO("requesting autosave");
app.SetXuiServerAction(kServerActionPad, eXuiServerAction_AutoSaveGame);
@@ -685,25 +687,38 @@ int main(int argc, char **argv)
LogInfof("shutdown", "Dedicated server stopped");
MinecraftServer *server = MinecraftServer::getInstance();
if (server != NULL)
if (server != nullptr && !ConsoleSaveFileOriginal::hasPendingBackgroundSave())
{
server->setSaveOnExit(true);
}
if (server != NULL)
{
LogWorldIO("requesting save before shutdown");
LogWorldIO("using saveOnExit for shutdown");
}
if (ConsoleSaveFileOriginal::hasPendingBackgroundSave())
{
LogWorldIO("Waiting for autosave to complete...");
}
MinecraftServer::HaltServer();
if (g_NetworkManager.ServerStoppedValid())
{
C4JThread waitThread(&WaitForServerStoppedThreadProc, NULL, "WaitServerStopped");
C4JThread waitThread(&WaitForServerStoppedThreadProc, nullptr, "WaitServerStopped");
waitThread.Run();
while (waitThread.isRunning())
{
TickCoreSystems();
Sleep(10);
}
waitThread.WaitForCompletion(INFINITE);
}
while (ConsoleSaveFileOriginal::hasPendingBackgroundSave())
{
TickCoreSystems();
Sleep(10);
}
LogInfof("shutdown", "Cleaning up and exiting.");
WinsockNetLayer::Shutdown();
LogDebugf("shutdown", "Network layer shutdown complete.");
@@ -714,5 +729,4 @@ int main(int argc, char **argv)
return 0;
}
}