Импорт класса

Link to импорт-класса

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.util.DamageSource;

Link to canBypassCreative

Name: canBypassCreative

Checks if the damage can bypass creative mode.

Returns: Whether or not the damage can bypass creative mode.
Return Type: boolean

ZenScript
Copy
// DamageSource.canBypassCreative() as boolean

myDamageSource.canBypassCreative();

Link to getDamageLocation

Name: getDamageLocation

Gets the location where the damage occurred.

Returns: The location of the damage.
Return Type: MCVector3d?

ZenScript
Copy
// DamageSource.getDamageLocation() as MCVector3d?

myDamageSource.getDamageLocation();

Name: getDamageType

Gets the type of damage.

Returns: The type of damage.
Return Type: string

ZenScript
Copy
// DamageSource.getDamageType() as string

myDamageSource.getDamageType();

Name: getHungerDamage

Gets the amount of exhaustion to add to the player's hunger bar if they get hit by this damage.

Returns: The amount of exhaustion to add to the player's hunger bar.
Return Type: float

ZenScript
Copy
// DamageSource.getHungerDamage() as float

myDamageSource.getHungerDamage();

Link to getImmediateSource

Name: getImmediateSource

Gets the immediate source of the damage, like an arrow.

Returns: The immediate source of the damage.
Return Type: MCEntity?

ZenScript
Copy
// DamageSource.getImmediateSource() as MCEntity?

myDamageSource.getImmediateSource();

Name: getTrueSource

Gets the true source of the damage, like the player who shot the arrow.

Returns: The true source of the damage.
Return Type: MCEntity?

ZenScript
Copy
// DamageSource.getTrueSource() as MCEntity?

myDamageSource.getTrueSource();

Link to isAbsoluteDamage

Name: isAbsoluteDamage

Checks if the damage is absolute.

Returns: Whether or not the damage is absolute.
Return Type: boolean

ZenScript
Copy
// DamageSource.isAbsoluteDamage() as boolean

myDamageSource.isAbsoluteDamage();

Link to isCreativePlayer

Name: isCreativePlayer

Gets whether the damage was inflicted by a creative player.

Returns: Whether the damage was inflicted by a creative player.
Return Type: boolean

ZenScript
Copy
// DamageSource.isCreativePlayer() as boolean

myDamageSource.isCreativePlayer();

Link to isDifficultyScaled

Name: isDifficultyScaled

Gets whether the damage changes strength based on the current difficulty.

Returns: Whether the damage changes strength according to difficulty.
Return Type: boolean

ZenScript
Copy
// DamageSource.isDifficultyScaled() as boolean

myDamageSource.isDifficultyScaled();

Link to isExplosionDamage

Name: isExplosionDamage

Checks if the damage is caused by an explosion.

Returns: Whether or not the damage is caused by an explosion.
Return Type: boolean

ZenScript
Copy
// DamageSource.isExplosionDamage() as boolean

myDamageSource.isExplosionDamage();

Name: isFireDamage

Checks if the damage is caused by fire or burning.

Returns: Whether or not the damage is caused by fire or burning.
Return Type: boolean

ZenScript
Copy
// DamageSource.isFireDamage() as boolean

myDamageSource.isFireDamage();

Name: isMagicDamage

Checks if the damage is caused by magic.

Returns: Whether or not the damage is caused by magic.
Return Type: boolean

ZenScript
Copy
// DamageSource.isMagicDamage() as boolean

myDamageSource.isMagicDamage();

Link to isProjectileDamage

Name: isProjectileDamage

Checks if the damage is caused by a projectile.

Returns: Whether or not the damage is caused by a projectile.
Return Type: boolean

ZenScript
Copy
// DamageSource.isProjectileDamage() as boolean

myDamageSource.isProjectileDamage();

Link to isUnblockableDamage

Name: isUnblockableDamage

Checks if the damage can be blocked.

Returns: Whether or not the damage can be blocked.
Return Type: boolean

ZenScript
Copy
// DamageSource.isUnblockableDamage() as boolean

myDamageSource.isUnblockableDamage();

Свойства

Link to свойства

НазваниеТипИмеет GetterИмеет SetterОписание
Название
absolute
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if the damage is absolute.
Название
bypassCreative
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if the damage can bypass creative mode.
Название
creativePlayer
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Gets whether the damage was inflicted by a creative player.
Название
difficultyScaled
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Gets whether the damage changes strength based on the current difficulty.
Название
explosion
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if the damage is caused by an explosion.
Название
fire
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if the damage is caused by fire or burning.
Название
hungerDamage
Тип
float
Имеет Getter
true
Имеет Setter
false
Описание
Gets the amount of exhaustion to add to the player's hunger bar if they
get hit by this damage.
Название
immediateSource
Тип
MCEntity?
Имеет Getter
true
Имеет Setter
false
Описание
Gets the immediate source of the damage, like an arrow.
Название
местоположение
Тип
MCVector3d?
Имеет Getter
true
Имеет Setter
false
Описание
Gets the location where the damage occurred.
Название
magic
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if the damage is caused by magic.
Название
projectile
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if the damage is caused by a projectile.
Название
trueSource
Тип
MCEntity?
Имеет Getter
true
Имеет Setter
false
Описание
Gets the true source of the damage, like the player who shot the arrow.
Название
type
Тип
string
Имеет Getter
true
Имеет Setter
false
Описание
Gets the type of damage.
Название
unblockable
Тип
boolean
Имеет Getter
true
Имеет Setter
false
Описание
Checks if the damage can be blocked.