Attribute
Link to attribute
Importare la Classe
Link to importare-la-classe
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 Copyimport crafttweaker.api.entity.Attribute;
Metodi
Link to metodi
Name: clampValue
Clamps the given value to this Attribute's range if it exist.
Returns: The clamped value if this Attribute has a range, otherwise the value is returned as is.
Return Type: double
ZenScript Copy// Attribute.clampValue(value as double) as double
myAttribute.clampValue(4);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro valore | Tipo double | Descrizione The given value to clamp. |
Name: getCommandString
Gets the attribute bracket handler syntax for this Attribute.
E.G.
attribute:minecraft:generic.max_health
Returns: The attribute bracket handler syntax for this Block.
Return Type: string
ZenScript Copy// Attribute.getCommandString() as string
myAttribute.getCommandString();
Name: getDefaultValue
Gets the default value for this Attribute.
Returns: The default value for this Attribute.
Return Type: double
ZenScript Copy// Attribute.getDefaultValue() as double
myAttribute.getDefaultValue();
Name: shouldWatch
Should this attribute be synced to the client.
Returns: True if synced. False otherwise.
Return Type: boolean
ZenScript Copy// Attribute.shouldWatch() as boolean
myAttribute.shouldWatch();
Proprietà
Link to proprietà
Nome | Tipo | Ha Getter | Ha Setter | Descrizione |
---|---|---|---|---|
Nome commandString | Tipo string | Ha Getter sì | Ha Setter no | Descrizione Gets the attribute bracket handler syntax for this Attribute. E.G. |
Nome defaultValue | Tipo double | Ha Getter sì | Ha Setter no | Descrizione Gets the default value for this Attribute. |
Nome shouldWatch | Tipo boolean | Ha Getter sì | Ha Setter no | Descrizione Should this attribute be synced to the client. |