Package net.glowstone.util
Class EntityUtils
java.lang.Object
net.glowstone.util.EntityUtils
Utility methods for dealing with entities.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyPotionEffectWithIntensity(@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 booleanheal(@NotNull org.bukkit.entity.LivingEntity target, double amount, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason reason) Heals an entity by a specific amount.static voidrefresh(@NotNull GlowEntity entity) Refreshes the entity for nearby clients.
-
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 healamount- the amount of health to regainreason- the reason supplied to theEntityRegainHealthEvent- Returns:
- whether any health was regained this way
- Throws:
IllegalArgumentException- if the specified target has noAttribute.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 ofPotionEffectType.HEALandPotionEffectType.HARM, and negative intensity has no effect.- Parameters:
effect- the effecttarget- the target to apply the effect toinstantIntensity- the intensity multiplier if the effect is instantaneousdurationIntensity- the duration multiplier if the effect has a duration
-
refresh
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.
-