Implement wither skeletons (#4563)
This commit is contained in:
parent
aac592f985
commit
60bcc06f43
@ -9290,6 +9290,10 @@ a_Player:OpenWindow(Window);
|
||||
{
|
||||
Notes = "",
|
||||
},
|
||||
mtWitherSkeleton =
|
||||
{
|
||||
Notes = "",
|
||||
},
|
||||
mtWolf =
|
||||
{
|
||||
Notes = "",
|
||||
@ -16686,6 +16690,10 @@ end
|
||||
{
|
||||
Notes = "A flag in the metadata of heads that indicates that the head is a zombie head.",
|
||||
},
|
||||
E_META_SPAWN_EGG_WITHER_SKELETON =
|
||||
{
|
||||
Notes = ""
|
||||
},
|
||||
E_META_SPONGE_DRY =
|
||||
{
|
||||
Notes = "A flag in the metadata of sponges that indicates that the sponge is dry.",
|
||||
@ -16790,6 +16798,10 @@ end
|
||||
{
|
||||
Notes = "Something concerning (i.e. reload) is about to happen",
|
||||
},
|
||||
mtWitherSkeleton =
|
||||
{
|
||||
Notes = ""
|
||||
},
|
||||
hMain =
|
||||
{
|
||||
Notes = "The main hand",
|
||||
@ -17049,6 +17061,7 @@ end
|
||||
"mtVillager",
|
||||
"mtWitch",
|
||||
"mtWither",
|
||||
"mtWitherSkeleton",
|
||||
"mtWolf",
|
||||
"mtZombie",
|
||||
"mtZombiePigman",
|
||||
|
@ -190,6 +190,14 @@ AttackRate=1.0
|
||||
MaxHealth=26
|
||||
SightDistance=25.0
|
||||
|
||||
[WitherSkeleton]
|
||||
AttackDamage=5.0
|
||||
AttackRange=1.0
|
||||
AttackRate=1.0
|
||||
IsFireproof=1
|
||||
MaxHealth=20
|
||||
SightDistance=25.0
|
||||
|
||||
[Wolf]
|
||||
AttackDamage=8.0
|
||||
AttackRange=1.0
|
||||
|
@ -1063,6 +1063,7 @@ enum ENUM_ITEM_META : short
|
||||
// See also cMonster::eType, since monster type and spawn egg meta are the same
|
||||
E_META_SPAWN_EGG_PICKUP = 1,
|
||||
E_META_SPAWN_EGG_EXPERIENCE_ORB = 2,
|
||||
E_META_SPAWN_EGG_WITHER_SKELETON = 5,
|
||||
E_META_SPAWN_EGG_LEASH_KNOT = 8,
|
||||
E_META_SPAWN_EGG_PAINTING = 9,
|
||||
E_META_SPAWN_EGG_ARROW = 10,
|
||||
|
@ -83,6 +83,7 @@ public:
|
||||
case E_META_SPAWN_EGG_SQUID: return mtSquid;
|
||||
case E_META_SPAWN_EGG_VILLAGER: return mtVillager;
|
||||
case E_META_SPAWN_EGG_WITCH: return mtWitch;
|
||||
case E_META_SPAWN_EGG_WITHER_SKELETON: return mtWitherSkeleton;
|
||||
case E_META_SPAWN_EGG_WOLF: return mtWolf;
|
||||
case E_META_SPAWN_EGG_ZOMBIE: return mtZombie;
|
||||
case E_META_SPAWN_EGG_ZOMBIE_PIGMAN: return mtZombiePigman;
|
||||
|
@ -287,6 +287,18 @@ bool cMobSpawner::CanSpawnHere(cChunk * a_Chunk, Vector3i a_RelPos, eMonsterType
|
||||
);
|
||||
}
|
||||
|
||||
case mtWitherSkeleton:
|
||||
{
|
||||
return (
|
||||
(targetBlock == E_BLOCK_AIR) &&
|
||||
(blockAbove == E_BLOCK_AIR) &&
|
||||
(!cBlockInfo::IsTransparent(blockBelow)) &&
|
||||
(skyLight <= 7) &&
|
||||
(blockLight <= 7) &&
|
||||
(random.RandBool(0.6))
|
||||
);
|
||||
}
|
||||
|
||||
case mtWolf:
|
||||
{
|
||||
return (
|
||||
@ -443,6 +455,7 @@ std::set<eMonsterType> cMobSpawner::GetAllowedMobTypes(EMCSBiome a_Biome)
|
||||
ListOfSpawnables.insert(mtBlaze);
|
||||
ListOfSpawnables.insert(mtGhast);
|
||||
ListOfSpawnables.insert(mtMagmaCube);
|
||||
ListOfSpawnables.insert(mtWitherSkeleton);
|
||||
ListOfSpawnables.insert(mtZombiePigman);
|
||||
|
||||
return ListOfSpawnables;
|
||||
@ -461,7 +474,11 @@ cMonster * cMobSpawner::TryToSpawnHere(cChunk * a_Chunk, Vector3i a_RelPos, EMCS
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
if (m_MobType == mtWolf)
|
||||
if (m_MobType == mtWitherSkeleton)
|
||||
{
|
||||
a_MaxPackSize = 5;
|
||||
}
|
||||
else if (m_MobType == mtWolf)
|
||||
{
|
||||
a_MaxPackSize = 8;
|
||||
}
|
||||
|
@ -33,6 +33,7 @@ SET (SRCS
|
||||
Villager.cpp
|
||||
Witch.cpp
|
||||
Wither.cpp
|
||||
WitherSkeleton.cpp
|
||||
Wolf.cpp
|
||||
Zombie.cpp
|
||||
ZombiePigman.cpp)
|
||||
@ -74,6 +75,7 @@ SET (HDRS
|
||||
Villager.h
|
||||
Witch.h
|
||||
Wither.h
|
||||
WitherSkeleton.h
|
||||
Wolf.h
|
||||
Zombie.h
|
||||
ZombiePigman.h)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "Villager.h"
|
||||
#include "Witch.h"
|
||||
#include "Wither.h"
|
||||
#include "WitherSkeleton.h"
|
||||
#include "Wolf.h"
|
||||
#include "Zombie.h"
|
||||
#include "ZombiePigman.h"
|
||||
|
@ -65,6 +65,7 @@ static const struct
|
||||
{mtVillager, "villager", "Villager", "villager"},
|
||||
{mtWitch, "witch", "Witch", "witch"},
|
||||
{mtWither, "wither", "WitherBoss", "wither"},
|
||||
{mtWitherSkeleton, "witherskeleton", "WitherSkeleton", "wither_skeleton"},
|
||||
{mtWolf, "wolf", "Wolf", "wolf"},
|
||||
{mtZombie, "zombie", "Zombie", "zombie"},
|
||||
{mtZombiePigman, "zombiepigman", "PigZombie", "zombie_pigman"},
|
||||
@ -658,6 +659,7 @@ void cMonster::KilledBy(TakeDamageInfo & a_TDI)
|
||||
case mtSkeleton:
|
||||
case mtSpider:
|
||||
case mtWitch:
|
||||
case mtWitherSkeleton:
|
||||
case mtZombie:
|
||||
case mtZombiePigman:
|
||||
case mtSlime:
|
||||
@ -1072,6 +1074,7 @@ cMonster::eFamily cMonster::FamilyFromType(eMonsterType a_Type)
|
||||
case mtVillager: return mfPassive;
|
||||
case mtWitch: return mfHostile;
|
||||
case mtWither: return mfNoSpawn;
|
||||
case mtWitherSkeleton: return mfHostile;
|
||||
case mtWolf: return mfHostile;
|
||||
case mtZombie: return mfHostile;
|
||||
case mtZombiePigman: return mfHostile;
|
||||
@ -1173,11 +1176,6 @@ std::unique_ptr<cMonster> cMonster::NewMonsterFromType(eMonsterType a_MobType)
|
||||
{
|
||||
return cpp14::make_unique<cSlime>(1 << Random.RandInt(2)); // Size 1, 2 or 4
|
||||
}
|
||||
case mtSkeleton:
|
||||
{
|
||||
// TODO: Actual detection of spawning in Nether
|
||||
return cpp14::make_unique<cSkeleton>(false);
|
||||
}
|
||||
case mtVillager:
|
||||
{
|
||||
int VillagerType = Random.RandInt(6);
|
||||
@ -1224,11 +1222,13 @@ std::unique_ptr<cMonster> cMonster::NewMonsterFromType(eMonsterType a_MobType)
|
||||
case mtRabbit: return cpp14::make_unique<cRabbit>();
|
||||
case mtSheep: return cpp14::make_unique<cSheep>();
|
||||
case mtSilverfish: return cpp14::make_unique<cSilverfish>();
|
||||
case mtSkeleton: return cpp14::make_unique<cSkeleton>();
|
||||
case mtSnowGolem: return cpp14::make_unique<cSnowGolem>();
|
||||
case mtSpider: return cpp14::make_unique<cSpider>();
|
||||
case mtSquid: return cpp14::make_unique<cSquid>();
|
||||
case mtWitch: return cpp14::make_unique<cWitch>();
|
||||
case mtWither: return cpp14::make_unique<cWither>();
|
||||
case mtWitherSkeleton: return cpp14::make_unique<cWitherSkeleton>();
|
||||
case mtWolf: return cpp14::make_unique<cWolf>();
|
||||
case mtZombie: return cpp14::make_unique<cZombie>(false); // TODO: Infected zombie parameter
|
||||
case mtZombiePigman: return cpp14::make_unique<cZombiePigman>();
|
||||
|
@ -39,6 +39,7 @@ enum eMonsterType
|
||||
mtVillager,
|
||||
mtWitch,
|
||||
mtWither,
|
||||
mtWitherSkeleton,
|
||||
mtWolf,
|
||||
mtZombie,
|
||||
mtZombiePigman,
|
||||
|
@ -9,9 +9,8 @@
|
||||
|
||||
|
||||
|
||||
cSkeleton::cSkeleton(bool IsWither) :
|
||||
super("Skeleton", mtSkeleton, "entity.skeleton.hurt", "entity.skeleton.death", "entity.skeleton.ambient", 0.6, 1.8),
|
||||
m_bIsWither(IsWither)
|
||||
cSkeleton::cSkeleton(void) :
|
||||
super("Skeleton", mtSkeleton, "entity.skeleton.hurt", "entity.skeleton.death", "entity.skeleton.ambient", 0.6, 1.8)
|
||||
{
|
||||
}
|
||||
|
||||
@ -26,18 +25,8 @@ void cSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
|
||||
{
|
||||
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
|
||||
}
|
||||
if (IsWither())
|
||||
{
|
||||
AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_COAL);
|
||||
cItems RareDrops;
|
||||
RareDrops.Add(cItem(E_ITEM_HEAD, 1, 1));
|
||||
AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_ARROW);
|
||||
|
||||
}
|
||||
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_BONE);
|
||||
AddRandomArmorDropItem(a_Drops, LootingLevel);
|
||||
AddRandomWeaponDropItem(a_Drops, LootingLevel);
|
||||
|
@ -13,7 +13,7 @@ class cSkeleton :
|
||||
typedef cAggressiveMonster super;
|
||||
|
||||
public:
|
||||
cSkeleton(bool IsWither);
|
||||
cSkeleton(void);
|
||||
|
||||
CLASS_PROTODEF(cSkeleton)
|
||||
|
||||
@ -23,12 +23,6 @@ public:
|
||||
|
||||
virtual bool IsUndead(void) override { return true; }
|
||||
|
||||
bool IsWither(void) const { return m_bIsWither; }
|
||||
|
||||
private:
|
||||
|
||||
bool m_bIsWither;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
62
src/Mobs/WitherSkeleton.cpp
Normal file
62
src/Mobs/WitherSkeleton.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
|
||||
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
||||
|
||||
#include "WitherSkeleton.h"
|
||||
#include "../World.h"
|
||||
#include "../ClientHandle.h"
|
||||
|
||||
|
||||
|
||||
|
||||
cWitherSkeleton::cWitherSkeleton(void) :
|
||||
super("WitherSkeleton", mtWitherSkeleton, "entity.wither_skeleton.hurt", "entity.wither_skeleton.death", "entity.wither_skeleton.ambient", 0.7, 2.4)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
bool cWitherSkeleton::Attack(std::chrono::milliseconds a_Dt)
|
||||
{
|
||||
if (GetTarget() == nullptr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
GetTarget()->AddEntityEffect(cEntityEffect::effWither, 200, 0);
|
||||
return super::Attack(a_Dt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cWitherSkeleton::GetDrops(cItems & a_Drops, cEntity * a_Killer)
|
||||
{
|
||||
unsigned int LootingLevel = 0;
|
||||
if (a_Killer != nullptr)
|
||||
{
|
||||
LootingLevel = a_Killer->GetEquippedWeapon().m_Enchantments.GetLevel(cEnchantments::enchLooting);
|
||||
}
|
||||
AddRandomUncommonDropItem(a_Drops, 33.0f, E_ITEM_COAL);
|
||||
AddRandomUncommonDropItem(a_Drops, 8.5f, E_ITEM_STONE_SWORD, GetRandomProvider().RandInt<short>(50));
|
||||
|
||||
cItems RareDrops;
|
||||
RareDrops.Add(cItem(E_ITEM_HEAD, 1, 1));
|
||||
AddRandomRareDropItem(a_Drops, RareDrops, LootingLevel);
|
||||
|
||||
AddRandomDropItem(a_Drops, 0, 2 + LootingLevel, E_ITEM_BONE);
|
||||
AddRandomArmorDropItem(a_Drops, LootingLevel);
|
||||
AddRandomWeaponDropItem(a_Drops, LootingLevel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void cWitherSkeleton::SpawnOn(cClientHandle & a_ClientHandle)
|
||||
{
|
||||
super::SpawnOn(a_ClientHandle);
|
||||
a_ClientHandle.SendEntityEquipment(*this, 0, cItem(E_ITEM_STONE_SWORD));
|
||||
}
|
28
src/Mobs/WitherSkeleton.h
Normal file
28
src/Mobs/WitherSkeleton.h
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "AggressiveMonster.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class cWitherSkeleton :
|
||||
public cAggressiveMonster
|
||||
{
|
||||
typedef cAggressiveMonster super;
|
||||
|
||||
public:
|
||||
cWitherSkeleton(void);
|
||||
|
||||
CLASS_PROTODEF(cWitherSkeleton)
|
||||
|
||||
virtual bool Attack(std::chrono::milliseconds a_Dt) override;
|
||||
virtual void GetDrops(cItems & a_Drops, cEntity * a_Killer = nullptr) override;
|
||||
virtual void SpawnOn(cClientHandle & a_ClientHandle) override;
|
||||
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
|
@ -889,15 +889,6 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
||||
break;
|
||||
} // case mtSheep
|
||||
|
||||
case mtSkeleton:
|
||||
{
|
||||
auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
|
||||
a_Pkt.WriteBEUInt8(SKELETON_TYPE);
|
||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||
a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
||||
break;
|
||||
} // case mtSkeleton
|
||||
|
||||
case mtSlime:
|
||||
{
|
||||
auto & Slime = static_cast<const cSlime &>(a_Mob);
|
||||
@ -940,6 +931,14 @@ void cProtocol_1_10_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
||||
break;
|
||||
} // case mtWither
|
||||
|
||||
case mtWitherSkeleton:
|
||||
{
|
||||
a_Pkt.WriteBEUInt8(SKELETON_TYPE);
|
||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||
a_Pkt.WriteVarInt32(1); // Is wither skeleton
|
||||
break;
|
||||
} // case mtWitherSkeleton
|
||||
|
||||
case mtWolf:
|
||||
{
|
||||
auto & Wolf = static_cast<const cWolf &>(a_Mob);
|
||||
|
@ -573,6 +573,7 @@ UInt32 cProtocol_1_11_0::GetProtocolMobType(eMonsterType a_MobType)
|
||||
case mtVillager: return 120;
|
||||
case mtWitch: return 66;
|
||||
case mtWither: return 64;
|
||||
case mtWitherSkeleton: return 5;
|
||||
case mtWolf: return 95;
|
||||
case mtZombie: return 54;
|
||||
case mtZombiePigman: return 57;
|
||||
@ -1094,17 +1095,6 @@ void cProtocol_1_11_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_
|
||||
break;
|
||||
} // case mtSheep
|
||||
|
||||
case mtSkeleton:
|
||||
{
|
||||
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
|
||||
|
||||
// auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
|
||||
// a_Pkt.WriteBEUInt8(SKELETON_TYPE);
|
||||
// a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||
// a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
||||
break;
|
||||
} // case mtSkeleton
|
||||
|
||||
case mtSlime:
|
||||
{
|
||||
auto & Slime = static_cast<const cSlime &>(a_Mob);
|
||||
|
@ -815,17 +815,6 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
||||
break;
|
||||
} // case mtSheep
|
||||
|
||||
case mtSkeleton:
|
||||
{
|
||||
// XXX Skeletons are separate entities; all skeletons are currently treated as regular ones
|
||||
|
||||
// auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
|
||||
// a_Pkt.WriteBEUInt8(SKELETON_TYPE);
|
||||
// a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||
// a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
||||
break;
|
||||
} // case mtSkeleton
|
||||
|
||||
case mtSlime:
|
||||
{
|
||||
auto & Slime = static_cast<const cSlime &>(a_Mob);
|
||||
@ -954,7 +943,9 @@ void cProtocol_1_12::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_Mo
|
||||
|
||||
case mtGiant:
|
||||
case mtSilverfish:
|
||||
case mtSkeleton:
|
||||
case mtSquid:
|
||||
case mtWitherSkeleton:
|
||||
{
|
||||
// Mobs with no extra fields
|
||||
break;
|
||||
|
@ -430,6 +430,7 @@ UInt32 cProtocol_1_13::GetProtocolMobType(eMonsterType a_MobType)
|
||||
case mtVillager: return 79;
|
||||
case mtWitch: return 82;
|
||||
case mtWither: return 83;
|
||||
case mtWitherSkeleton: return 84;
|
||||
case mtWolf: return 86;
|
||||
case mtZombie: return 87;
|
||||
case mtZombiePigman: return 53;
|
||||
|
@ -1862,6 +1862,7 @@ UInt32 cProtocol_1_8_0::GetProtocolMobType(eMonsterType a_MobType)
|
||||
case mtVillager: return 120;
|
||||
case mtWitch: return 66;
|
||||
case mtWither: return 64;
|
||||
case mtWitherSkeleton: return 51;
|
||||
case mtWolf: return 95;
|
||||
case mtZombie: return 54;
|
||||
case mtZombiePigman: return 57;
|
||||
@ -3714,14 +3715,6 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
||||
break;
|
||||
} // case mtRabbit
|
||||
|
||||
case mtSkeleton:
|
||||
{
|
||||
auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
|
||||
a_Pkt.WriteBEUInt8(0x0d);
|
||||
a_Pkt.WriteBEUInt8(Skeleton.IsWither() ? 1 : 0);
|
||||
break;
|
||||
} // case mtSkeleton
|
||||
|
||||
case mtSlime:
|
||||
{
|
||||
auto & Slime = static_cast<const cSlime &>(a_Mob);
|
||||
@ -3758,6 +3751,13 @@ void cProtocol_1_8_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
||||
break;
|
||||
} // case mtWither
|
||||
|
||||
case mtWitherSkeleton:
|
||||
{
|
||||
a_Pkt.WriteBEUInt8(0x0d);
|
||||
a_Pkt.WriteBEUInt8(1); // Is wither skeleton
|
||||
break;
|
||||
} // case mtWitherSkeleton
|
||||
|
||||
case mtWolf:
|
||||
{
|
||||
auto & Wolf = static_cast<const cWolf &>(a_Mob);
|
||||
|
@ -1918,6 +1918,7 @@ UInt32 cProtocol_1_9_0::GetProtocolMobType(eMonsterType a_MobType)
|
||||
case mtVillager: return 120;
|
||||
case mtWitch: return 66;
|
||||
case mtWither: return 64;
|
||||
case mtWitherSkeleton: return 51;
|
||||
case mtWolf: return 95;
|
||||
case mtZombie: return 54;
|
||||
case mtZombiePigman: return 57;
|
||||
@ -4201,15 +4202,6 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
||||
break;
|
||||
} // case mtSheep
|
||||
|
||||
case mtSkeleton:
|
||||
{
|
||||
auto & Skeleton = static_cast<const cSkeleton &>(a_Mob);
|
||||
a_Pkt.WriteBEUInt8(11); // Index 11: Type
|
||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||
a_Pkt.WriteVarInt32(Skeleton.IsWither() ? 1 : 0);
|
||||
break;
|
||||
} // case mtSkeleton
|
||||
|
||||
case mtSlime:
|
||||
{
|
||||
auto & Slime = static_cast<const cSlime &>(a_Mob);
|
||||
@ -4252,6 +4244,14 @@ void cProtocol_1_9_0::WriteMobMetadata(cPacketizer & a_Pkt, const cMonster & a_M
|
||||
break;
|
||||
} // case mtWither
|
||||
|
||||
case mtWitherSkeleton:
|
||||
{
|
||||
a_Pkt.WriteBEUInt8(11); // Index 11: Type
|
||||
a_Pkt.WriteBEUInt8(METADATA_TYPE_VARINT);
|
||||
a_Pkt.WriteVarInt32(1); // Is wither skeleton
|
||||
break;
|
||||
} // case mtWitherSkeleton
|
||||
|
||||
case mtWolf:
|
||||
{
|
||||
auto & Wolf = static_cast<const cWolf &>(a_Mob);
|
||||
|
@ -895,7 +895,7 @@ void cWorld::InitializeAndLoadMobSpawningValues(cIniFile & a_IniFile)
|
||||
switch (m_Dimension)
|
||||
{
|
||||
case dimOverworld: DefaultMonsters = "bat, cavespider, chicken, cow, creeper, guardian, horse, mooshroom, ocelot, pig, rabbit, sheep, silverfish, skeleton, slime, spider, squid, wolf, zombie"; break; // TODO Re-add Enderman when bugs are fixed
|
||||
case dimNether: DefaultMonsters = "blaze, ghast, magmacube, skeleton, zombiepigman"; break;
|
||||
case dimNether: DefaultMonsters = "blaze, ghast, magmacube, witherskeleton, zombiepigman"; break;
|
||||
case dimEnd: DefaultMonsters = ""; break; // TODO Re-add Enderman when bugs are fixed
|
||||
case dimNotSet: ASSERT(!"Dimension not set"); break;
|
||||
}
|
||||
|
@ -738,6 +738,7 @@ public:
|
||||
case mtVillager: EntityClass = "Villager"; break;
|
||||
case mtWitch: EntityClass = "Witch"; break;
|
||||
case mtWither: EntityClass = "WitherBoss"; break;
|
||||
case mtWitherSkeleton: EntityClass = "WitherSkeleton"; break;
|
||||
case mtWolf: EntityClass = "Wolf"; break;
|
||||
case mtZombie: EntityClass = "Zombie"; break;
|
||||
case mtZombiePigman: EntityClass = "PigZombie"; break;
|
||||
@ -869,11 +870,6 @@ public:
|
||||
mWriter.AddInt("Size", static_cast<const cSlime *>(a_Monster)->GetSize());
|
||||
break;
|
||||
}
|
||||
case mtSkeleton:
|
||||
{
|
||||
mWriter.AddByte("SkeletonType", (static_cast<const cSkeleton *>(a_Monster)->IsWither() ? 1 : 0));
|
||||
break;
|
||||
}
|
||||
case mtVillager:
|
||||
{
|
||||
const cVillager *Villager = static_cast<const cVillager *>(a_Monster);
|
||||
@ -927,10 +923,12 @@ public:
|
||||
case mtIronGolem:
|
||||
case mtMooshroom:
|
||||
case mtSilverfish:
|
||||
case mtSkeleton:
|
||||
case mtSnowGolem:
|
||||
case mtSpider:
|
||||
case mtSquid:
|
||||
case mtWitch:
|
||||
case mtWitherSkeleton:
|
||||
{
|
||||
// Other mobs have no special tags.
|
||||
break;
|
||||
|
@ -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>();
|
||||
|
@ -228,6 +228,7 @@ protected:
|
||||
void LoadVillagerFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
|
||||
void LoadWitchFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
|
||||
void LoadWitherFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
|
||||
void LoadWitherSkeletonFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
|
||||
void LoadWolfFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
|
||||
void LoadZombieFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
|
||||
void LoadPigZombieFromNBT (cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx);
|
||||
|
Loading…
Reference in New Issue
Block a user