mirror of
https://github.com/neoStudiosLCE/neoLegacy.git
synced 2026-06-08 23:13:00 +00:00
feat(TU31): Villagers turn into witches when struck by lightning (#83)
* Villagers turn into witches when struck by lightning * fix: include statement for if a villager has a custom nametag * fix: fix unneccesary line * Build fix --------- Co-authored-by: piebot <274605694+pieeebot@users.noreply.github.com>
This commit is contained in:
parent
4cb96bcb44
commit
d36a027e00
|
|
@ -156,7 +156,7 @@ bool Villager::mobInteract(shared_ptr<Player> player)
|
|||
shared_ptr<ItemInstance> item = player->inventory->getSelected();
|
||||
bool holdingSpawnEgg = item != nullptr && item->id == Item::spawnEgg_Id;
|
||||
|
||||
if (!holdingSpawnEgg && isAlive() && !isTrading() && !isBaby())
|
||||
if (!player->isSneaking() && !holdingSpawnEgg && isAlive() && !isTrading() && !isBaby())
|
||||
{
|
||||
if (!level->isClientSide)
|
||||
{
|
||||
|
|
@ -776,3 +776,19 @@ wstring Villager::getDisplayName()
|
|||
};
|
||||
return app.GetString(name);
|
||||
}
|
||||
|
||||
void Villager::thunderHit(const LightningBolt *lightningBolt)
|
||||
{
|
||||
if (level->isClientSide) return;
|
||||
shared_ptr<Witch> witch = std::make_shared<Witch>(level);
|
||||
witch->moveTo(x, y, z, yRot, xRot);
|
||||
|
||||
if (this->hasCustomName())
|
||||
witch->setCustomName(this->getCustomName());
|
||||
|
||||
if (this->isPersistenceRequired())
|
||||
witch->setPersistenceRequired();
|
||||
|
||||
level->addEntity(witch);
|
||||
remove();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,4 +147,5 @@ public:
|
|||
virtual shared_ptr<AgableMob> getBreedOffspring(shared_ptr<AgableMob> target);
|
||||
virtual bool canBeLeashed();
|
||||
virtual wstring getDisplayName();
|
||||
virtual void thunderHit(const LightningBolt *lightningBolt);
|
||||
};
|
||||
Loading…
Reference in a new issue