mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-12 00:39:25 +00:00
swapped isAttackable function for isInvulnerable function in Player class; Also added isInvulnerable check to wolf agro function
This commit is contained in:
parent
909c8fd04f
commit
4e3fec0d97
|
|
@ -105,7 +105,7 @@ shared_ptr<Entity> PigZombie::findAttackTarget()
|
|||
bool PigZombie::hurt(DamageSource *source, float dmg)
|
||||
{
|
||||
shared_ptr<Entity> sourceEntity = source->getEntity();
|
||||
if ( sourceEntity != nullptr && sourceEntity->instanceof(eTYPE_PLAYER) && sourceEntity->isAttackable())
|
||||
if ( sourceEntity != nullptr && sourceEntity->instanceof(eTYPE_PLAYER) && !sourceEntity->isInvulnerable())
|
||||
{
|
||||
vector<shared_ptr<Entity> > *nearby = level->getEntities( shared_from_this(), bb->grow(32, 32, 32));
|
||||
for (auto& e : *nearby)
|
||||
|
|
|
|||
|
|
@ -195,9 +195,9 @@ bool Player::isUsingItem()
|
|||
return useItem != nullptr;
|
||||
}
|
||||
|
||||
bool Player::isAttackable()
|
||||
bool Player::isInvulnerable()
|
||||
{
|
||||
return !abilities.invulnerable;
|
||||
return abilities.invulnerable || hasInvulnerablePrivilege();
|
||||
}
|
||||
|
||||
int Player::getTicksUsingItem()
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ public:
|
|||
void setPlayerGamePrivilege(EPlayerGamePrivileges privilege, unsigned int value);
|
||||
static void setPlayerGamePrivilege(unsigned int &uiGamePrivileges, EPlayerGamePrivileges privilege, unsigned int value);
|
||||
|
||||
virtual bool isAttackable();
|
||||
virtual bool isInvulnerable();
|
||||
|
||||
bool isAllowedToUse(Tile *tile);
|
||||
bool isAllowedToUse(shared_ptr<ItemInstance> item);
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ bool Wolf::hurt(DamageSource *source, float dmg)
|
|||
if (isTame())
|
||||
{
|
||||
shared_ptr<Entity> entity = source->getDirectEntity();
|
||||
if (entity != nullptr && entity->instanceof(eTYPE_PLAYER))
|
||||
if (entity != nullptr && entity->instanceof(eTYPE_PLAYER) && !entity->isInvulnerable())
|
||||
{
|
||||
shared_ptr<Player> attacker = dynamic_pointer_cast<Player>(entity);
|
||||
attacker->canHarmPlayer(getOwnerUUID());
|
||||
|
|
|
|||
Loading…
Reference in a new issue