类 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) 创建一个药水效果. -
方法概要
修饰符和类型方法说明booleanapply(@NotNull LivingEntity entity) 尝试添加此效果到指定的生物上.booleanint返回此效果的倍率.getColor()已过时。现在粒子效果颜色不属于药水效果的一部分int返回此效果的持续时间 (单位为tick).getType()返回此效果的类型.inthashCode()booleanhasIcon()booleanboolean此状态使药水效果产生更多的、半透明的粒子.boolean返回此药水效果是否具有无限持续时间.booleanisShorterThan(@NotNull PotionEffect other) 返回此药水效果的持续时间是否比提供的药水效果短.创建此类的 Map 表示。toString()
-
字段详细资料
-
INFINITE_DURATION
public static final int INFINITE_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创建此类的 Map 表示。此类必须提供一个方法来恢复此类,具体定义见
ConfigurationSerializable接口的 javadoc。原文:Creates a Map representation of this class.
This class must provide a method to restore this class, as defined in the
ConfigurationSerializableinterface javadocs.- 指定者:
serialize在接口中ConfigurationSerializable- 返回:
- 包含此类当前状态的 Map
-
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.
- 返回:
- 此持续时间是否为无限
-
isShorterThan
返回此药水效果的持续时间是否比提供的药水效果短.无限持续时间被认为比非无限持续时间长. 如果两个药水效果都具有无限持续时间, 则两者都不比对方短, 此方法将返回 false.
原文: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- 另一个效果- 返回:
- 如果此效果比另一个短则为 true, 如果更长或相等则为 false
-
getType
返回此效果的类型.原文:Returns the
PotionEffectTypeof 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
-