summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authorbibo38 <bibo38@github.com>2016-01-11 17:55:32 +0100
committerbibo38 <bibo38@github.com>2016-01-11 17:55:32 +0100
commit657b0ed0070cc31e375e33ec752e4757e0c7a343 (patch)
tree1302f67bea0416a54c7d1077c84f53018acbbc11 /src/WorldStorage
parentAdded "core.help" permission to Default rank. (diff)
downloadcuberite-657b0ed0070cc31e375e33ec752e4757e0c7a343.tar
cuberite-657b0ed0070cc31e375e33ec752e4757e0c7a343.tar.gz
cuberite-657b0ed0070cc31e375e33ec752e4757e0c7a343.tar.bz2
cuberite-657b0ed0070cc31e375e33ec752e4757e0c7a343.tar.lz
cuberite-657b0ed0070cc31e375e33ec752e4757e0c7a343.tar.xz
cuberite-657b0ed0070cc31e375e33ec752e4757e0c7a343.tar.zst
cuberite-657b0ed0070cc31e375e33ec752e4757e0c7a343.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp15
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.cpp43
2 files changed, 54 insertions, 4 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index b0451e427..3a0823491 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -358,7 +358,20 @@ void cNBTChunkSerializer::AddMobHeadEntity(cMobHeadEntity * a_MobHead)
AddBasicTileEntity(a_MobHead, "Skull");
m_Writer.AddByte ("SkullType", a_MobHead->GetType() & 0xFF);
m_Writer.AddByte ("Rot", a_MobHead->GetRotation() & 0xFF);
- m_Writer.AddString("ExtraType", a_MobHead->GetOwner());
+
+ // The new Block Entity format for a Mob Head. See: http://minecraft.gamepedia.com/Head#Block_entity
+ m_Writer.BeginCompound("Owner");
+ m_Writer.AddString("Id", a_MobHead->GetOwnerUUID());
+ m_Writer.AddString("Name", a_MobHead->GetOwnerName());
+ m_Writer.BeginCompound("Properties");
+ m_Writer.BeginList("textures", TAG_Compound);
+ m_Writer.BeginCompound("");
+ m_Writer.AddString("Signature", a_MobHead->GetOwnerTextureSignature());
+ m_Writer.AddString("Value", a_MobHead->GetOwnerTexture());
+ m_Writer.EndCompound();
+ m_Writer.EndList();
+ m_Writer.EndCompound();
+ m_Writer.EndCompound();
m_Writer.EndCompound();
}
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 5138717a7..3d325d354 100755
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -1293,10 +1293,47 @@ cBlockEntity * cWSSAnvil::LoadMobHeadFromNBT(const cParsedNBT & a_NBT, int a_Tag
MobHead->SetRotation(static_cast<eMobHeadRotation>(a_NBT.GetByte(currentLine)));
}
- currentLine = a_NBT.FindChildByName(a_TagIdx, "ExtraType");
- if (currentLine >= 0)
+ int ownerLine = a_NBT.FindChildByName(a_TagIdx, "Owner");
+ if (ownerLine >= 0)
{
- MobHead->SetOwner(a_NBT.GetString(currentLine));
+ AString OwnerName, OwnerUUID, OwnerTexture, OwnerTextureSignature;
+
+ currentLine = a_NBT.FindChildByName(ownerLine, "Id");
+ if (currentLine >= 0)
+ {
+ OwnerUUID = a_NBT.GetString(currentLine);
+ }
+
+ currentLine = a_NBT.FindChildByName(ownerLine, "Name");
+ if (currentLine >= 0)
+ {
+ OwnerName = a_NBT.GetString(currentLine);
+ }
+
+ int textureLine = a_NBT.GetFirstChild( // The first texture of
+ a_NBT.FindChildByName( // The texture list of
+ a_NBT.FindChildByName( // The Properties compound of
+ ownerLine, // The Owner compound
+ "Properties"
+ ),
+ "textures"
+ )
+ );
+ if (textureLine >= 0)
+ {
+ currentLine = a_NBT.FindChildByName(textureLine, "Signature");
+ if (currentLine >= 0)
+ {
+ OwnerTextureSignature = a_NBT.GetString(currentLine);
+ }
+
+ currentLine = a_NBT.FindChildByName(textureLine, "Value");
+ if (currentLine >= 0)
+ {
+ OwnerTexture = a_NBT.GetString(currentLine);
+ }
+ }
+ MobHead->SetOwner(OwnerUUID, OwnerName, OwnerTexture, OwnerTextureSignature);
}
return MobHead.release();