ConfigurationSerializable
public class PotionEffect extends java.lang.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 | Description |
---|---|
PotionEffect(java.util.Map<java.lang.String,java.lang.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 with no defined color.
|
PotionEffect(PotionEffectType type,
int duration,
int amplifier,
boolean ambient,
boolean particles,
boolean icon) |
Creates a potion effect.
|
Modifier and Type | Method | Description |
---|---|---|
boolean |
apply(LivingEntity entity) |
Attempts to add the effect represented by this object to the given
LivingEntity . |
boolean |
equals(java.lang.Object obj) |
|
int |
getAmplifier() |
Returns the amplifier of this effect.
|
Color |
getColor() |
Deprecated.
color is not part of potion effects
|
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 |
hasIcon() |
|
boolean |
hasParticles() |
|
boolean |
isAmbient() |
Makes potion effect produce more, translucent, particles.
|
java.util.Map<java.lang.String,java.lang.Object> |
serialize() |
Creates a Map representation of this class.
|
java.lang.String |
toString() |
public PotionEffect(PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon)
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()
icon
- the icon status, see hasIcon()
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 PotionEffect(java.util.Map<java.lang.String,java.lang.Object> map)
map
- the map to deserialize frompublic java.util.Map<java.lang.String,java.lang.Object> serialize()
ConfigurationSerializable
This class must provide a method to restore this class, as defined in
the ConfigurationSerializable
interface javadocs.
serialize
in interface ConfigurationSerializable
public boolean apply(LivingEntity entity)
LivingEntity
.entity
- The entity to add this effect toLivingEntity.addPotionEffect(PotionEffect)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int getAmplifier()
public int getDuration()
LivingEntity
.public PotionEffectType getType()
PotionEffectType
of this effect.public boolean isAmbient()
public boolean hasParticles()
@Deprecated public Color getColor()
public boolean hasIcon()
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2018. All rights reserved.