feat: Improve owner ally check in AllyDesignationSystem to handle null owners and recursion

This commit is contained in:
WinDanesz
2026-05-09 20:40:03 +02:00
parent f499fcaeff
commit 643ab1a1be
@@ -258,7 +258,10 @@ public final class AllyDesignationSystem {
WizardData data = WizardData.get(allyOf);
if(data == null) return false;
Entity owner = ownable.getOwner();
return owner instanceof EntityPlayer ? data.isPlayerAlly((EntityPlayer)owner) : data.isPlayerAlly(ownable.getOwnerId());
if(owner == null) return data.isPlayerAlly(ownable.getOwnerId()); // offline owner
if(owner instanceof EntityPlayer) return data.isPlayerAlly((EntityPlayer)owner);
if(owner instanceof IEntityOwnable) return isOwnerAlly(allyOf, (IEntityOwnable)owner); // recurse
return false;
}
@SubscribeEvent