aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/MoveIndoorsGoal.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.World/MoveIndoorsGoal.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.World/MoveIndoorsGoal.cpp')
-rw-r--r--Minecraft.World/MoveIndoorsGoal.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Minecraft.World/MoveIndoorsGoal.cpp b/Minecraft.World/MoveIndoorsGoal.cpp
index 395fe578..f329a6bb 100644
--- a/Minecraft.World/MoveIndoorsGoal.cpp
+++ b/Minecraft.World/MoveIndoorsGoal.cpp
@@ -22,10 +22,10 @@ bool MoveIndoorsGoal::canUse()
if (mob->getRandom()->nextInt(50) != 0) return false;
if (insideX != -1 && mob->distanceToSqr(insideX, mob->y, insideZ) < 2 * 2) return false;
shared_ptr<Village> village = mob->level->villages->getClosestVillage(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z), 14);
- if (village == NULL) return false;
+ if (village == nullptr) return false;
shared_ptr<DoorInfo> _doorInfo = village->getBestDoorInfo(Mth::floor(mob->x), Mth::floor(mob->y), Mth::floor(mob->z));
doorInfo = _doorInfo;
- return _doorInfo != NULL;
+ return _doorInfo != nullptr;
}
bool MoveIndoorsGoal::canContinueToUse()
@@ -37,7 +37,7 @@ void MoveIndoorsGoal::start()
{
insideX = -1;
shared_ptr<DoorInfo> _doorInfo = doorInfo.lock();
- if( _doorInfo == NULL )
+ if( _doorInfo == nullptr )
{
doorInfo = weak_ptr<DoorInfo>();
return;
@@ -45,7 +45,7 @@ void MoveIndoorsGoal::start()
if (mob->distanceToSqr(_doorInfo->getIndoorX(), _doorInfo->y, _doorInfo->getIndoorZ()) > 16 * 16)
{
Vec3 *pos = RandomPos::getPosTowards(dynamic_pointer_cast<PathfinderMob>(mob->shared_from_this()), 14, 3, Vec3::newTemp(_doorInfo->getIndoorX() + 0.5, _doorInfo->getIndoorY(), _doorInfo->getIndoorZ() + 0.5));
- if (pos != NULL) mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, 1.0f);
+ if (pos != nullptr) mob->getNavigation()->moveTo(pos->x, pos->y, pos->z, 1.0f);
}
else mob->getNavigation()->moveTo(_doorInfo->getIndoorX() + 0.5, _doorInfo->getIndoorY(), _doorInfo->getIndoorZ() + 0.5, 1.0f);
}
@@ -53,7 +53,7 @@ void MoveIndoorsGoal::start()
void MoveIndoorsGoal::stop()
{
shared_ptr<DoorInfo> _doorInfo = doorInfo.lock();
- if( _doorInfo == NULL )
+ if( _doorInfo == nullptr )
{
doorInfo = weak_ptr<DoorInfo>();
return;