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

@@ -14,7 +14,7 @@ namespace
bool UseStreamInputMode()
{
const char *mode = getenv("SERVER_CLI_INPUT_MODE");
if (mode != NULL)
if (mode != nullptr)
{
return _stricmp(mode, "stream") == 0
|| _stricmp(mode, "stdin") == 0;
@@ -25,7 +25,7 @@ namespace
int WaitForStdinReadable(HANDLE stdinHandle, DWORD waitMs)
{
if (stdinHandle == NULL || stdinHandle == INVALID_HANDLE_VALUE)
if (stdinHandle == nullptr || stdinHandle == INVALID_HANDLE_VALUE)
{
return -1;
}
@@ -34,7 +34,7 @@ namespace
if (fileType == FILE_TYPE_PIPE)
{
DWORD available = 0;
if (!PeekNamedPipe(stdinHandle, NULL, 0, NULL, &available, NULL))
if (!PeekNamedPipe(stdinHandle, nullptr, 0, nullptr, &available, nullptr))
{
return -1;
}
@@ -64,11 +64,11 @@ namespace
namespace ServerRuntime
{
// C-style completion callback bridge requires a static instance pointer.
ServerCliInput *ServerCliInput::s_instance = NULL;
ServerCliInput *ServerCliInput::s_instance = nullptr;
ServerCliInput::ServerCliInput()
: m_running(false)
, m_engine(NULL)
, m_engine(nullptr)
{
}
@@ -79,7 +79,7 @@ namespace ServerRuntime
void ServerCliInput::Start(ServerCliEngine *engine)
{
if (engine == NULL || m_running.exchange(true))
if (engine == nullptr || m_running.exchange(true))
{
return;
}
@@ -107,14 +107,14 @@ namespace ServerRuntime
CancelSynchronousIo((HANDLE)m_inputThread.native_handle());
m_inputThread.join();
}
linenoiseSetCompletionCallback(NULL);
linenoiseSetCompletionCallback(nullptr);
if (s_instance == this)
{
s_instance = NULL;
s_instance = nullptr;
}
m_engine = NULL;
m_engine = nullptr;
LogInfo("console", "CLI input thread stopped.");
}
@@ -143,9 +143,9 @@ namespace ServerRuntime
while (m_running)
{
char *line = linenoise("server> ");
if (line == NULL)
if (line == nullptr)
{
// NULL is expected on stop request (or Ctrl+C inside linenoise).
// nullptr is expected on stop request (or Ctrl+C inside linenoise).
if (!m_running)
{
break;
@@ -166,7 +166,7 @@ namespace ServerRuntime
void ServerCliInput::RunStreamInputLoop()
{
HANDLE stdinHandle = GetStdHandle(STD_INPUT_HANDLE);
if (stdinHandle == NULL || stdinHandle == INVALID_HANDLE_VALUE)
if (stdinHandle == nullptr || stdinHandle == INVALID_HANDLE_VALUE)
{
LogWarn("console", "stream input mode requested but STDIN handle is unavailable; falling back to linenoise.");
RunLinenoiseLoop();
@@ -190,7 +190,7 @@ namespace ServerRuntime
char ch = 0;
DWORD bytesRead = 0;
if (!ReadFile(stdinHandle, &ch, 1, &bytesRead, NULL) || bytesRead == 0)
if (!ReadFile(stdinHandle, &ch, 1, &bytesRead, nullptr) || bytesRead == 0)
{
Sleep(10);
continue;
@@ -249,7 +249,7 @@ namespace ServerRuntime
void ServerCliInput::EnqueueLine(const char *line)
{
if (line == NULL || line[0] == 0 || m_engine == NULL)
if (line == nullptr || line[0] == 0 || m_engine == nullptr)
{
return;
}
@@ -262,7 +262,7 @@ namespace ServerRuntime
void ServerCliInput::CompletionThunk(const char *line, linenoiseCompletions *completions)
{
// Static thunk forwards callback into instance state.
if (s_instance != NULL)
if (s_instance != nullptr)
{
s_instance->BuildCompletions(line, completions);
}
@@ -270,7 +270,7 @@ namespace ServerRuntime
void ServerCliInput::BuildCompletions(const char *line, linenoiseCompletions *completions)
{
if (line == NULL || completions == NULL || m_engine == NULL)
if (line == nullptr || completions == nullptr || m_engine == nullptr)
{
return;
}