eeee it doesnt work 😭

This commit is contained in:
2026-04-27 22:18:18 +02:00
parent 4023d70687
commit 0645905fc6
7 changed files with 60 additions and 40 deletions

View File

@@ -12,6 +12,7 @@
#include "../client/Minecraft.h"
#include "../client/gamemode/GameMode.h"
#include "world/item/ItemInstance.h"
#include "world/level/LevelConstants.h"
#ifndef STANDALONE_SERVER
#include "../client/gui/screens/DisconnectionScreen.h"
#endif
@@ -99,6 +100,10 @@ void ClientSideNetworkHandler::onUnableToConnect()
void ClientSideNetworkHandler::onDisconnect(const RakNet::RakNetGUID& guid)
{
CHUNK_CACHE_WIDTH = 16;
LEVEL_WIDTH = CHUNK_CACHE_WIDTH * CHUNK_WIDTH;
LEVEL_DEPTH = CHUNK_CACHE_WIDTH * CHUNK_DEPTH;
// TODO: Good disconnecting
LOGI("onDisconnect\n");
if (level)
@@ -155,6 +160,19 @@ void ClientSideNetworkHandler::handle(const RakNet::RakNetGUID& source, StartGam
}
#endif
// @todo @note i think its trash
// we can put it directly to selectLevel?
if (packet->chunkCacheWidth != 0) {
printf("lol \n");
CHUNK_CACHE_WIDTH = packet->chunkCacheWidth;
LEVEL_WIDTH = CHUNK_CACHE_WIDTH * CHUNK_WIDTH;
LEVEL_DEPTH = CHUNK_CACHE_WIDTH * CHUNK_DEPTH;
}
NumRequestChunks = CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH;
requestNextChunkIndexList.resize(NumRequestChunks);
chunksLoaded.resize(NumRequestChunks);
const std::string& levelId = LevelStorageSource::TempLevelId;
LevelStorageSource* storageSource = minecraft->getLevelSource();
storageSource->deleteLevel(levelId);
@@ -696,7 +714,7 @@ void ClientSideNetworkHandler::arrangeRequestChunkOrder() {
}
_ChunkSorter sorter(cx, cz);
std::sort(requestNextChunkIndexList, requestNextChunkIndexList + NumRequestChunks, sorter);
std::sort(requestNextChunkIndexList.begin(), requestNextChunkIndexList.end(), sorter);
}
void ClientSideNetworkHandler::levelGenerated(Level* level)