Attribute

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

Casters

Result TypeIs Implicit
Result Type
string
Is Implicit
false

Methods

Gets the attribute bracket handler syntax for this Attribute.

E.G.

Returns: The attribute bracket handler syntax for this Block.
Return Type: string

script.zs
// Attribute.getCommandString() as string
myAttribute.getCommandString();

Gets the default value for this Attribute.

Returns: The default value for this Attribute.
Return Type: double

script.zs
// Attribute.getDefaultValue() as double
myAttribute.getDefaultValue();

Return Type: ResourceLocation

script.zs
// Attribute.getRegistryName() as ResourceLocation
myAttribute.getRegistryName();

Should this attribute be synced to the client.

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

script.zs
// Attribute.isClientSyncable() as boolean
myAttribute.isClientSyncable();

Sanitizes the given value for this Attribute.

Returns: The sanitized value.
Return Type: double

script.zs
// Attribute.sanitizeValue(value as double) as double
myAttribute.sanitizeValue(4);
ParameterTypeDescription
Parameter
value
Type
double
Description
The given value to sanitized.

Properties

NameTypeHas GetterHas SetterDescription
Name
clientSyncable
Type
boolean
Has Getter
true
Has Setter
false
Description
Should this attribute be synced to the client.
Name
commandString
Type
string
Has Getter
true
Has Setter
false
Description
Gets the attribute bracket handler syntax for this Attribute.

E.G.
Name
defaultValue
Type
double
Has Getter
true
Has Setter
false
Description
Gets the default value for this Attribute.
Name
registryName
Type
ResourceLocation
Has Getter
true
Has Setter
false
Description