mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-05-12 17:00:36 +00:00
fixed zombie pigmen attacking player in creative mode
This commit is contained in:
parent
a195ac7172
commit
909c8fd04f
|
|
@ -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->isAttackable())
|
||||
{
|
||||
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::isAttackable()
|
||||
{
|
||||
return !abilities.invulnerable;
|
||||
}
|
||||
|
||||
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 isAttackable();
|
||||
|
||||
bool isAllowedToUse(Tile *tile);
|
||||
bool isAllowedToUse(shared_ptr<ItemInstance> item);
|
||||
bool isAllowedToInteract(shared_ptr<Entity> target);
|
||||
|
|
|
|||
Loading…
Reference in a new issue