diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-09 10:50:38 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-09 10:50:38 +0200 |
commit | 372dbbb994a1414369fe38367d458a0c32866a79 (patch) | |
tree | 5cd564fbb0c4b7c0b47f3cb64594c34f9361f1dc /src/WorldStorage/NBTChunkSerializer.cpp | |
parent | Updated generator prefabs to current Gallery contents. (diff) | |
parent | Added extra space before comments (diff) | |
download | cuberite-372dbbb994a1414369fe38367d458a0c32866a79.tar cuberite-372dbbb994a1414369fe38367d458a0c32866a79.tar.gz cuberite-372dbbb994a1414369fe38367d458a0c32866a79.tar.bz2 cuberite-372dbbb994a1414369fe38367d458a0c32866a79.tar.lz cuberite-372dbbb994a1414369fe38367d458a0c32866a79.tar.xz cuberite-372dbbb994a1414369fe38367d458a0c32866a79.tar.zst cuberite-372dbbb994a1414369fe38367d458a0c32866a79.zip |
Diffstat (limited to 'src/WorldStorage/NBTChunkSerializer.cpp')
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index bff515386..317ace795 100644 --- a/src/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp @@ -589,20 +589,19 @@ void cNBTChunkSerializer::AddProjectileEntity(cProjectileEntity * a_Projectile) m_Writer.BeginCompound(""); AddBasicEntity(a_Projectile, a_Projectile->GetMCAClassName()); Vector3d Pos = a_Projectile->GetPosition(); - m_Writer.AddShort("xTile", (Int16)floor(Pos.x)); - m_Writer.AddShort("yTile", (Int16)floor(Pos.y)); - m_Writer.AddShort("zTile", (Int16)floor(Pos.z)); - m_Writer.AddShort("inTile", 0); // TODO: Query the block type - m_Writer.AddShort("shake", 0); // TODO: Any shake? - m_Writer.AddByte ("inGround", a_Projectile->IsInGround() ? 1 : 0); + m_Writer.AddByte("inGround", a_Projectile->IsInGround() ? 1 : 0); switch (a_Projectile->GetProjectileKind()) { case cProjectileEntity::pkArrow: { - m_Writer.AddByte("inData", 0); // TODO: Query the block meta (is it needed?) - m_Writer.AddByte("pickup", ((cArrowEntity *)a_Projectile)->GetPickupState()); - m_Writer.AddDouble("damage", ((cArrowEntity *)a_Projectile)->GetDamageCoeff()); + cArrowEntity * Arrow = (cArrowEntity *)a_Projectile; + + m_Writer.AddInt("xTile", (Int16)Arrow->GetBlockHit().x); + m_Writer.AddInt("yTile", (Int16)Arrow->GetBlockHit().y); + m_Writer.AddInt("zTile", (Int16)Arrow->GetBlockHit().z); + m_Writer.AddByte("pickup", Arrow->GetPickupState()); + m_Writer.AddDouble("damage", Arrow->GetDamageCoeff()); break; } case cProjectileEntity::pkGhastFireball: @@ -620,14 +619,11 @@ void cNBTChunkSerializer::AddProjectileEntity(cProjectileEntity * a_Projectile) { ASSERT(!"Unsaved projectile entity!"); } - } // switch (ProjectileKind) - cEntity * Creator = a_Projectile->GetCreator(); - if (Creator != NULL) + } // switch (ProjectileKind) + + if (!a_Projectile->GetCreatorName().empty()) { - if (Creator->GetEntityType() == cEntity::etPlayer) - { - m_Writer.AddString("ownerName", ((cPlayer *)Creator)->GetName()); - } + m_Writer.AddString("ownerName", a_Projectile->GetCreatorName()); } m_Writer.EndCompound(); } |