aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/EntityTracker.cpp
diff options
context:
space:
mode:
authorModMaker101 <119018978+ModMaker101@users.noreply.github.com>2026-03-07 21:56:03 -0500
committerGitHub <noreply@github.com>2026-03-08 09:56:03 +0700
commita9be52c41a02d207233199e98898fe7483d7e817 (patch)
tree71dfaec3a86b05e9ca409b97d8eb9d7f993bfdd0 /Minecraft.Client/EntityTracker.cpp
parent1be5faaea781402e7de06b263eeca4c688b7712c (diff)
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
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)