Class EntityUtils

java.lang.Object
dev.sefiraat.sefilib.entity.EntityUtils

public final class EntityUtils extends Object
This class contains basic utility methods for entities.
  • Method Details

    • healEntity

      @ParametersAreNonnullByDefault public static void healEntity(LivingEntity livingEntity, double healAmount)
      Heal the entity by the provided amount
      Parameters:
      livingEntity - The LivingEntity to heal
      healAmount - 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 - The LivingEntity to damage
      player - The Player who damaged the entity
      damage - 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 - The LivingEntity to damage
      playerUUID - The UUID of the Player who damaged the entity
      damage - The amount of damage to deal
      knockbackOrigin - The Location of the knockback origin
      knockbackForce - 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
      Parameters:
      originatingPlayer - The UUID of the player who caused the pull
      pullToLocation - The Location to pull the entity to
      pushed - The Entity to pull
      force - The amount of force to apply
      Returns:
      Whether the entity was pulled or not
    • pushEntity

      @ParametersAreNonnullByDefault public static boolean pushEntity(UUID originatingPlayer, Location pushFromLocation, Entity pushed, double force)
      Pushes the entity by the provided amount
      Parameters:
      originatingPlayer - The UUID of the player who caused the push
      pushFromLocation - The Location to push the entity from
      pushed - The Entity to push
      force - The amount of force to apply
      Returns:
      Whether the entity was pushed or not
    • pushEntity

      @ParametersAreNonnullByDefault public static boolean pushEntity(UUID originatingPlayer, Vector vector, Entity pushed)
      Pushes the entity by the provided amount
      Parameters:
      originatingPlayer - The UUID of the player who caused the push
      vector - The Vector to push the entity by
      pushed - The Entity to push
      Returns:
      Whether the entity was pushed or not
    • getFacing

      public static double getFacing(@Nonnull Entity testEntity, @Nonnull Entity compareEntity)
      Checks if the tested entity is facing the comparing entity
      Parameters:
      testEntity - The entity to test
      compareEntity - The entity to compare to
      Returns:
      Whether the tested entity is facing the comparing entity
    • isFacingAway

      public static boolean isFacingAway(@Nonnull Entity testEntity, @Nonnull Entity compareEntity)
      Checks if the tested entity is NOT facing the comparing entity
      Parameters:
      testEntity - The entity to test
      compareEntity - 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 test
      compareEntity - The entity to compare to
      tolerance - The tolerance to use
      Returns:
      Whether the tested entity is NOT facing the comparing entity