aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/WitherBoss.cpp
diff options
context:
space:
mode:
authorLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
committerLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
commit087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch)
tree69454763e73ca764af4e682d3573080b13138a0e /Minecraft.World/WitherBoss.cpp
parenta9be52c41a02d207233199e98898fe7483d7e817 (diff)
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.
Diffstat (limited to 'Minecraft.World/WitherBoss.cpp')
-rw-r--r--Minecraft.World/WitherBoss.cpp26
1 files changed, 13 insertions, 13 deletions
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<Entity> 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<float>(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<float>(atan2(zd, xd) * 180 / PI) - 90;
- float xRotD = static_cast<float>(-(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<int>(x), static_cast<int>(y), static_cast<int>(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<Entity> 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<int>(x), static_cast<int>(y), static_cast<int>(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<LivingEntity> target)
void WitherBoss::performRangedAttack(int head, double tx, double ty, double tz, bool dangerous)
{
- level->levelEvent(nullptr, LevelEvent::SOUND_WITHER_BOSS_SHOOT, static_cast<int>(x), static_cast<int>(y), static_cast<int>(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<WitherSkull> ie = std::make_shared<WitherSkull>(level, dynamic_pointer_cast<LivingEntity>(shared_from_this()), xd, yd, zd);
+ shared_ptr<WitherSkull> ie = shared_ptr<WitherSkull>( new WitherSkull(level, dynamic_pointer_cast<LivingEntity>(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<Entity> directEntity = source->getDirectEntity();
- if (directEntity != nullptr && directEntity->GetType() == eTYPE_ARROW)
+ if (directEntity != NULL && directEntity->GetType() == eTYPE_ARROW)
{
return false;
}
}
shared_ptr<Entity> sourceEntity = source->getEntity();
- if (sourceEntity != nullptr)
+ if (sourceEntity != NULL)
{
if ( sourceEntity->instanceof(eTYPE_PLAYER) )
{