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/Bat.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'Minecraft.World/Bat.cpp') diff --git a/Minecraft.World/Bat.cpp b/Minecraft.World/Bat.cpp index 462fef57..d3bd3521 100644 --- a/Minecraft.World/Bat.cpp +++ b/Minecraft.World/Bat.cpp @@ -15,7 +15,7 @@ Bat::Bat(Level *level) : AmbientCreature(level) registerAttributes(); setHealth(getMaxHealth()); - targetPosition = nullptr; + targetPosition = NULL; setSize(.5f, .9f); setResting(true); @@ -90,11 +90,11 @@ void Bat::setResting(bool value) char current = entityData->getByte(DATA_ID_FLAGS); if (value) { - entityData->set(DATA_ID_FLAGS, static_cast(current | FLAG_RESTING)); + entityData->set(DATA_ID_FLAGS, (char) (current | FLAG_RESTING)); } else { - entityData->set(DATA_ID_FLAGS, static_cast(current & ~FLAG_RESTING)); + entityData->set(DATA_ID_FLAGS, (char) (current & ~FLAG_RESTING)); } } @@ -128,10 +128,10 @@ void Bat::newServerAiStep() if (isResting()) { - if (!level->isSolidBlockingTile(Mth::floor(x), static_cast(y) + 1, Mth::floor(z))) + if (!level->isSolidBlockingTile(Mth::floor(x), (int) y + 1, Mth::floor(z))) { setResting(false); - level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, (int) x, (int) y, (int) z, 0); } else { @@ -141,25 +141,25 @@ void Bat::newServerAiStep() yHeadRot = random->nextInt(360); } - if (level->getNearestPlayer(shared_from_this(), 4.0f) != nullptr) + if (level->getNearestPlayer(shared_from_this(), 4.0f) != NULL) { setResting(false); - level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_BAT_LIFTOFF, (int) x, (int) y, (int) z, 0); } } } else { - if (targetPosition != nullptr && (!level->isEmptyTile(targetPosition->x, targetPosition->y, targetPosition->z) || targetPosition->y < 1)) + if (targetPosition != NULL && (!level->isEmptyTile(targetPosition->x, targetPosition->y, targetPosition->z) || targetPosition->y < 1)) { delete targetPosition; - targetPosition = nullptr; + targetPosition = NULL; } - if (targetPosition == nullptr || random->nextInt(30) == 0 || targetPosition->distSqr(static_cast(x), static_cast(y), static_cast(z)) < 4) + if (targetPosition == NULL || random->nextInt(30) == 0 || targetPosition->distSqr((int) x, (int) y, (int) z) < 4) { delete targetPosition; - targetPosition = new Pos(static_cast(x) + random->nextInt(7) - random->nextInt(7), static_cast(y) + random->nextInt(6) - 2, static_cast(z) + random->nextInt(7) - random->nextInt(7)); + targetPosition = new Pos((int) x + random->nextInt(7) - random->nextInt(7), (int) y + random->nextInt(6) - 2, (int) z + random->nextInt(7) - random->nextInt(7)); } double dx = (targetPosition->x + .5) - x; @@ -170,12 +170,12 @@ void Bat::newServerAiStep() yd = yd + (signum(dy) * .7f - yd) * .1f; zd = zd + (signum(dz) * .5f - zd) * .1f; - float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; + float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90; float rotDiff = Mth::wrapDegrees(yRotD - yRot); yya = .5f; yRot += rotDiff; - if (random->nextInt(100) == 0 && level->isSolidBlockingTile(Mth::floor(x), static_cast(y) + 1, Mth::floor(z))) + if (random->nextInt(100) == 0 && level->isSolidBlockingTile(Mth::floor(x), (int) y + 1, Mth::floor(z))) { setResting(true); } -- cgit v1.2.3