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/WitherBoss.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'Minecraft.World/WitherBoss.cpp') diff --git a/Minecraft.World/WitherBoss.cpp b/Minecraft.World/WitherBoss.cpp index af406a93..84cf1382 100644 --- a/Minecraft.World/WitherBoss.cpp +++ b/Minecraft.World/WitherBoss.cpp @@ -124,7 +124,7 @@ void WitherBoss::aiStep() if (!level->isClientSide && getAlternativeTarget(0) > 0) { shared_ptr e = level->getEntity(getAlternativeTarget(0)); - if (e != nullptr) + if (e != NULL) { if ((y < e->y) || (!isPowered() && y < (e->y + 5))) { @@ -148,7 +148,7 @@ void WitherBoss::aiStep() } if ((xd * xd + zd * zd) > .05f) { - yRot = static_cast(atan2(zd, xd)) * Mth::RADDEG - 90; + yRot = (float) atan2(zd, xd) * Mth::RADDEG - 90; } Monster::aiStep(); @@ -167,7 +167,7 @@ void WitherBoss::aiStep() { e = level->getEntity(entityId); } - if (e != nullptr) + if (e != NULL) { double hx = getHeadX(i + 1); double hy = getHeadY(i + 1); @@ -178,8 +178,8 @@ void WitherBoss::aiStep() double zd = e->z - hz; double sd = Mth::sqrt(xd * xd + zd * zd); - float yRotD = static_cast(atan2(zd, xd) * 180 / PI) - 90; - float xRotD = static_cast(-(atan2(yd, sd) * 180 / PI)); + float yRotD = (float) (atan2(zd, xd) * 180 / PI) - 90; + float xRotD = (float) -(atan2(yd, sd) * 180 / PI); xRotHeads[i] = rotlerp(xRotHeads[i], xRotD, 40); yRotHeads[i] = rotlerp(yRotHeads[i], yRotD, 10); @@ -221,7 +221,7 @@ void WitherBoss::newServerAiStep() if (newCount <= 0) { level->explode(shared_from_this(), x, y + getHeadHeight(), z, 7, false, level->getGameRules()->getBoolean(GameRules::RULE_MOBGRIEFING)); - level->globalLevelEvent(LevelEvent::SOUND_WITHER_BOSS_SPAWN, static_cast(x), static_cast(y), static_cast(z), 0); + level->globalLevelEvent(LevelEvent::SOUND_WITHER_BOSS_SPAWN, (int) x, (int) y, (int) z, 0); } setInvulnerableTicks(newCount); @@ -258,7 +258,7 @@ void WitherBoss::newServerAiStep() shared_ptr current = level->getEntity(headTarget); // 4J: Added check for instance of living entity, had a problem with IDs being recycled to other entities - if (current == nullptr || !current->instanceof(eTYPE_LIVINGENTITY) || !current->isAlive() || distanceToSqr(current) > 30 * 30 || !canSee(current)) + if (current == NULL || !current->instanceof(eTYPE_LIVINGENTITY) || !current->isAlive() || distanceToSqr(current) > 30 * 30 || !canSee(current)) { setAlternativeTarget(i, 0); } @@ -303,7 +303,7 @@ void WitherBoss::newServerAiStep() } } } - if (getTarget() != nullptr) + if (getTarget() != NULL) { assert(getTarget()->instanceof(eTYPE_LIVINGENTITY)); setAlternativeTarget(0, getTarget()->entityId); @@ -346,7 +346,7 @@ void WitherBoss::newServerAiStep() } if (destroyed) { - level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_DOOR_CRASH, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_ZOMBIE_DOOR_CRASH, (int) x, (int) y, (int) z, 0); } } } @@ -427,7 +427,7 @@ void WitherBoss::performRangedAttack(int head, shared_ptr target) void WitherBoss::performRangedAttack(int head, double tx, double ty, double tz, bool dangerous) { - level->levelEvent(nullptr, LevelEvent::SOUND_WITHER_BOSS_SHOOT, static_cast(x), static_cast(y), static_cast(z), 0); + level->levelEvent(nullptr, LevelEvent::SOUND_WITHER_BOSS_SHOOT, (int) x, (int) y, (int) z, 0); double hx = getHeadX(head); double hy = getHeadY(head); @@ -437,7 +437,7 @@ void WitherBoss::performRangedAttack(int head, double tx, double ty, double tz, double yd = ty - hy; double zd = tz - hz; - shared_ptr ie = std::make_shared(level, dynamic_pointer_cast(shared_from_this()), xd, yd, zd); + shared_ptr ie = shared_ptr( new WitherSkull(level, dynamic_pointer_cast(shared_from_this()), xd, yd, zd) ); if (dangerous) ie->setDangerous(true); ie->y = hy; ie->x = hx; @@ -462,14 +462,14 @@ bool WitherBoss::hurt(DamageSource *source, float dmg) if (isPowered()) { shared_ptr directEntity = source->getDirectEntity(); - if (directEntity != nullptr && directEntity->GetType() == eTYPE_ARROW) + if (directEntity != NULL && directEntity->GetType() == eTYPE_ARROW) { return false; } } shared_ptr sourceEntity = source->getEntity(); - if (sourceEntity != nullptr) + if (sourceEntity != NULL) { if ( sourceEntity->instanceof(eTYPE_PLAYER) ) { -- cgit v1.2.3