public class PotionEffect extends Object implements ConfigurationSerializable
LivingEntity. A
potion effect has a duration that it will last for, an amplifier that will
enhance its effects, and a PotionEffectType, that represents its
effect on an entity.| Constructor and Description |
|---|
PotionEffect(Map<String,Object> map)
Constructor for deserialization.
|
PotionEffect(PotionEffectType type,
int duration,
int amplifier)
Creates a potion effect.
|
PotionEffect(PotionEffectType type,
int duration,
int amplifier,
boolean ambient)
Creates a potion effect.
|
PotionEffect(PotionEffectType type,
int duration,
int amplifier,
boolean ambient,
boolean particles)
Creates a potion effect.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
apply(LivingEntity entity)
Attempts to add the effect represented by this object to the given
LivingEntity. |
boolean |
equals(Object obj) |
int |
getAmplifier()
Returns the amplifier of this effect.
|
int |
getDuration()
Returns the duration (in ticks) that this effect will run for when
applied to a
LivingEntity. |
PotionEffectType |
getType()
Returns the
PotionEffectType of this effect. |
int |
hashCode() |
boolean |
hasParticles() |
boolean |
isAmbient()
Makes potion effect produce more, translucent, particles.
|
Map<String,Object> |
serialize()
Creates a Map representation of this class.
|
String |
toString() |
public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles)
type - effect typeduration - measured in ticks, see getDuration()amplifier - the amplifier, see getAmplifier()ambient - the ambient status, see isAmbient()particles - the particle status, see hasParticles()public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient)
type - effect typeduration - measured in ticks, see getDuration()amplifier - the amplifier, see getAmplifier()ambient - the ambient status, see isAmbient()public PotionEffect(PotionEffectType type, int duration, int amplifier)
type - Effect typeduration - measured in ticksamplifier - the amplifier for the effectPotionEffect(PotionEffectType, int, int, boolean)public Map<String,Object> serialize()
ConfigurationSerializable
This class must provide a method to restore this class, as defined in
the ConfigurationSerializable interface javadocs.
serialize in interface ConfigurationSerializablepublic boolean apply(LivingEntity entity)
LivingEntity.entity - The entity to add this effect toLivingEntity.addPotionEffect(PotionEffect)public int getAmplifier()
public int getDuration()
LivingEntity.public PotionEffectType getType()
PotionEffectType of this effect.public boolean isAmbient()
public boolean hasParticles()
Copyright © 2015. All rights reserved.