summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSAnvil.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-02-17 20:14:08 +0100
committerTheJumper <maximilian.springer@web.de>2014-02-23 19:50:50 +0100
commitab2eba17ec36e5d906d0a45e33b8c7d59e19d4e2 (patch)
treee4b50b198e8e869a7e8955110a121329ffaf1ac5 /src/WorldStorage/WSSAnvil.cpp
parentMerge pull request #694 from mc-server/itemframes (diff)
downloadcuberite-ab2eba17ec36e5d906d0a45e33b8c7d59e19d4e2.tar
cuberite-ab2eba17ec36e5d906d0a45e33b8c7d59e19d4e2.tar.gz
cuberite-ab2eba17ec36e5d906d0a45e33b8c7d59e19d4e2.tar.bz2
cuberite-ab2eba17ec36e5d906d0a45e33b8c7d59e19d4e2.tar.lz
cuberite-ab2eba17ec36e5d906d0a45e33b8c7d59e19d4e2.tar.xz
cuberite-ab2eba17ec36e5d906d0a45e33b8c7d59e19d4e2.tar.zst
cuberite-ab2eba17ec36e5d906d0a45e33b8c7d59e19d4e2.zip
Diffstat (limited to 'src/WorldStorage/WSSAnvil.cpp')
-rw-r--r--src/WorldStorage/WSSAnvil.cpp40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index e95813a3c..89a236f07 100644
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -24,6 +24,7 @@
#include "../BlockEntities/JukeboxEntity.h"
#include "../BlockEntities/NoteEntity.h"
#include "../BlockEntities/SignEntity.h"
+#include "../BlockEntities/SkullEntity.h"
#include "../Mobs/Monster.h"
@@ -597,6 +598,10 @@ void cWSSAnvil::LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntities, con
{
LoadSignFromNBT(a_BlockEntities, a_NBT, Child);
}
+ else if (strncmp(a_NBT.GetData(sID), "Skull", a_NBT.GetDataLength(sID)) == 0)
+ {
+ LoadSkullFromNBT(a_BlockEntities, a_NBT, Child);
+ }
else if (strncmp(a_NBT.GetData(sID), "Trap", a_NBT.GetDataLength(sID)) == 0)
{
LoadDispenserFromNBT(a_BlockEntities, a_NBT, Child);
@@ -927,6 +932,41 @@ void cWSSAnvil::LoadSignFromNBT(cBlockEntityList & a_BlockEntities, const cParse
+void cWSSAnvil::LoadSkullFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx)
+{
+ ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound);
+ int x, y, z;
+ if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z))
+ {
+ return;
+ }
+ std::auto_ptr<cSkullEntity> Skull(new cSkullEntity(E_BLOCK_HEAD, x, y, z, m_World));
+
+ int currentLine = a_NBT.FindChildByName(a_TagIdx, "SkullType");
+ if (currentLine >= 0)
+ {
+ Skull->SetSkullType(static_cast<eSkullType>(a_NBT.GetByte(currentLine)));
+ }
+
+ currentLine = a_NBT.FindChildByName(a_TagIdx, "Rot");
+ if (currentLine >= 0)
+ {
+ Skull->SetRotation(static_cast<eSkullRotation>(a_NBT.GetByte(currentLine)));
+ }
+
+ currentLine = a_NBT.FindChildByName(a_TagIdx, "ExtraType");
+ if (currentLine >= 0)
+ {
+ Skull->SetOwner(a_NBT.GetString(currentLine));
+ }
+
+ a_BlockEntities.push_back(Skull.release());
+}
+
+
+
+
+
void cWSSAnvil::LoadCommandBlockFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx)
{
ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound);