AttributeModifier

Importing the class

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.

script.zs
import crafttweaker.api.entity.attribute.AttributeModifier;

Static Methods

Creates a new AttributeModifier

Returns: the new attribute modifier
Return Type: AttributeModifier

script.zs
// 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");
ParameterTypeDescriptionOptional
Parameter
name
Type
string
Description
the name of this attribute modifier
Optional
false
Parameter
amount
Type
double
Description
the amount of this attribute modifier
Optional
false
Parameter
operation
Type
AttributeOperation
Description
the operation of this attribute modifier.
Optional
false
Parameter
uuid
Type
string
Description
the uuid of this attribute modifier, if omitted, it will use a random one.
Optional
true

Methods

Gets the amount of this AttributeModifier.

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

script.zs
// AttributeModifier.getAmount() as double
myAttributeModifier.getAmount();

Gets the ID of this AttributeModifier.

Returns: The ID of this AttributeModifier
Return Type: string

script.zs
// AttributeModifier.getId() as string
myAttributeModifier.getId();

Gets the name of this AttributeModifier.

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

script.zs
// AttributeModifier.getName() as string
myAttributeModifier.getName();

Gets the operation of this AttributeModifier.

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

script.zs
// AttributeModifier.getOperation() as AttributeOperation
myAttributeModifier.getOperation();

Properties

NameTypeHas GetterHas SetterDescription
Name
amount
Type
double
Has Getter
true
Has Setter
false
Description
Gets the amount of this AttributeModifier.
Name
id
Type
string
Has Getter
true
Has Setter
false
Description
Gets the ID of this AttributeModifier.
Name
name
Type
string
Has Getter
true
Has Setter
false
Description
Gets the name of this AttributeModifier.
Name
operation
Type
AttributeOperation
Has Getter
true
Has Setter
false
Description
Gets the operation of this AttributeModifier.