summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/NBTChunkSerializer.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2015-03-13 23:29:27 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2015-03-13 23:29:27 +0100
commite15e30a030c6013d3ae631188ad8a790c627e9aa (patch)
treef496fad34db9572e03fd3a8ea655d812b013610d /src/WorldStorage/NBTChunkSerializer.cpp
parentMerge pull request #1809 from flx5/master (diff)
downloadcuberite-e15e30a030c6013d3ae631188ad8a790c627e9aa.tar
cuberite-e15e30a030c6013d3ae631188ad8a790c627e9aa.tar.gz
cuberite-e15e30a030c6013d3ae631188ad8a790c627e9aa.tar.bz2
cuberite-e15e30a030c6013d3ae631188ad8a790c627e9aa.tar.lz
cuberite-e15e30a030c6013d3ae631188ad8a790c627e9aa.tar.xz
cuberite-e15e30a030c6013d3ae631188ad8a790c627e9aa.tar.zst
cuberite-e15e30a030c6013d3ae631188ad8a790c627e9aa.zip
Diffstat (limited to 'src/WorldStorage/NBTChunkSerializer.cpp')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index c87397542..4f78dd245 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -726,24 +726,10 @@ void cNBTChunkSerializer::AddProjectileEntity(cProjectileEntity * a_Projectile)
void cNBTChunkSerializer::AddHangingEntity(cHangingEntity * a_Hanging)
{
- m_Writer.AddInt("TileX", a_Hanging->GetBlockX());
- m_Writer.AddInt("TileY", a_Hanging->GetBlockY());
- m_Writer.AddInt("TileZ", a_Hanging->GetBlockZ());
- switch (a_Hanging->GetFacing())
- {
- case BLOCK_FACE_XM: m_Writer.AddByte("Facing", 1); break;
- case BLOCK_FACE_XP: m_Writer.AddByte("Facing", 3); break;
- case BLOCK_FACE_ZM: m_Writer.AddByte("Facing", 2); break;
- case BLOCK_FACE_ZP: m_Writer.AddByte("Facing", 0); break;
-
- case BLOCK_FACE_YM:
- case BLOCK_FACE_YP:
- case BLOCK_FACE_NONE:
- {
- // These directions are invalid, but they may have been previously loaded, so keep them.
- break;
- }
- }
+ m_Writer.AddInt("TileX", FloorC(a_Hanging->GetPosX()));
+ m_Writer.AddInt("TileY", FloorC(a_Hanging->GetPosY()));
+ m_Writer.AddInt("TileZ", FloorC(a_Hanging->GetPosZ()));
+ m_Writer.AddByte("Facing", a_Hanging->GetProtocolFacing());
}