diff options
author | Howaner <franzi.moos@googlemail.com> | 2014-06-28 13:19:32 +0200 |
---|---|---|
committer | Howaner <franzi.moos@googlemail.com> | 2014-06-28 13:19:32 +0200 |
commit | 11d02a447e45e96e4652f25afc6d040597ad2064 (patch) | |
tree | 648742a8589b7536bd101b3a25c16e3c1375870b | |
parent | Fix sheep color's, add shear sound. (diff) | |
download | cuberite-11d02a447e45e96e4652f25afc6d040597ad2064.tar cuberite-11d02a447e45e96e4652f25afc6d040597ad2064.tar.gz cuberite-11d02a447e45e96e4652f25afc6d040597ad2064.tar.bz2 cuberite-11d02a447e45e96e4652f25afc6d040597ad2064.tar.lz cuberite-11d02a447e45e96e4652f25afc6d040597ad2064.tar.xz cuberite-11d02a447e45e96e4652f25afc6d040597ad2064.tar.zst cuberite-11d02a447e45e96e4652f25afc6d040597ad2064.zip |
-rw-r--r-- | src/Mobs/Sheep.h | 3 | ||||
-rw-r--r-- | src/WorldStorage/WSSAnvil.cpp | 15 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/Mobs/Sheep.h b/src/Mobs/Sheep.h index 14da81364..21dca7787 100644 --- a/src/Mobs/Sheep.h +++ b/src/Mobs/Sheep.h @@ -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: diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp index 9870c144a..5c209c7fa 100644 --- a/src/WorldStorage/WSSAnvil.cpp +++ b/src/WorldStorage/WSSAnvil.cpp @@ -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()); } |