Project modernization (#630)

* Fixed boats falling and a TP glitch #266

* Replaced every C-style cast with C++ ones

* Replaced every C-style cast with C++ ones

* Fixed boats falling and a TP glitch #266

* Updated NULL to nullptr and fixing some type issues

* Modernized and fixed a few bugs

- Replaced most instances of `NULL` with `nullptr`.
- Replaced most `shared_ptr(new ...)` with `make_shared`.
- Removed the `nullptr` macro as it was interfering with the actual nullptr keyword in some instances.

* Fixing more conflicts

* Replace int loops with size_t and start work on overrides
This commit is contained in:
ModMaker101
2026-03-07 21:56:03 -05:00
committed by GitHub
parent 1be5faaea7
commit a9be52c41a
1373 changed files with 19903 additions and 19449 deletions

View File

@@ -65,7 +65,7 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level *level)
{
if( y >= 3 )
{
((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15);
static_cast<WaterLevelChunk *>(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15);
}
}
}
@@ -77,18 +77,18 @@ MultiPlayerChunkCache::MultiPlayerChunkCache(Level *level)
{
if( y >= ( level->getSeaLevel() - 1 ) )
{
((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15);
static_cast<WaterLevelChunk *>(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,15);
}
else
{
((WaterLevelChunk *)waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,2);
static_cast<WaterLevelChunk *>(waterChunk)->setLevelChunkBrightness(LightLayer::Sky,x,y,z,2);
}
}
}
}
else
{
waterChunk = NULL;
waterChunk = nullptr;
}
this->level = level;
@@ -132,7 +132,7 @@ bool MultiPlayerChunkCache::reallyHasChunk(int x, int z)
int idx = ix * XZSIZE + iz;
LevelChunk *chunk = cache[idx];
if( chunk == NULL )
if( chunk == nullptr )
{
return false;
}
@@ -166,7 +166,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z)
LevelChunk *chunk = cache[idx];
LevelChunk *lastChunk = chunk;
if( chunk == NULL )
if( chunk == nullptr )
{
EnterCriticalSection(&m_csLoadCreate);
@@ -174,7 +174,7 @@ LevelChunk *MultiPlayerChunkCache::create(int x, int z)
if( g_NetworkManager.IsHost() ) // force here to disable sharing of data
{
// 4J-JEV: We are about to use shared data, abort if the server is stopped and the data is deleted.
if (MinecraftServer::getInstance()->serverHalted()) return NULL;
if (MinecraftServer::getInstance()->serverHalted()) return nullptr;
// If we're the host, then don't create the chunk, share data from the server's copy
#ifdef _LARGE_WORLDS
@@ -248,7 +248,7 @@ LevelChunk *MultiPlayerChunkCache::getChunk(int x, int z)
int idx = ix * XZSIZE + iz;
LevelChunk *chunk = cache[idx];
if( chunk == NULL )
if( chunk == nullptr )
{
return emptyChunk;
}
@@ -279,12 +279,12 @@ void MultiPlayerChunkCache::postProcess(ChunkSource *parent, int x, int z)
vector<Biome::MobSpawnerData *> *MultiPlayerChunkCache::getMobsAt(MobCategory *mobCategory, int x, int y, int z)
{
return NULL;
return nullptr;
}
TilePos *MultiPlayerChunkCache::findNearestMapFeature(Level *level, const wstring &featureName, int x, int y, int z)
{
return NULL;
return nullptr;
}
void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX, int chunkZ)
@@ -294,7 +294,7 @@ void MultiPlayerChunkCache::recreateLogicStructuresForChunk(int chunkX, int chun
wstring MultiPlayerChunkCache::gatherStats()
{
EnterCriticalSection(&m_csLoadCreate);
int size = (int)loadedChunkList.size();
int size = static_cast<int>(loadedChunkList.size());
LeaveCriticalSection(&m_csLoadCreate);
return L"MultiplayerChunkCache: " + std::to_wstring(size);