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.world.damage.DamageType;

Extending Record

Link to extending-record

DamageType extends Record. That means all methods available in Record are also available in DamageType

Creates a new DamageType using the provided values

ZenScript
Copy
new DamageType(msgId as string, exhaustion as float) as DamageType
new DamageType(inIce, 0.1);
ParameterTypeDescription
Parameter
msgId
Type
string
Description
The unlocalized name of this type
Parameter
exhaustion
Type
float
Description
How much exhaustion does this type cause

Creates a new DamageType using the provided values

ZenScript
Copy
new DamageType(msgId as string, scaling as DamageScaling, exhaustion as float) as DamageType
new DamageType(inIce, <constant:minecraft:damage/damage_scaling:always>, 0.1);
ParameterTypeDescription
Parameter
msgId
Type
string
Description
The unlocalized name of this type
Parameter
scaling
Type
DamageScaling
Description
The damage scaling used by this type
Parameter
exhaustion
Type
float
Description
How much exhaustion does this type cause

Creates a new DamageType using the provided values

ZenScript
Copy
new DamageType(msgId as string, scaling as DamageScaling, exhaustion as float, effects as DamageEffects) as DamageType
new DamageType(inIce, <constant:minecraft:damage/damage_scaling:always>, 0.1, <constant:minecraft:damage/damage_effects:freezing>);
ParameterTypeDescription
Parameter
msgId
Type
string
Description
The unlocalized name of this type
Parameter
scaling
Type
DamageScaling
Description
The damage scaling used by this type
Parameter
exhaustion
Type
float
Description
How much exhaustion does this type cause
Parameter
effects
Type
DamageEffects
Description
The effect of this type

Creates a new DamageType using the provided values

ZenScript
Copy
new DamageType(msgId as string, scaling as DamageScaling, exhaustion as float, effects as DamageEffects, deathMessageType as DeathMessageType) as DamageType
new DamageType(inIce, <constant:minecraft:damage/damage_scaling:always>, 0.1, <constant:minecraft:damage/damage_effects:freezing>, <constant:minecraft:damage/death_message_type:default>);
ParameterTypeDescription
Parameter
msgId
Type
string
Description
The unlocalized name of this type
Parameter
scaling
Type
DamageScaling
Description
The damage scaling used by this type
Parameter
exhaustion
Type
float
Description
How much exhaustion does this type cause
Parameter
effects
Type
DamageEffects
Description
The effect of this type
Parameter
deathMessageType
Type
DeathMessageType
Description
The type of death message to send
NameTypeHas GetterHas Setter
Name
deathMessageType
Type
DeathMessageType
Has Getter
true
Has Setter
false
Name
effects
Type
DamageEffects
Has Getter
true
Has Setter
false
Name
exhaustion
Type
float
Has Getter
true
Has Setter
false
Name
msgId
Type
string
Has Getter
true
Has Setter
false
Name
scaling
Type
DamageScaling
Has Getter
true
Has Setter
false