AttributeInstance

Link to attributeinstance

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)
参数类型
参数
modifier
类型
AttributeModifier

Link to addTransientModifier

Name: addTransientModifier

ZenScript
Copy
AttributeInstance.addTransientModifier(modifier as AttributeModifier)
参数类型
参数
modifier
类型
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?
参数类型
参数
uuid
类型
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
参数类型
参数
modifier
类型
AttributeModifier

Name: removeModifier

ZenScript
Copy
AttributeInstance.removeModifier(modifier as AttributeModifier)
参数类型
参数
modifier
类型
AttributeModifier

Name: removeModifier

ZenScript
Copy
AttributeInstance.removeModifier(uuid as string)
参数类型
参数
uuid
类型
string

Name: setBaseValue

ZenScript
Copy
AttributeInstance.setBaseValue(value as double)
参数类型
参数
value
类型
double
名称类型可获得可设置
名称
baseValue
类型
double
可获得
true
可设置
true
名称
modifiers
类型
stdlib.List<AttributeModifier>
可获得
true
可设置
false
名称
value
类型
double
可获得
true
可设置
false