AttributeInstance

Link to attributeinstance

Importing the class

Link to 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.

ZenScript
Copy
import crafttweaker.api.entity.attribute.AttributeInstance;

Link to addPermanentModifier

Name: addPermanentModifier

ZenScript
Copy
AttributeInstance.addPermanentModifier(modifier as AttributeModifier)
ParameterType
Parameter
modifier
Type
AttributeModifier

Link to addTransientModifier

Name: addTransientModifier

ZenScript
Copy
AttributeInstance.addTransientModifier(modifier as AttributeModifier)
ParameterType
Parameter
modifier
Type
AttributeModifier

Name: getBaseValue

Return Type: double

ZenScript
Copy
// AttributeInstance.getBaseValue() as double

myAttributeInstance.getBaseValue();

Name: getModifier

Return Type: AttributeModifier?

ZenScript
Copy
AttributeInstance.getModifier(uuid as string) as AttributeModifier?
ParameterType
Parameter
uuid
Type
string

Name: getModifiers

Return Type: stdlib.List<AttributeModifier>

ZenScript
Copy
// AttributeInstance.getModifiers() as stdlib.List<AttributeModifier>

myAttributeInstance.getModifiers();

Name: getValue

Return Type: double

ZenScript
Copy
// AttributeInstance.getValue() as double

myAttributeInstance.getValue();

Name: hasModifier

Return Type: boolean

ZenScript
Copy
AttributeInstance.hasModifier(modifier as AttributeModifier) as boolean
ParameterType
Parameter
modifier
Type
AttributeModifier

Name: removeModifier

ZenScript
Copy
AttributeInstance.removeModifier(modifier as AttributeModifier)
ParameterType
Parameter
modifier
Type
AttributeModifier

Name: removeModifier

ZenScript
Copy
AttributeInstance.removeModifier(uuid as string)
ParameterType
Parameter
uuid
Type
string

Name: setBaseValue

ZenScript
Copy
AttributeInstance.setBaseValue(value as double)
ParameterType
Parameter
value
Type
double
名称TypeHas GetterHas Setter
名称
baseValue
Type
double
Has Getter
true
Has Setter
true
名称
modifiers
Type
stdlib.List<AttributeModifier>
Has Getter
true
Has Setter
false
名称
value
Type
double
Has Getter
true
Has Setter
false