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
Copy
import crafttweaker.api.entity.Attribute;

Name: clampValue

Clamps the given value to this Attribute's range if it exist.

Returns: The clamped value if this Attribute has a range, otherwise the value is returned as is.
Return Type: double

ZenScript
Copy
// Attribute.clampValue(value as double) as double

myAttribute.clampValue(4);
参数类型描述
参数
类型
双精度
描述
The given value to clamp.

Name: getCommandString

Gets the attribute bracket handler syntax for this Attribute.

E.G. <code> attribute:minecraft:generic.max_health </code>

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: shouldWatch

Should this attribute be synced to the client.

Returns: True if synced. False otherwise.
Return Type: boolean

ZenScript
Copy
// Attribute.shouldWatch() as boolean

myAttribute.shouldWatch();
名称类型可获得可设置描述
名称
commandString #命令字符串
类型
string
可获得
true
可设置
false
描述
Gets the attribute bracket handler syntax for this Attribute. <br /> <br /> E.G. <br /> <code> <br /> attribute:minecraft:generic.max_health <br /> </code>
名称
defaultValue
类型
双精度
可获得
true
可设置
false
描述
Gets the default value for this Attribute.
名称
shouldWatch
类型
布尔值
可获得
true
可设置
false
描述
Should this attribute be synced to the client.