Skip to content

Commit

Permalink
Minions should not attack team players or players at all if PVP is di…
Browse files Browse the repository at this point in the history
…sabled

Close 1268
  • Loading branch information
maxanier committed Oct 15, 2023
1 parent 53fedef commit 720ebe7
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import de.teamlapen.vampirism.inventory.MinionContainer;
import de.teamlapen.vampirism.util.DamageHandler;
import de.teamlapen.vampirism.util.IPlayerOverlay;
import de.teamlapen.vampirism.util.Permissions;
import de.teamlapen.vampirism.util.PlayerSkinHelper;
import de.teamlapen.vampirism.world.MinionWorldData;
import net.minecraft.core.NonNullList;
Expand Down Expand Up @@ -118,7 +119,8 @@ protected MinionEntity(EntityType<? extends VampirismEntity> type, Level world,
this.hardAttackPredicate = livingEntity -> {
boolean flag1 = getLordOpt().map(ILordPlayer::getPlayer).filter(entity -> entity == livingEntity).isPresent(); //Don't attack lord
boolean flag2 = livingEntity instanceof MinionEntity && ((MinionEntity<?>) livingEntity).getLordID().filter(id -> getLordID().map(id2 -> id == id2).orElse(false)).isPresent(); //Don't attack other minions of lord
return !flag1 && !flag2;
boolean flag3 = livingEntity instanceof Player otherPlayer && getLordOpt().map(ILordPlayer::getPlayer).map(player -> !player.canHarmPlayer(otherPlayer)).orElse(!Permissions.isPvpEnabled(otherPlayer));
return !flag1 && !flag2 && !flag3;
};
setDontDropEquipment();
this.peaceful = true;
Expand Down

0 comments on commit 720ebe7

Please sign in to comment.