Class EntityUtils

java.lang.Object
net.glowstone.util.EntityUtils

public class EntityUtils extends Object
Utility methods for dealing with entities.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    applyPotionEffectWithIntensity(@NotNull org.bukkit.potion.PotionEffect effect, org.bukkit.entity.LivingEntity target, double instantIntensity, double durationIntensity)
    Applies a potion effect with an intensity ranging from 0.0 for no effect to 1.0 for full effect.
    static boolean
    heal(@NotNull org.bukkit.entity.LivingEntity target, double amount, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason)
    Heals an entity by a specific amount.
    static void
    refresh(@NotNull GlowEntity entity)
    Refreshes the entity for nearby clients.

    Methods inherited from class java.lang.Object

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

    • EntityUtils

      public EntityUtils()
  • Method Details

    • heal

      public static boolean heal(@NotNull @NotNull org.bukkit.entity.LivingEntity target, double amount, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason)
      Heals an entity by a specific amount.
      Parameters:
      target - the entity to heal
      amount - the amount of health to regain
      reason - the reason supplied to the EntityRegainHealthEvent
      Returns:
      whether any health was regained this way
      Throws:
      IllegalArgumentException - if the specified target has no Attribute.GENERIC_MAX_HEALTH
    • applyPotionEffectWithIntensity

      public static void applyPotionEffectWithIntensity(@NotNull @NotNull org.bukkit.potion.PotionEffect effect, org.bukkit.entity.LivingEntity target, double instantIntensity, double durationIntensity)
      Applies a potion effect with an intensity ranging from 0.0 for no effect to 1.0 for full effect. Intensity above 1.0 has no additional effect, with the exceptions of PotionEffectType.HEAL and PotionEffectType.HARM, and negative intensity has no effect.
      Parameters:
      effect - the effect
      target - the target to apply the effect to
      instantIntensity - the intensity multiplier if the effect is instantaneous
      durationIntensity - the duration multiplier if the effect has a duration
    • refresh

      public static void refresh(@NotNull @NotNull GlowEntity entity)
      Refreshes the entity for nearby clients.

      This will first destroy, and then spawn the painting again using its current art and facing value.

      Parameters:
      entity - the entity to refresh.