AttributeModifier

Link to attributemodifier

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.AttributeModifier;

Name: create

Creates a new AttributeModifier

Returns: the new attribute modifier
Return Type: AttributeModifier

ZenScript
Copy
// AttributeModifier.create(name as string, amount as double, operation as AttributeOperation, uuid as string) as AttributeModifier

AttributeModifier.create("My New Attribute Modifier", 11.4, AttributeOperation.ADDITION, "6d79f9c1-a4ab-4e72-a0ab-71870b89b4c6");
参数类型描述可选DefaultValue
参数
name(名称)
类型
string
描述
the name of this attribute modifier
可选
false
DefaultValue
参数
amount
类型
double
描述
the amount of this attribute modifier
可选
false
DefaultValue
参数
operation
类型
AttributeOperation
描述
the operation of this attribute modifier.
可选
false
DefaultValue
参数
uuid
类型
string
描述
the uuid of this attribute modifier, if omitted, it will use a random one.
可选
true
DefaultValue

Name: getAmount

Gets the amount of this AttributeModifier.

Returns: The amount of this AttributeModifier.
Return Type: double

ZenScript
Copy
// AttributeModifier.getAmount() as double

myAttributeModifier.getAmount();

Name: getID

Gets the ID of this AttributeModifier.

Returns: The ID of this AttributeModifier
Return Type: string

ZenScript
Copy
// AttributeModifier.getID() as string

myAttributeModifier.getID();

Name: getName

Gets the name of this AttributeModifier.

Returns: The name of this AttributeModifier.
Return Type: string

ZenScript
Copy
// AttributeModifier.getName() as string

myAttributeModifier.getName();

Name: getOperation

Gets the operation of this AttributeModifier.

Returns: The operation of this AttributeModifier.
Return Type: AttributeOperation

ZenScript
Copy
// AttributeModifier.getOperation() as AttributeOperation

myAttributeModifier.getOperation();
名称类型可获得可设置描述
名称
amount
类型
double
可获得
true
可设置
false
描述
Gets the amount of this AttributeModifier.
名称
id
类型
string
可获得
true
可设置
false
描述
Gets the ID of this AttributeModifier.
名称
name(名称)
类型
string
可获得
true
可设置
false
描述
Gets the name of this AttributeModifier.
名称
operation
类型
AttributeOperation
可获得
true
可设置
false
描述
Gets the operation of this AttributeModifier.