mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-17 04:22:53 +00:00
Merge cc910b9b7b into 5e5b685c72
This commit is contained in:
commit
241f022ee2
|
|
@ -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) )
|
||||
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,6 +195,11 @@ bool Player::isUsingItem()
|
|||
return useItem != nullptr;
|
||||
}
|
||||
|
||||
bool Player::isInvulnerable()
|
||||
{
|
||||
return abilities.invulnerable || hasInvulnerablePrivilege();
|
||||
}
|
||||
|
||||
int Player::getTicksUsingItem()
|
||||
{
|
||||
if (isUsingItem())
|
||||
|
|
|
|||
|
|
@ -495,6 +495,8 @@ public:
|
|||
void setPlayerGamePrivilege(EPlayerGamePrivileges privilege, unsigned int value);
|
||||
static void setPlayerGamePrivilege(unsigned int &uiGamePrivileges, EPlayerGamePrivileges privilege, unsigned int value);
|
||||
|
||||
virtual bool isInvulnerable();
|
||||
|
||||
bool isAllowedToUse(Tile *tile);
|
||||
bool isAllowedToUse(shared_ptr<ItemInstance> item);
|
||||
bool isAllowedToInteract(shared_ptr<Entity> target);
|
||||
|
|
|
|||
Loading…
Reference in a new issue