类 BooleanAttribute
java.lang.Object
net.minecraft.world.entity.ai.attributes.Attribute
net.neoforged.neoforge.common.BooleanAttribute
- 所有已实现的接口:
IAttributeExtension
A boolean attribute only has two states, on or off, represented by a value of 0 (false) or 1 (true).
For boolean attributes, only use the following modifier values:
- A value of 1 with
AttributeModifier.Operation.ADD_VALUE
to enable the effect. - A value of -1 with
AttributeModifier.Operation.ADD_MULTIPLIED_TOTAL
to forcibly disable the effect.
Additionally, it permits forcibly disabling the effect through multiply total.
- API Note:
- Use of other operations and/or values will trigger undefined behavior, where no guarantees can be made if the attribute will be enabled or not.
-
嵌套类概要
从类继承的嵌套类/接口 net.minecraft.world.entity.ai.attributes.Attribute
Attribute.Sentiment
-
字段概要
从类继承的字段 net.minecraft.world.entity.ai.attributes.Attribute
CODEC, MERGED_BLUE, MERGED_GRAY, MERGED_RED, STREAM_CODEC
从接口继承的字段 net.neoforged.neoforge.common.extensions.IAttributeExtension
FORMAT
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明double
sanitizeValue
(double value) toComponent
(AttributeModifier modif, TooltipFlag flag) Converts an attribute modifier into its tooltip representation.toValueComponent
(@Nullable AttributeModifier.Operation op, double value, TooltipFlag flag) Converts the value of an attribute modifier to the value that will be displayed.从类继承的方法 net.minecraft.world.entity.ai.attributes.Attribute
getDefaultValue, getDescriptionId, getMergedStyle, getStyle, isClientSyncable, setSentiment, setSyncable
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
从接口继承的方法 net.neoforged.neoforge.common.extensions.IAttributeExtension
getBaseId, getDebugInfo, toBaseComponent
-
构造器详细资料
-
BooleanAttribute
-
-
方法详细资料
-
sanitizeValue
public double sanitizeValue(double value) - 覆盖:
sanitizeValue
在类中Attribute
-
toValueComponent
public MutableComponent toValueComponent(@Nullable @Nullable AttributeModifier.Operation op, double value, TooltipFlag flag) 从接口复制的说明:IAttributeExtension
Converts the value of an attribute modifier to the value that will be displayed.For multiplicative modifiers, this method is responsible for converting the value to percentage form.
- 参数:
op
- The operation of the modifier. Null if we are just displaying the raw value and not a modifier.value
- The value to convert. Either the current attribute value (if null operation) or the attribute modifier's amount.flag
- The tooltip flag.- 返回:
- The component form of the formatted value.
-
toComponent
从接口复制的说明:IAttributeExtension
Converts an attribute modifier into its tooltip representation.This method does not handle formatting of "base" modifiers, such as Attack Damage or Attack Speed.
The returned component may append additional debug information based on the tooltip flag.
- 参数:
modif
- The attribute modifier being converted to a component.flag
- The tooltip flag.- 返回:
- The component representation of the passed attribute modifier, with debug info appended if enabled.
-