Attribute
Link to attribute
导入类
Link to 导入类
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.entity.attribute.Attribute;
Casters
Link to casters
Result Type | 是否隐藏 |
---|---|
Result Type string | 是否隐藏 false |
使用方式
Link to 使用方式
Name: getCommandString
Gets the attribute bracket handler syntax for this Attribute.
E.G. <attribute:minecraft:generic.max_health>
Returns: The attribute bracket handler syntax for this Block.
Return Type: string
ZenScript Copy// Attribute.getCommandString() as string
myAttribute.getCommandString();
Name: getDefaultValue
Gets the default value for this Attribute.
Returns: The default value for this Attribute.
Return Type: double
ZenScript Copy// Attribute.getDefaultValue() as double
myAttribute.getDefaultValue();
Name: isClientSyncable
Should this attribute be synced to the client.
Returns: True if synced. False otherwise.
Return Type: boolean
ZenScript Copy// Attribute.isClientSyncable() as boolean
myAttribute.isClientSyncable();
Name: sanitizeValue
Sanitizes the given value for this Attribute.
Returns: The sanitized value.
Return Type: double
ZenScript Copy// Attribute.sanitizeValue(value as double) as double
myAttribute.sanitizeValue(4);
参数 | 类型 | 描述 |
---|---|---|
参数 value | 类型 double | 描述 The given value to sanitized. |
名称 | 类型 | 可获得 | 可设置 | 描述 |
---|---|---|---|---|
名称 clientSyncable | 类型 布尔值 | 可获得 true | 可设置 false | 描述 Should this attribute be synced to the client. |
名称 commandString #命令字符串 | 类型 string | 可获得 true | 可设置 false | 描述 Gets the attribute bracket handler syntax for this Attribute. E.G. <attribute:minecraft:generic.max_health> |
名称 defaultValue | 类型 double | 可获得 true | 可设置 false | 描述 Gets the default value for this Attribute. |