aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.World/Throwable.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.World/Throwable.cpp')
-rw-r--r--Minecraft.World/Throwable.cpp46
1 files changed, 23 insertions, 23 deletions
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<float>(sqrt(xd * xd + zd * zd));
+ float sd = (float) sqrt(xd * xd + zd * zd);
- yRotO = yRot = static_cast<float>(atan2(xd, zd) * 180 / PI);
- xRotO = xRot = static_cast<float>(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<float>(sqrt(xd * xd + zd * zd));
- yRotO = yRot = static_cast<float>(atan2(xd, zd) * 180 / PI);
- xRotO = xRot = static_cast<float>(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<float>(sqrt(xd * xd + zd * zd));
- yRot = static_cast<float>(atan2(xd, zd) * 180 / PI);
- xRot = static_cast<float>(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<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"shake", static_cast<byte>(shakeTime));
- tag->putByte(L"inGround", static_cast<byte>(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<LivingEntity> Throwable::getOwner()
{
- if (owner == nullptr && !ownerName.empty() )
+ if (owner == NULL && !ownerName.empty() )
{
owner = level->getPlayerByName(ownerName);
}