summaryrefslogtreecommitdiffstats
path: root/src/WorldStorage/WSSAnvil.cpp
diff options
context:
space:
mode:
authorJulian Laubstein <julianlaubstein@yahoo.de>2015-07-17 17:12:27 +0200
committerJulian Laubstein <julianlaubstein@yahoo.de>2015-07-17 17:12:27 +0200
commit9fba48533f3444b6d79d79324084e8abb356a392 (patch)
treec754094876237a8cf1f331071c8adc3e428140cf /src/WorldStorage/WSSAnvil.cpp
parentMerge pull request #2363 from scribblemaniac/improve-spider-ai (diff)
parent Added Rabbit Metadata values. (diff)
downloadcuberite-9fba48533f3444b6d79d79324084e8abb356a392.tar
cuberite-9fba48533f3444b6d79d79324084e8abb356a392.tar.gz
cuberite-9fba48533f3444b6d79d79324084e8abb356a392.tar.bz2
cuberite-9fba48533f3444b6d79d79324084e8abb356a392.tar.lz
cuberite-9fba48533f3444b6d79d79324084e8abb356a392.tar.xz
cuberite-9fba48533f3444b6d79d79324084e8abb356a392.tar.zst
cuberite-9fba48533f3444b6d79d79324084e8abb356a392.zip
Diffstat (limited to 'src/WorldStorage/WSSAnvil.cpp')
-rwxr-xr-xsrc/WorldStorage/WSSAnvil.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp
index 62918f44e..54071b9df 100755
--- a/src/WorldStorage/WSSAnvil.cpp
+++ b/src/WorldStorage/WSSAnvil.cpp
@@ -2396,7 +2396,18 @@ void cWSSAnvil::LoadPigFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NB
void cWSSAnvil::LoadRabbitFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
{
- std::unique_ptr<cRabbit> Monster = cpp14::make_unique<cRabbit>();
+ int TypeIdx = a_NBT.FindChildByName(a_TagIdx, "RabbitType");
+ int MoreCarrotTicksIdx = a_NBT.FindChildByName(a_TagIdx, "MoreCarrotTicks");
+
+ if ((TypeIdx < 0) || (MoreCarrotTicksIdx < 0))
+ {
+ return;
+ }
+
+ int Type = a_NBT.GetInt(TypeIdx);
+ int MoreCarrotTicks = a_NBT.GetInt(MoreCarrotTicksIdx);
+
+ std::unique_ptr<cRabbit> Monster = cpp14::make_unique<cRabbit>(static_cast<eRabbitType>(Type), MoreCarrotTicks);
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
{
return;