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

@@ -127,10 +127,10 @@ Fireball::Fireball(Level *level, shared_ptr<LivingEntity> mob, double xa, double
void Fireball::tick()
{
// 4J-PB - Moved forward from 1.2.3
//if (!level->isClientSide && (owner == NULL || owner->removed))
//if (!level->isClientSide && (owner == nullptr || owner->removed))
if (!level->isClientSide)
{
if((owner != NULL && owner->removed) || !level->hasChunkAt((int) x, (int) y, (int) z))
if((owner != nullptr && owner->removed) || !level->hasChunkAt(static_cast<int>(x), static_cast<int>(y), static_cast<int>(z)))
{
app.DebugPrintf("Fireball removed - owner is null or removed is true for owner\n");
remove();
@@ -193,7 +193,7 @@ void Fireball::tick()
from = Vec3::newTemp(x, y, z);
to = Vec3::newTemp(x + xd, y + yd, z + zd);
if (res != NULL)
if (res != nullptr)
{
to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z);
}
@@ -207,7 +207,7 @@ void Fireball::tick()
float rr = 0.3f;
AABB *bb = e->bb->grow(rr, rr, rr);
HitResult *p = bb->clip(from, to);
if (p != NULL)
if (p != nullptr)
{
double dd = from->distanceTo(p->pos);
if (dd < nearest || nearest == 0)
@@ -220,14 +220,14 @@ void Fireball::tick()
}
if (hitEntity != NULL)
if (hitEntity != nullptr)
{
delete res;
res = new HitResult(hitEntity);
}
MemSect(0);
if (res != NULL)
if (res != nullptr)
{
onHit(res);
}
@@ -237,8 +237,8 @@ void Fireball::tick()
z += zd;
double sd = sqrt(xd * xd + zd * zd);
yRot = (float) (atan2(zd, xd) * 180 / PI) + 90;
xRot = (float) (atan2(sd, yd) * 180 / PI) - 90;
yRot = static_cast<float>(atan2(zd, xd) * 180 / PI) + 90;
xRot = static_cast<float>(atan2(sd, yd) * 180 / PI) - 90;
while (xRot - xRotO < -180)
xRotO -= 360;
@@ -297,11 +297,11 @@ float Fireball::getInertia()
void Fireball::addAdditonalSaveData(CompoundTag *tag)
{
tag->putShort(L"xTile", (short) xTile);
tag->putShort(L"yTile", (short) yTile);
tag->putShort(L"zTile", (short) zTile);
tag->putByte(L"inTile", (byte) lastTile);
tag->putByte(L"inGround", (byte) (inGround ? 1 : 0));
tag->putShort(L"xTile", static_cast<short>(xTile));
tag->putShort(L"yTile", static_cast<short>(yTile));
tag->putShort(L"zTile", static_cast<short>(zTile));
tag->putByte(L"inTile", static_cast<byte>(lastTile));
tag->putByte(L"inGround", static_cast<byte>(inGround ? 1 : 0));
tag->put(L"direction", newDoubleList(3, xd, yd, zd));
}
@@ -343,10 +343,10 @@ bool Fireball::hurt(DamageSource *source, float damage)
if (isInvulnerable()) return false;
markHurt();
if (source->getEntity() != NULL)
if (source->getEntity() != nullptr)
{
Vec3 *lookAngle = source->getEntity()->getLookAngle();
if (lookAngle != NULL)
if (lookAngle != nullptr)
{
xd = lookAngle->x;
yd = lookAngle->y;