aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/EntityTracker.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-08 19:08:36 -0400
committerGitHub <noreply@github.com>2026-03-08 18:08:36 -0500
commit28614b922fb77149a54da1a87bebfbc98736f296 (patch)
tree7f828ba86a4ee18d0a80d29de64f6199a5412512 /Minecraft.Client/EntityTracker.cpp
parent88798b501d0cf6287b6f87acb2592676e3cec58d (diff)
Modernize project codebase (#906)
* 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 * Add safety checks and fix a issue with vector going OOR
Diffstat (limited to 'Minecraft.Client/EntityTracker.cpp')
-rw-r--r--Minecraft.Client/EntityTracker.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/Minecraft.Client/EntityTracker.cpp b/Minecraft.Client/EntityTracker.cpp
index db175542..087227e7 100644
--- a/Minecraft.Client/EntityTracker.cpp
+++ b/Minecraft.Client/EntityTracker.cpp
@@ -59,7 +59,7 @@ void EntityTracker::addEntity(shared_ptr<Entity> e)
else if (e->instanceof(eTYPE_SQUID)) addEntity(e, 16 * 4, 1, true);
else if (e->instanceof(eTYPE_WITHERBOSS)) addEntity(e, 16 * 5, 1, false);
else if (e->instanceof(eTYPE_BAT)) addEntity(e, 16 * 5, 1, false);
- else if (dynamic_pointer_cast<Creature>(e)!=NULL) addEntity(e, 16 * 5, 1, true);
+ else if (dynamic_pointer_cast<Creature>(e)!=nullptr) addEntity(e, 16 * 5, 1, true);
else if (e->instanceof(eTYPE_ENDERDRAGON)) addEntity(e, 16 * 10, 1, true);
else if (e->instanceof(eTYPE_PRIMEDTNT)) addEntity(e, 16 * 10, 10, true);
else if (e->instanceof(eTYPE_FALLINGTILE)) addEntity(e, 16 * 10, 20, true);
@@ -85,7 +85,7 @@ void EntityTracker::addEntity(shared_ptr<Entity> e, int range, int updateInterva
{
__debugbreak();
}
- shared_ptr<TrackedEntity> te = shared_ptr<TrackedEntity>( new TrackedEntity(e, range, updateInterval, trackDeltas) );
+ shared_ptr<TrackedEntity> te = std::make_shared<TrackedEntity>(e, range, updateInterval, trackDeltas);
entities.insert(te);
entityMap[e->entityId] = te;
te->updatePlayers(this, &level->players);
@@ -145,9 +145,9 @@ void EntityTracker::tick()
shared_ptr<ServerPlayer> ep = server->getPlayers()->players[i];
if( ep->dimension != level->dimension->id ) continue;
- if( ep->connection == NULL ) continue;
+ if( ep->connection == nullptr ) continue;
INetworkPlayer *thisPlayer = ep->connection->getNetworkPlayer();
- if( thisPlayer == NULL ) continue;
+ if( thisPlayer == nullptr ) continue;
bool addPlayer = false;
for (unsigned int j = 0; j < movedPlayers.size(); j++)
@@ -156,9 +156,9 @@ void EntityTracker::tick()
if( sp == ep ) break;
- if(sp->connection == NULL) continue;
+ if(sp->connection == nullptr) continue;
INetworkPlayer *otherPlayer = sp->connection->getNetworkPlayer();
- if( otherPlayer != NULL && thisPlayer->IsSameSystem(otherPlayer) )
+ if( otherPlayer != nullptr && thisPlayer->IsSameSystem(otherPlayer) )
{
addPlayer = true;
break;
@@ -170,7 +170,7 @@ void EntityTracker::tick()
for (unsigned int i = 0; i < movedPlayers.size(); i++)
{
shared_ptr<ServerPlayer> player = movedPlayers[i];
- if(player->connection == NULL) continue;
+ if(player->connection == nullptr) continue;
for( auto& te : entities )
{
if ( te && te->e != player)