1
0
Fork 0

Save IsSheared from Sheep.

This commit is contained in:
Howaner 2014-06-28 13:19:32 +02:00
parent bef84b4821
commit 11d02a447e
2 changed files with 14 additions and 4 deletions

View File

@ -24,7 +24,10 @@ public:
virtual const cItem GetFollowedItem(void) const override { return cItem(E_ITEM_WHEAT); }
bool IsSheared(void) const { return m_IsSheared; }
void SetSheared(bool a_IsSheared) { m_IsSheared = a_IsSheared; }
int GetFurColor(void) const { return m_WoolColor; }
void SetFurColor(bool a_WoolColor) { m_WoolColor = a_WoolColor; }
private:

View File

@ -2073,10 +2073,11 @@ void cWSSAnvil::LoadPigFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
void cWSSAnvil::LoadSheepFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
int ColorIdx = a_NBT.FindChildByName(a_TagIdx, "Color");
if (ColorIdx < 0) { return; }
int Color = (int)a_NBT.GetByte(ColorIdx);
int Color = -1;
if (ColorIdx > 0)
{
Color = (int)a_NBT.GetByte(ColorIdx);
}
std::auto_ptr<cSheep> Monster(new cSheep(Color));
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
@ -2089,6 +2090,12 @@ void cWSSAnvil::LoadSheepFromNBT(cEntityList & a_Entities, const cParsedNBT & a_
return;
}
int ShearedIdx = a_NBT.FindChildByName(a_TagIdx, "Sheared");
if (ShearedIdx > 0)
{
Monster.get()->SetSheared((bool)a_NBT.GetByte(ShearedIdx));
}
a_Entities.push_back(Monster.release());
}