类 PercentageAttribute
java.lang.Object
net.minecraft.world.entity.ai.attributes.Attribute
net.minecraft.world.entity.ai.attributes.RangedAttribute
net.neoforged.neoforge.common.PercentageAttribute
- 所有已实现的接口:
IAttributeExtension
A Percentage Attribute is one which always displays modifiers as percentages, including for
AttributeModifier.Operation.ADD_VALUE
.
This is used for attributes that would not make sense being displayed as flat additions (ex: +0.05 Swim Speed).
-
嵌套类概要
从类继承的嵌套类/接口 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
-
构造器概要
构造器构造器说明PercentageAttribute
(String pDescriptionId, double pDefaultValue, double pMin, double pMax) Creates a new PercentageAttribute with the default scale factor of 100.PercentageAttribute
(String pDescriptionId, double pDefaultValue, double pMin, double pMax, double scaleFactor) Creates a new PercentageAttribute with the given description, value information, and scale factor. -
方法概要
修饰符和类型方法说明toValueComponent
(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.RangedAttribute
getMaxValue, getMinValue, sanitizeValue
从类继承的方法 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, toComponent
-
字段详细资料
-
scaleFactor
protected final double scaleFactor
-
-
构造器详细资料
-
PercentageAttribute
public PercentageAttribute(String pDescriptionId, double pDefaultValue, double pMin, double pMax, double scaleFactor) Creates a new PercentageAttribute with the given description, value information, and scale factor.If your attribute's "real" value correlates 1 == 100%, you would use a scale factor of 100 to convert to 1 to 100%.
- 参数:
pDescriptionId
- The description id used for generating the attribute's lang key.pDefaultValue
- The default value of the attributepMin
- The minimum valuepMax
- The maximum valuescaleFactor
- The scale factor, used to convert the literal value to a percentage value.
-
PercentageAttribute
Creates a new PercentageAttribute with the default scale factor of 100.- 另请参阅:
-
-
方法详细资料
-
toValueComponent
public MutableComponent toValueComponent(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.
-