fix: Prevent mobs from targeting players in creative mode

Mobs were incorrectly targeting and attacking players who are in
creative mode (invulnerable).
This commit is contained in:
George V.
2026-04-18 20:29:47 +03:00
parent 7ee7588364
commit eabde3527c
3 changed files with 24 additions and 1 deletions
+5
View File
@@ -37,6 +37,11 @@ bool TargetGoal::canContinueToUse()
if (target == nullptr) return false;
if (!target->isAlive()) return false;
if (target->instanceof(eTYPE_PLAYER)) {
shared_ptr<Player> player = dynamic_pointer_cast<Player>(target);
if (player->abilities.invulnerable) return false;
}
double within = getFollowDistance();
if (mob->distanceToSqr(target) > within * within) return false;
if (mustSee)