类 PotionEffect
- 所有已实现的接口:
ConfigurationSerializable
LivingEntity
.
药水效果有持续时长、倍率、作用于实体上的效果类型
属性.-
字段概要
-
构造器概要
构造器说明PotionEffect
(@NotNull Map<String, Object> map) 用于反序列化的构造器.PotionEffect
(@NotNull PotionEffectType type, int duration, int amplifier) 创建一个药水效果, 使 ambient 为 true.PotionEffect
(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient) 创建一个药水效果, 使粒子效果可见.PotionEffect
(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles) 创建一个药水效果, 不定义粒子颜色.PotionEffect
(@NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) 创建一个药水效果. -
方法概要
修饰符和类型方法说明boolean
apply
(@NotNull LivingEntity entity) 尝试添加此效果到指定的生物
上.boolean
int
返回此效果的倍率.getColor()
已过时。现在粒子效果颜色不属于药水效果的一部分int
返回此效果的持续时间 (单位为tick).getType()
返回此效果的类型.int
hashCode()
boolean
hasIcon()
boolean
boolean
此状态使药水效果产生更多的、半透明的粒子.boolean
Returns whether or not this potion effect has an infinite duration.boolean
isShorterThan
(@NotNull PotionEffect other) Returns whether or not this potion effect has a shorter duration than the provided potion effect.Creates a Map representation of this class.toString()
-
字段详细资料
-
INFINITE_DURATION
public static final int INFINITE_DURATIONA constant denoting infinite potion duration.- 另请参阅:
-
-
构造器详细资料
-
PotionEffect
public PotionEffect(@NotNull @NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles, boolean icon) 创建一个药水效果.原文:Creates a potion effect.
- 参数:
type
- 效果类型duration
- 持续时长 (单位为tick), 见getDuration()
amplifier
- 效果倍率, 见getAmplifier()
ambient
- ambient 状态, 见isAmbient()
particles
- 粒子可见性, 见hasParticles()
icon
- 图标可见性, 见hasIcon()
-
PotionEffect
public PotionEffect(@NotNull @NotNull PotionEffectType type, int duration, int amplifier, boolean ambient, boolean particles) 创建一个药水效果, 不定义粒子颜色.原文:Creates a potion effect with no defined color.
- 参数:
type
- 效果类型duration
- 持续时长 (单位为tick), 见getDuration()
amplifier
- 效果倍率, 见getAmplifier()
ambient
- ambient 状态, 见isAmbient()
particles
- 粒子可见性, 见hasParticles()
-
PotionEffect
public PotionEffect(@NotNull @NotNull PotionEffectType type, int duration, int amplifier, boolean ambient) 创建一个药水效果, 使粒子效果可见.原文:Creates a potion effect. Assumes that particles are visible
- 参数:
type
- 效果类型duration
- 持续时长 (单位为tick), 见getDuration()
amplifier
- 效果倍率, 见getAmplifier()
ambient
- ambient 状态, 见isAmbient()
-
PotionEffect
创建一个药水效果, 使 ambient 为 true.原文:Creates a potion effect. Assumes ambient is true.
- 参数:
type
- 效果类型duration
- 持续时长 (单位为tick)amplifier
- 效果倍率- 另请参阅:
-
PotionEffect
用于反序列化的构造器.原文:Constructor for deserialization.
- 参数:
map
- 反序列化使用的map
-
-
方法详细资料
-
serialize
从接口复制的说明:ConfigurationSerializable
Creates a Map representation of this class.This class must provide a method to restore this class, as defined in the
ConfigurationSerializable
interface javadocs.- 指定者:
serialize
在接口中ConfigurationSerializable
- 返回:
- Map containing the current state of this class
-
apply
尝试添加此效果到指定的生物
上.原文:Attempts to add the effect represented by this object to the given
LivingEntity
.- 参数:
entity
- 效果施加实体对象- 返回:
- 效果是否可添加/添加成功
- 另请参阅:
-
equals
-
getAmplifier
public int getAmplifier()返回此效果的倍率. 更高的倍率意味着此药水效果在其作用时间内作用更频繁, 或者对目标有更多(更强)的效果.原文:Returns the amplifier of this effect. A higher amplifier means the potion effect happens more often over its duration and in some cases has more effect on its target.
- 返回:
- 效果倍率
-
getDuration
public int getDuration()返回此效果的持续时间 (单位为tick).原文:Returns the duration (in ticks) that this effect will run for when applied to a
LivingEntity
.- 返回:
- 效果持续时间, 如果效果持续时间无限, 则为-1
- 另请参阅:
-
isInfinite
public boolean isInfinite()Returns whether or not this potion effect has an infinite duration. Potion effects with infinite durations will display an infinite symbol and never expire unless manually removed.- 返回:
- whether this duration is infinite or not
-
isShorterThan
Returns whether or not this potion effect has a shorter duration than the provided potion effect.An infinite duration is considered longer than non-infinite durations. If both potion effects have infinite durations, then neither is shorter than the other and this method will return false.
- 参数:
other
- the other effect- 返回:
- true if this effect is shorter than the other, false if longer or equal
-
getType
返回此效果的类型.原文:Returns the
PotionEffectType
of this effect.- 返回:
- 药水效果的类型
-
isAmbient
public boolean isAmbient()此状态使药水效果产生更多的、半透明的粒子.原文:Makes potion effect produce more, translucent, particles.
- 返回:
- 此药水效果是否为环境型效果 (译注:比如信标产生的效果)
-
hasParticles
public boolean hasParticles()- 返回:
- 此效果是否有粒子效果
-
getColor
已过时。现在粒子效果颜色不属于药水效果的一部分- 返回:
- 药水效果粒子的颜色. 如果无粒子效果/未定义颜色, 将可能为null
-
hasIcon
public boolean hasIcon()- 返回:
- 此效果是否有图标
-
hashCode
public int hashCode() -
toString
-