Class WbsEntityUtil

java.lang.Object
wbs.utils.util.entities.WbsEntityUtil

public final class WbsEntityUtil extends Object
  • Method Summary

    Modifier and Type
    Method
    Description
    static boolean
    blink(org.bukkit.entity.Entity entity, double distance)
    Teleports the entity a given distance in the direction they're looking, ensuring a safe landing (cannot land in non-solid blocks)
    static boolean
    canSeeSky(org.bukkit.entity.Entity entity)
     
    static void
    damage(org.bukkit.entity.Damageable target, double damage, org.bukkit.entity.LivingEntity attacker)
    Make the specified player deal damage to a living entity.
    static @NotNull org.bukkit.util.Vector
    getFacingVector(org.bukkit.entity.Entity entity)
    Gets a unit vector in the direction the entity is facing
    static @NotNull org.bukkit.util.Vector
    getFacingVector(org.bukkit.entity.Entity entity, double magnitude)
    Gets a vector in the direction the entity is facing scaled to the given magnitude
    static @Nullable org.bukkit.inventory.ItemStack
    getItemInSlot(org.bukkit.entity.LivingEntity entity, org.bukkit.inventory.EquipmentSlot slot)
     
    static @NotNull org.bukkit.util.Vector
    getLocalUp(org.bukkit.entity.Entity entity)
     
    static @NotNull org.bukkit.Location
    getMiddleLocation(org.bukkit.entity.Entity target)
    Get the location half way up a mob
    static @Nullable org.bukkit.Location
    getTargetPos(org.bukkit.entity.LivingEntity entity, double range)
    Gets the location at the block the entity is looking at.
    static boolean
    heal(org.bukkit.entity.LivingEntity entity, double toHeal)
    Heal the target LivingEntity safely, taking into account max health
    static boolean
    isInMaterial(org.bukkit.entity.Entity entity, org.bukkit.Material type)
     
    static boolean
    isInWater(org.bukkit.entity.Entity entity)
     
    static void
    push(org.bukkit.entity.Entity entity, double speed)
    Pushes the entity in the direction they're facing at a given speed

    Methods inherited from class java.lang.Object

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

    • canSeeSky

      public static boolean canSeeSky(org.bukkit.entity.Entity entity)
    • isInMaterial

      public static boolean isInMaterial(org.bukkit.entity.Entity entity, org.bukkit.Material type)
    • isInWater

      public static boolean isInWater(org.bukkit.entity.Entity entity)
    • getTargetPos

      @Nullable public static @Nullable org.bukkit.Location getTargetPos(org.bukkit.entity.LivingEntity entity, double range)
      Gets the location at the block the entity is looking at.
      Parameters:
      range - The maximum distance away from the entity the block may be
      Returns:
      The target location. null if there was no block in range
    • getFacingVector

      @NotNull public static @NotNull org.bukkit.util.Vector getFacingVector(org.bukkit.entity.Entity entity)
      Gets a unit vector in the direction the entity is facing
      Returns:
      The facing vector
    • getFacingVector

      @NotNull public static @NotNull org.bukkit.util.Vector getFacingVector(org.bukkit.entity.Entity entity, double magnitude)
      Gets a vector in the direction the entity is facing scaled to the given magnitude
      Parameters:
      magnitude - The scale of the resulting vector
      Returns:
      The facing vector
    • getLocalUp

      @NotNull public static @NotNull org.bukkit.util.Vector getLocalUp(org.bukkit.entity.Entity entity)
    • push

      public static void push(org.bukkit.entity.Entity entity, double speed)
      Pushes the entity in the direction they're facing at a given speed
      Parameters:
      speed - The new speed
      entity - The entity to push
    • blink

      public static boolean blink(org.bukkit.entity.Entity entity, double distance)
      Teleports the entity a given distance in the direction they're looking, ensuring a safe landing (cannot land in non-solid blocks)
      Parameters:
      distance - The distance to teleport
      Returns:
      true if the blink was successful, false if there was no safe landing spot found
    • damage

      public static void damage(org.bukkit.entity.Damageable target, double damage, org.bukkit.entity.LivingEntity attacker)
      Make the specified player deal damage to a living entity.

      This method uses Damageable.damage(double, Entity), except it works on Ender Dragons because they're awful to work with.

      Parameters:
      target - The entity to damage
      damage - The amount of damage to deal
      attacker - The attacking entity to deal the damage. Nullable.
    • heal

      public static boolean heal(org.bukkit.entity.LivingEntity entity, double toHeal)
      Heal the target LivingEntity safely, taking into account max health
      Parameters:
      entity - The entity to heal
      toHeal - The amount to heal
      Returns:
      True if the entity was healed, false if already at max health
    • getMiddleLocation

      @NotNull public static @NotNull org.bukkit.Location getMiddleLocation(org.bukkit.entity.Entity target)
      Get the location half way up a mob
      Parameters:
      target - The target mob
      Returns:
      The location half way up the given mob.
    • getItemInSlot

      @Nullable public static @Nullable org.bukkit.inventory.ItemStack getItemInSlot(org.bukkit.entity.LivingEntity entity, org.bukkit.inventory.EquipmentSlot slot)