ConfigurationSerializablepublic 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 | 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 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(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.
|
Map<String,Object> |
serialize() |
Creates a Map representation of this class.
|
String |
toString() |
|
PotionEffect |
withAmbient(boolean ambient) |
|
PotionEffect |
withAmplifier(int amplifier) |
|
PotionEffect |
withDuration(int duration) |
|
PotionEffect |
withIcon(boolean icon) |
|
PotionEffect |
withParticles(boolean particles) |
|
PotionEffect |
withType(PotionEffectType type) |
public PotionEffect(@NotNull
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(@NotNull
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(@NotNull
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(@NotNull
PotionEffectType type,
int duration,
int amplifier)
type - Effect typeduration - measured in ticksamplifier - the amplifier for the effectPotionEffect(PotionEffectType, int, int, boolean)@NotNull public PotionEffect withType(@NotNull PotionEffectType type)
@NotNull public PotionEffect withDuration(int duration)
@NotNull public PotionEffect withAmplifier(int amplifier)
@NotNull public PotionEffect withAmbient(boolean ambient)
@NotNull public PotionEffect withParticles(boolean particles)
@NotNull public PotionEffect withIcon(boolean icon)
@NotNull 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(@NotNull
LivingEntity entity)
LivingEntity.entity - The entity to add this effect toLivingEntity.addPotionEffect(PotionEffect)public int getAmplifier()
public int getDuration()
LivingEntity.@NotNull public PotionEffectType getType()
PotionEffectType of this effect.public boolean isAmbient()
public boolean hasParticles()
@Deprecated @Nullable @Contract("-> null") public Color getColor()
public boolean hasIcon()
Copyright © 2020. All rights reserved.