Package dev.sefiraat.sefilib.entity
Class EntityUtils
java.lang.Object
dev.sefiraat.sefilib.entity.EntityUtils
This class contains basic utility methods for entities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleandamageEntity(LivingEntity livingEntity, UUID player, double damage) Damages the entity by the provided amountstatic booleandamageEntity(LivingEntity livingEntity, UUID playerUUID, double damage, Location knockbackOrigin, double knockbackForce) Damages the entity by the provided amountstatic doubleChecks if the tested entity is facing the comparing entitystatic voidhealEntity(LivingEntity livingEntity, double healAmount) Heal the entity by the provided amountstatic booleanisFacingAway(Entity testEntity, Entity compareEntity) Checks if the tested entity is NOT facing the comparing entitystatic booleanisFacingAway(Entity testEntity, Entity compareEntity, Integer tolerance) Checks if the tested entity is NOT facing the comparing entitystatic booleanpullEntity(UUID originatingPlayer, Location pullToLocation, Entity pushed, double force) Pulls the entity by the provided amountstatic booleanpushEntity(UUID originatingPlayer, Location pushFromLocation, Entity pushed, double force) Pushes the entity by the provided amountstatic booleanpushEntity(UUID originatingPlayer, Vector vector, Entity pushed) Pushes the entity by the provided amount
-
Method Details
-
healEntity
@ParametersAreNonnullByDefault public static void healEntity(LivingEntity livingEntity, double healAmount) Heal the entity by the provided amount- Parameters:
livingEntity- TheLivingEntityto healhealAmount- The amount to heal by
-
damageEntity
@ParametersAreNonnullByDefault public static boolean damageEntity(LivingEntity livingEntity, UUID player, double damage) Damages the entity by the provided amount- Parameters:
livingEntity- TheLivingEntityto damageplayer- ThePlayerwho damaged the entitydamage- The amount of damage to deal- Returns:
- Whether the entity was damaged or not
-
damageEntity
@ParametersAreNonnullByDefault public static boolean damageEntity(LivingEntity livingEntity, UUID playerUUID, double damage, @Nullable Location knockbackOrigin, double knockbackForce) Damages the entity by the provided amount- Parameters:
livingEntity- TheLivingEntityto damageplayerUUID- TheUUIDof thePlayerwho damaged the entitydamage- The amount of damage to dealknockbackOrigin- TheLocationof the knockback originknockbackForce- The amount of knockback to apply- Returns:
- Whether the entity was damaged or not
-
pullEntity
@ParametersAreNonnullByDefault public static boolean pullEntity(UUID originatingPlayer, Location pullToLocation, Entity pushed, double force) Pulls the entity by the provided amount -
pushEntity
@ParametersAreNonnullByDefault public static boolean pushEntity(UUID originatingPlayer, Location pushFromLocation, Entity pushed, double force) Pushes the entity by the provided amount -
pushEntity
@ParametersAreNonnullByDefault public static boolean pushEntity(UUID originatingPlayer, Vector vector, Entity pushed) Pushes the entity by the provided amount -
getFacing
Checks if the tested entity is facing the comparing entity- Parameters:
testEntity- The entity to testcompareEntity- The entity to compare to- Returns:
- Whether the tested entity is facing the comparing entity
-
isFacingAway
Checks if the tested entity is NOT facing the comparing entity- Parameters:
testEntity- The entity to testcompareEntity- The entity to compare to- Returns:
- Whether the tested entity is NOT facing the comparing entity
-
isFacingAway
public static boolean isFacingAway(@Nonnull Entity testEntity, @Nonnull Entity compareEntity, @Nullable Integer tolerance) Checks if the tested entity is NOT facing the comparing entity- Parameters:
testEntity- The entity to testcompareEntity- The entity to compare totolerance- The tolerance to use- Returns:
- Whether the tested entity is NOT facing the comparing entity
-