Package com.binaris.wizardry.core
Class AllyDesignation
java.lang.Object
com.binaris.wizardry.core.AllyDesignation
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanisAllied(net.minecraft.world.entity.LivingEntity allyOf, net.minecraft.world.entity.Entity possibleAlly) Covers bothisPlayerAlly(Player, Player)andisOwnerAlly(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 booleanisMinionAlly(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 booleanisOwnerAlly(net.minecraft.world.entity.player.Player allyOf, net.minecraft.world.entity.OwnableEntity ownable) Helper method for testing if the givenOwnableEntity's owner is an ally of the given player.static booleanisPlayerAlly(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 booleanisValidTarget(@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 voidonLivingHurt(EBLivingHurtEvent event) Called whenever an entity is hurt.
-
Method Details
-
isAllied
public static boolean isAllied(net.minecraft.world.entity.LivingEntity allyOf, net.minecraft.world.entity.Entity possibleAlly) Covers bothisPlayerAlly(Player, Player)andisOwnerAlly(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 minionpossibleAlly- 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
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 givenOwnableEntity's owner is an ally of the given player. This works even when the owner is not logged in.
-