aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/Fireball.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.World/Fireball.cpp')
-rw-r--r--Minecraft.World/Fireball.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/Minecraft.World/Fireball.cpp b/Minecraft.World/Fireball.cpp
index 2a538b06..b520f436 100644
--- a/Minecraft.World/Fireball.cpp
+++ b/Minecraft.World/Fireball.cpp
@@ -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;