From 3ebed84cdbe619817580dc433176d07431867a70 Mon Sep 17 00:00:00 2001 From: Kolyah35 Date: Thu, 2 Jul 2026 16:32:17 +0300 Subject: [PATCH] FIX: crash while joining to large world server --- src/client/Minecraft.cpp | 1 + src/network/ClientSideNetworkHandler.cpp | 2 +- src/world/level/chunk/LevelChunk.cpp | 2 +- src/world/level/chunk/LevelChunk.h | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/client/Minecraft.cpp b/src/client/Minecraft.cpp index bb2f579..4e1a1ad 100755 --- a/src/client/Minecraft.cpp +++ b/src/client/Minecraft.cpp @@ -1137,6 +1137,7 @@ bool Minecraft::supportNonTouchScreen() { } void Minecraft::init() { + LevelChunk::ChunkBlockCount = LevelConstants::CHUNK_BLOCK_COUNT; #ifndef STANDALONE_SERVER checkGlError("Init enter"); diff --git a/src/network/ClientSideNetworkHandler.cpp b/src/network/ClientSideNetworkHandler.cpp index 493ddfe..4b384de 100755 --- a/src/network/ClientSideNetworkHandler.cpp +++ b/src/network/ClientSideNetworkHandler.cpp @@ -178,7 +178,7 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, StartGam LevelConstants::CHUNK_CACHE_WIDTH = packet->chunkCacheWidth; LevelConstants::LEVEL_WIDTH = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_WIDTH; LevelConstants::LEVEL_DEPTH = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_DEPTH; - + LevelChunk::ChunkBlockCount = LevelConstants::CHUNK_BLOCK_COUNT; } NumRequestChunks = LevelConstants::CHUNK_CACHE_WIDTH * LevelConstants::CHUNK_CACHE_WIDTH; requestNextChunkIndexList.resize(NumRequestChunks); diff --git a/src/world/level/chunk/LevelChunk.cpp b/src/world/level/chunk/LevelChunk.cpp index 5cf3ae6..499a7ae 100755 --- a/src/world/level/chunk/LevelChunk.cpp +++ b/src/world/level/chunk/LevelChunk.cpp @@ -12,7 +12,7 @@ /*static*/ bool LevelChunk::touchedSky = false; -const int LevelChunk::ChunkBlockCount = LevelConstants::CHUNK_BLOCK_COUNT; +int LevelChunk::ChunkBlockCount; LevelChunk::LevelChunk( Level* level, int x, int z ) : level(level), diff --git a/src/world/level/chunk/LevelChunk.h b/src/world/level/chunk/LevelChunk.h index b88cb7a..8fe7281 100755 --- a/src/world/level/chunk/LevelChunk.h +++ b/src/world/level/chunk/LevelChunk.h @@ -106,7 +106,7 @@ private: void recalcHeight(int x, int yStart, int z); public: static bool touchedSky; - static const int ChunkBlockCount; + static int ChunkBlockCount; const int ChunkSize = ChunkBlockCount; static const int UpdateMapBitShift = 4; // power of (LevelConstants::LEVEL_HEIGHT / 8) == 16