From 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a Mon Sep 17 00:00:00 2001 From: Loki Rautio Date: Sat, 7 Mar 2026 21:12:22 -0600 Subject: Revert "Project modernization (#630)" This code was not tested and breaks in Release builds, reverting to restore functionality of the nightly. All in-game menus do not work and generating a world crashes. This reverts commit a9be52c41a02d207233199e98898fe7483d7e817. --- Minecraft.World/Throwable.cpp | 46 +++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'Minecraft.World/Throwable.cpp') diff --git a/Minecraft.World/Throwable.cpp b/Minecraft.World/Throwable.cpp index 08e40aa6..7d30b898 100644 --- a/Minecraft.World/Throwable.cpp +++ b/Minecraft.World/Throwable.cpp @@ -106,10 +106,10 @@ void Throwable::shoot(double xd, double yd, double zd, float pow, float uncertai this->yd = yd; this->zd = zd; - float sd = static_cast(sqrt(xd * xd + zd * zd)); + float sd = (float) sqrt(xd * xd + zd * zd); - yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRotO = xRot = static_cast(atan2(yd, (double)sd) * 180 / PI); + yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); + xRotO = xRot = (float) (atan2(yd, (double)sd) * 180 / PI); life = 0; } @@ -120,9 +120,9 @@ void Throwable::lerpMotion(double xd, double yd, double zd) this->zd = zd; if (xRotO == 0 && yRotO == 0) { - float sd = static_cast(sqrt(xd * xd + zd * zd)); - yRotO = yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRotO = xRot = static_cast(atan2(yd, (double)sd) * 180 / PI); + float sd = (float) sqrt(xd * xd + zd * zd); + yRotO = yRot = (float) (atan2(xd, zd) * 180 / PI); + xRotO = xRot = (float) (atan2(yd, (double)sd) * 180 / PI); } } @@ -166,7 +166,7 @@ void Throwable::tick() from = Vec3::newTemp(x, y, z); to = Vec3::newTemp(x + xd, y + yd, z + zd); - if (res != nullptr) + if (res != NULL) { to = Vec3::newTemp(res->pos->x, res->pos->y, res->pos->z); } @@ -185,7 +185,7 @@ void Throwable::tick() float rr = 0.3f; AABB *bb = e->bb->grow(rr, rr, rr); HitResult *p = bb->clip(from, to); - if (p != nullptr) + if (p != NULL) { double dd = from->distanceTo(p->pos); delete p; @@ -197,14 +197,14 @@ void Throwable::tick() } } - if (hitEntity != nullptr) + if (hitEntity != NULL) { - if(res != nullptr) delete res; + if(res != NULL) delete res; res = new HitResult(hitEntity); } } - if (res != nullptr) + if (res != NULL) { if ( (res->type == HitResult::TILE) && (level->getTile(res->x, res->y, res->z) == Tile::portalTile_Id) ) { @@ -220,9 +220,9 @@ void Throwable::tick() y += yd; z += zd; - float sd = static_cast(sqrt(xd * xd + zd * zd)); - yRot = static_cast(atan2(xd, zd) * 180 / PI); - xRot = static_cast(atan2(yd, (double)sd) * 180 / PI); + float sd = (float) sqrt(xd * xd + zd * zd); + yRot = (float) (atan2(xd, zd) * 180 / PI); + xRot = (float) (atan2(yd, (double)sd) * 180 / PI); while (xRot - xRotO < -180) xRotO -= 360; @@ -267,14 +267,14 @@ float Throwable::getGravity() void Throwable::addAdditonalSaveData(CompoundTag *tag) { - tag->putShort(L"xTile", static_cast(xTile)); - tag->putShort(L"yTile", static_cast(yTile)); - tag->putShort(L"zTile", static_cast(zTile)); - tag->putByte(L"inTile", static_cast(lastTile)); - tag->putByte(L"shake", static_cast(shakeTime)); - tag->putByte(L"inGround", static_cast(inGround ? 1 : 0)); - - if (ownerName.empty() && (owner != nullptr) && owner->instanceof(eTYPE_PLAYER) ) + 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"shake", (byte) shakeTime); + tag->putByte(L"inGround", (byte) (inGround ? 1 : 0)); + + if (ownerName.empty() && (owner != NULL) && owner->instanceof(eTYPE_PLAYER) ) { ownerName = owner->getAName(); } @@ -301,7 +301,7 @@ float Throwable::getShadowHeightOffs() shared_ptr Throwable::getOwner() { - if (owner == nullptr && !ownerName.empty() ) + if (owner == NULL && !ownerName.empty() ) { owner = level->getPlayerByName(ownerName); } -- cgit v1.2.3