summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/NBTChunkSerializer.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-03-15 02:45:25 +0100
committerHowaner <franzi.moos@googlemail.com>2014-03-15 02:45:25 +0100
commit7ac7304c913f9cf82a906589904068a3e7f09d43 (patch)
treeb4eea6cc46781c7c253c44072c1ad446c8633997 /src/WorldStorage/NBTChunkSerializer.cpp
parentAdd health and age load to pickup's. (diff)
downloadcuberite-7ac7304c913f9cf82a906589904068a3e7f09d43.tar
cuberite-7ac7304c913f9cf82a906589904068a3e7f09d43.tar.gz
cuberite-7ac7304c913f9cf82a906589904068a3e7f09d43.tar.bz2
cuberite-7ac7304c913f9cf82a906589904068a3e7f09d43.tar.lz
cuberite-7ac7304c913f9cf82a906589904068a3e7f09d43.tar.xz
cuberite-7ac7304c913f9cf82a906589904068a3e7f09d43.tar.zst
cuberite-7ac7304c913f9cf82a906589904068a3e7f09d43.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 37ebf0610..6672d289e 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -30,6 +30,8 @@
#include "../Entities/ProjectileEntity.h"
#include "../Entities/TNTEntity.h"
#include "../Entities/ExpOrb.h"
+#include "../Entities/HangingEntity.h"
+#include "../Entities/ItemFrame.h"
#include "../Mobs/Monster.h"
#include "../Mobs/Bat.h"
@@ -585,6 +587,25 @@ void cNBTChunkSerializer::AddProjectileEntity(cProjectileEntity * a_Projectile)
+void cNBTChunkSerializer::AddHangingEntity(cHangingEntity * a_Hanging)
+{
+ m_Writer.AddByte("Direction", (unsigned char)a_Hanging->GetDirection());
+ m_Writer.AddInt("TileX", a_Hanging->GetTileX());
+ m_Writer.AddInt("TileY", a_Hanging->GetTileY());
+ m_Writer.AddInt("TileZ", a_Hanging->GetTileZ());
+ switch (a_Hanging->GetDirection())
+ {
+ case 0: m_Writer.AddByte("Dir", (unsigned char)2); break;
+ case 1: m_Writer.AddByte("Dir", (unsigned char)1); break;
+ case 2: m_Writer.AddByte("Dir", (unsigned char)0); break;
+ case 3: m_Writer.AddByte("Dir", (unsigned char)3); break;
+ }
+}
+
+
+
+
+
void cNBTChunkSerializer::AddTNTEntity(cTNTEntity * a_TNT)
{
m_Writer.BeginCompound("");
@@ -597,7 +618,7 @@ void cNBTChunkSerializer::AddTNTEntity(cTNTEntity * a_TNT)
-void cNBTChunkSerializer::AddExpOrbEntity(cExpOrb* a_ExpOrb)
+void cNBTChunkSerializer::AddExpOrbEntity(cExpOrb * a_ExpOrb)
{
m_Writer.BeginCompound("");
AddBasicEntity(a_ExpOrb, "XPOrb");
@@ -611,6 +632,21 @@ void cNBTChunkSerializer::AddExpOrbEntity(cExpOrb* a_ExpOrb)
+void cNBTChunkSerializer::AddItemFrameEntity(cItemFrame * a_ItemFrame)
+{
+ m_Writer.BeginCompound("");
+ AddBasicEntity(a_ItemFrame, "ItemFrame");
+ AddHangingEntity(a_ItemFrame);
+ AddItem(a_ItemFrame->GetItem(), -1, "Item");
+ m_Writer.AddByte("ItemRotation", (unsigned char)a_ItemFrame->GetRotation());
+ m_Writer.AddFloat("ItemDropChance", 1.0F);
+ m_Writer.EndCompound();
+}
+
+
+
+
+
void cNBTChunkSerializer::AddMinecartChestContents(cMinecartWithChest * a_Minecart)
{
m_Writer.BeginList("Items", TAG_Compound);
@@ -692,7 +728,7 @@ void cNBTChunkSerializer::Entity(cEntity * a_Entity)
case cEntity::etProjectile: AddProjectileEntity ((cProjectileEntity *)a_Entity); break;
case cEntity::etTNT: AddTNTEntity ((cTNTEntity *) a_Entity); break;
case cEntity::etExpOrb: AddExpOrbEntity ((cExpOrb *) a_Entity); break;
- case cEntity::etItemFrame: /* TODO */ break;
+ case cEntity::etItemFrame: AddItemFrameEntity ((cItemFrame *) a_Entity); break;
case cEntity::etPainting: /* TODO */ break;
case cEntity::etPlayer: return; // Players aren't saved into the world
default: