From 6a27ec2ea0a707d44580dc19e52bb4b6181bb403 Mon Sep 17 00:00:00 2001 From: bibo38 Date: Fri, 17 Jul 2015 01:09:06 +0200 Subject: Added Rabbit Metadata values. Added the Rabbit Types and the MoreCarrotTicks value. Types are selected randomly on creation. Fixes #1867 --- src/WorldStorage/WSSAnvil.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/WorldStorage/WSSAnvil.cpp') 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 Monster = cpp14::make_unique(); + 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 Monster = cpp14::make_unique(static_cast(Type), MoreCarrotTicks); if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx)) { return; -- cgit v1.2.3