Class AllyDesignation

java.lang.Object
com.binaris.wizardry.core.AllyDesignation

public final class AllyDesignation extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    isAllied(net.minecraft.world.entity.LivingEntity allyOf, net.minecraft.world.entity.Entity possibleAlly)
    Covers both isPlayerAlly(Player, Player) and isOwnerAlly(Player, OwnableEntity), returning true if the second entity is either owned by the first entity, an ally of the first entity, or owned by an ally of the first entity.
    static boolean
    isMinionAlly(net.minecraft.world.entity.LivingEntity allyOf, net.minecraft.world.entity.Mob possibleAlly)
    Checks if the given mob has any minion relation with the given allyOf.
    static boolean
    isOwnerAlly(net.minecraft.world.entity.player.Player allyOf, net.minecraft.world.entity.OwnableEntity ownable)
    Helper method for testing if the given OwnableEntity's owner is an ally of the given player.
    static boolean
    isPlayerAlly(net.minecraft.world.entity.player.Player allyOf, net.minecraft.world.entity.player.Player possibleAlly)
    Helper method for testing if two players are allies of each other according to the given player's data.
    static boolean
    isValidTarget(@Nullable net.minecraft.world.entity.Entity attacker, @Nullable net.minecraft.world.entity.Entity target)
    Returns whether the given target can be damaged by the given attacker.
    static void
    Called whenever an entity is hurt.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • isAllied

      public static boolean isAllied(net.minecraft.world.entity.LivingEntity allyOf, net.minecraft.world.entity.Entity possibleAlly)
      Covers both isPlayerAlly(Player, Player) and isOwnerAlly(Player, OwnableEntity), returning true if the second entity is either owned by the first entity, an ally of the first entity, or owned by an ally of the first entity. This is generally used to determine targets for healing or other group buffs.
    • isMinionAlly

      public static boolean isMinionAlly(net.minecraft.world.entity.LivingEntity allyOf, net.minecraft.world.entity.Mob possibleAlly)
      Checks if the given mob has any minion relation with the given allyOf. Seeing if the mob is actually a minion owned by the allyOf or if the mob is a minion owned by an ally of the allyOf. All this checks made by the minion data.
      Parameters:
      allyOf - the entity that could be the owner or ally of the owner of the minion
      possibleAlly - mob that could be a minion of the allyOf or an ally of the allyOf
      Returns:
      true if the mob is a minion of the allyOf or an ally of the allyOf, false otherwise
    • isValidTarget

      public static boolean isValidTarget(@Nullable @Nullable net.minecraft.world.entity.Entity attacker, @Nullable @Nullable net.minecraft.world.entity.Entity target)
      Returns whether the given target can be damaged by the given attacker. It is up to the caller of this method to work out what this means; it doesn't necessarily mean the target is completely immune (for example, revenge targeting might reasonably bypass this). This method is intended for use where the damage is indirect and/or unavoidable, such as from spells or environmental hazards.
    • onLivingHurt

      public static void onLivingHurt(EBLivingHurtEvent event)
      Called whenever an entity is hurt. Cancels the event if the source is magic damage from a player and the damaged entity is an ally of that player, according to the config settings. This includes owned entities.
    • isPlayerAlly

      public static boolean isPlayerAlly(net.minecraft.world.entity.player.Player allyOf, net.minecraft.world.entity.player.Player possibleAlly)
      Helper method for testing if two players are allies of each other according to the given player's data.
    • isOwnerAlly

      public static boolean isOwnerAlly(net.minecraft.world.entity.player.Player allyOf, net.minecraft.world.entity.OwnableEntity ownable)
      Helper method for testing if the given OwnableEntity's owner is an ally of the given player. This works even when the owner is not logged in.