summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage
diff options
context:
space:
mode:
authorHallucino <d@t0t0.fr>2015-07-12 18:00:56 +0200
committerhallucino <d@t0t0.fr>2015-07-14 22:41:31 +0200
commit53207d3f189fc0766928356d1242bc6307cd57b4 (patch)
tree2b80890a0a96011d1b52538d0160068dd68f168b /src/WorldStorage
parentMerge pull request #2330 from cuberite/libraryupdate (diff)
downloadcuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar
cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar.gz
cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar.bz2
cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar.lz
cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar.xz
cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.tar.zst
cuberite-53207d3f189fc0766928356d1242bc6307cd57b4.zip
Diffstat (limited to '')
-rw-r--r--src/WorldStorage/NBTChunkSerializer.cpp33
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.cpp79
2 files changed, 100 insertions, 12 deletions
diff --git a/src/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp
index 10231ae3b..234c60d62 100644
--- a/src/WorldStorage/NBTChunkSerializer.cpp
+++ b/src/WorldStorage/NBTChunkSerializer.cpp
@@ -554,6 +554,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.AddInt ("Style", Horse.GetHorseStyle());
m_Writer.AddInt ("ArmorType", Horse.GetHorseArmour());
m_Writer.AddByte("Saddle", Horse.IsSaddled());
+ m_Writer.AddByte("Age", Horse.GetAge());
break;
}
case mtMagmaCube:
@@ -565,6 +566,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
{
m_Writer.AddByte("Sheared", ((const cSheep *)a_Monster)->IsSheared());
m_Writer.AddByte("Color", ((const cSheep *)a_Monster)->GetFurColor());
+ m_Writer.AddByte("Age", ((const cSheep *)a_Monster)->GetAge());
break;
}
case mtSlime:
@@ -580,6 +582,7 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
case mtVillager:
{
m_Writer.AddInt("Profession", ((const cVillager *)a_Monster)->GetVilType());
+ m_Writer.AddByte("Age", ((const cVillager *)a_Monster)->GetAge());
break;
}
case mtWither:
@@ -601,13 +604,37 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
m_Writer.AddByte("Sitting", Wolf.IsSitting() ? 1 : 0);
m_Writer.AddByte("Angry", Wolf.IsAngry() ? 1 : 0);
m_Writer.AddByte("CollarColor", (unsigned char)Wolf.GetCollarColor());
+ m_Writer.AddByte("Age", Wolf.GetAge());
break;
}
case mtZombie:
{
m_Writer.AddByte("IsVillager", (((const cZombie *)a_Monster)->IsVillagerZombie() ? 1 : 0));
- m_Writer.AddByte("IsBaby", (((const cZombie *)a_Monster)->IsBaby() ? 1 : 0));
m_Writer.AddByte("IsConverting", (((const cZombie *)a_Monster)->IsConverting() ? 1 : 0));
+ m_Writer.AddByte("Age", (((const cZombie *)a_Monster)->GetAge()));
+ break;
+ }
+ case mtZombiePigman:
+ {
+ m_Writer.AddByte("Age", (((const cZombiePigman *)a_Monster)->GetAge()));
+ break;
+ }
+ case mtOcelot:
+ {
+ const cOcelot & Ocelot = *((cOcelot *)a_Monster);
+ m_Writer.AddByte("Age", Ocelot.GetAge());
+ break;
+ }
+ case mtPig:
+ {
+ const cPig & Pig = *((cPig *)a_Monster);
+ m_Writer.AddByte("Age", Pig.GetAge());
+ break;
+ }
+ case mtRabbit:
+ {
+ const cRabbit & Rabbit = *((cRabbit *)a_Monster);
+ m_Writer.AddByte("Age", Rabbit.GetAge());
break;
}
case mtInvalidType:
@@ -621,15 +648,11 @@ void cNBTChunkSerializer::AddMonsterEntity(cMonster * a_Monster)
case mtGuardian:
case mtIronGolem:
case mtMooshroom:
- case mtOcelot:
- case mtPig:
- case mtRabbit:
case mtSilverfish:
case mtSnowGolem:
case mtSpider:
case mtSquid:
case mtWitch:
- case mtZombiePigman:
{
// Other mobs have no special tags.
break;
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 4912d20f6..e99b2611b 100755
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -2256,7 +2256,14 @@ void cWSSAnvil::LoadHorseFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2346,6 +2353,13 @@ void cWSSAnvil::LoadOcelotFromNBT(cEntityList & a_Entities, const cParsedNBT & a
return;
}
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2365,7 +2379,14 @@ void cWSSAnvil::LoadPigFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2385,7 +2406,14 @@ void cWSSAnvil::LoadRabbitFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2418,7 +2446,14 @@ void cWSSAnvil::LoadSheepFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
{
Monster->SetSheared(a_NBT.GetByte(ShearedIdx) != 0);
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2583,7 +2618,15 @@ void cWSSAnvil::LoadVillagerFromNBT(cEntityList & a_Entities, const cParsedNBT &
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
+
a_Entities.push_back(Monster.release());
}
@@ -2683,6 +2726,14 @@ void cWSSAnvil::LoadWolfFromNBT(cEntityList & a_Entities, const cParsedNBT & a_N
}
}
}
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2710,7 +2761,14 @@ void cWSSAnvil::LoadZombieFromNBT(cEntityList & a_Entities, const cParsedNBT & a
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}
@@ -2730,7 +2788,14 @@ void cWSSAnvil::LoadPigZombieFromNBT(cEntityList & a_Entities, const cParsedNBT
{
return;
}
-
+
+ int AgeableIdx = a_NBT.FindChildByName(a_TagIdx, "Age");
+ if (AgeableIdx > 0)
+ {
+ Byte Age = a_NBT.GetByte(AgeableIdx);
+ Monster->SetAge(Age);
+ }
+
a_Entities.push_back(Monster.release());
}