Implement wither skeletons (#4563)
This commit is contained in:
@@ -1560,6 +1560,8 @@ void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a
|
||||
{ "minecraft:witch", &cWSSAnvil::LoadWitchFromNBT },
|
||||
{ "WitherBoss", &cWSSAnvil::LoadWitherFromNBT },
|
||||
{ "minecraft:wither", &cWSSAnvil::LoadWitherFromNBT },
|
||||
{ "WitherSkeleton", &cWSSAnvil::LoadWitherSkeletonFromNBT },
|
||||
{ "minecraft:wither_skeleton", &cWSSAnvil::LoadWitherSkeletonFromNBT },
|
||||
{ "Wolf", &cWSSAnvil::LoadWolfFromNBT },
|
||||
{ "minecraft:wolf", &cWSSAnvil::LoadWolfFromNBT },
|
||||
{ "Zombie", &cWSSAnvil::LoadZombieFromNBT },
|
||||
@@ -2660,15 +2662,20 @@ void cWSSAnvil::LoadSilverfishFromNBT(cEntityList & a_Entities, const cParsedNBT
|
||||
|
||||
void cWSSAnvil::LoadSkeletonFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
|
||||
{
|
||||
// Wither skeleton is a separate mob in Minecraft 1.11+, but we need this to
|
||||
// load them from older worlds where wither skeletons were only a skeleton with a flag
|
||||
int TypeIdx = a_NBT.FindChildByName(a_TagIdx, "SkeletonType");
|
||||
if (TypeIdx < 0)
|
||||
|
||||
std::unique_ptr<cMonster> Monster;
|
||||
if ((TypeIdx > 0) && (a_NBT.GetByte(TypeIdx) == 1))
|
||||
{
|
||||
return;
|
||||
Monster = cpp14::make_unique<cWitherSkeleton>();
|
||||
}
|
||||
else
|
||||
{
|
||||
Monster = cpp14::make_unique<cSkeleton>();
|
||||
}
|
||||
|
||||
bool Type = ((a_NBT.GetByte(TypeIdx) == 1) ? true : false);
|
||||
|
||||
std::unique_ptr<cSkeleton> Monster = cpp14::make_unique<cSkeleton>(Type);
|
||||
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
|
||||
{
|
||||
return;
|
||||
@@ -2863,6 +2870,26 @@ void cWSSAnvil::LoadWitherFromNBT(cEntityList & a_Entities, const cParsedNBT & a
|
||||
|
||||
|
||||
|
||||
void cWSSAnvil::LoadWitherSkeletonFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
|
||||
{
|
||||
auto Monster = cpp14::make_unique<cWitherSkeleton>();
|
||||
if (!LoadEntityBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!LoadMonsterBaseFromNBT(*Monster.get(), a_NBT, a_TagIdx))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
a_Entities.emplace_back(std::move(Monster));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cWSSAnvil::LoadWolfFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx)
|
||||
{
|
||||
std::unique_ptr<cWolf> Monster = cpp14::make_unique<cWolf>();
|
||||
|
||||
Reference in New Issue
Block a user