diff options
| -rw-r--r-- | Minecraft.World/EnderMan.cpp | 7 | ||||
| -rw-r--r-- | Minecraft.World/Monster.cpp | 9 |
2 files changed, 14 insertions, 2 deletions
diff --git a/Minecraft.World/EnderMan.cpp b/Minecraft.World/EnderMan.cpp index e1231818..da469a3a 100644 --- a/Minecraft.World/EnderMan.cpp +++ b/Minecraft.World/EnderMan.cpp @@ -410,9 +410,14 @@ bool EnderMan::hurt(DamageSource *source, float damage) if ( dynamic_cast<EntityDamageSource *>(source) != nullptr && source->getEntity()->instanceof(eTYPE_PLAYER)) { - aggroedByPlayer = true; + if (!dynamic_pointer_cast<Player>(source->getEntity())->abilities.invulnerable) + { + aggroedByPlayer = true; + } + else setCreepy(false); } + if (dynamic_cast<IndirectEntityDamageSource *>(source) != nullptr) { aggroedByPlayer = false; diff --git a/Minecraft.World/Monster.cpp b/Minecraft.World/Monster.cpp index 2de45315..ad19a36d 100644 --- a/Minecraft.World/Monster.cpp +++ b/Minecraft.World/Monster.cpp @@ -60,7 +60,14 @@ bool Monster::hurt(DamageSource *source, float dmg) if (sourceEntity != shared_from_this()) { - attackTarget = sourceEntity; + if (sourceEntity->instanceof(eTYPE_PLAYER)) + { + if (!dynamic_pointer_cast<Player>(sourceEntity)->abilities.invulnerable) + { + attackTarget = sourceEntity; + } + } + else attackTarget = sourceEntity; } return true; } |
