API reference / @jsprismarine/prismarine / entity/damageTypes
entity/damageTypes
Interfaces
DamageOrigins
Defined in: packages/prismarine/src/entity/damageTypes.ts:150
Where /damage says a blow came from.
Properties
at?
readonlyoptionalat?:Vector3
Defined in: packages/prismarine/src/entity/damageTypes.ts:156
at: a point the blow came from.
by?
readonlyoptionalby?:StoreActor
Defined in: packages/prismarine/src/entity/damageTypes.ts:152
by: what made contact.
from?
readonlyoptionalfrom?:StoreActor
Defined in: packages/prismarine/src/entity/damageTypes.ts:154
from: who is answerable for by; without it by is both.
Type Aliases
DamageScaling
DamageScaling =
"never"|"always"|"when_caused_by_living_non_player"
Defined in: packages/prismarine/src/entity/damageTypes.ts:134
How a damage type scales with the difficulty, Java's DamageScaling.
Functions
damageCauseOfType()
damageCauseOfType(
type,tags):DamageCause
Defined in: packages/prismarine/src/entity/damageTypes.ts:53
The cause of this server's enum a Java damage type stands for; generic when it names none.
Parameters
type
string
tags
ReadonlySet<string>
Returns
damageCausesInTag()
damageCausesInTag(
content,tag):ReadonlySet<DamageCause>
Defined in: packages/prismarine/src/entity/damageTypes.ts:69
The causes the types of one damage_type tag stand for, such as the magic, sonic boom and thorns of Java's witch_resistant_to.
Parameters
content
The content build, for its damage_type tags.
tag
string
The tag, such as minecraft:witch_resistant_to.
Returns
ReadonlySet<DamageCause>
damageScalingOf()
damageScalingOf(
content,cause,damageType?):DamageScaling
Defined in: packages/prismarine/src/entity/damageTypes.ts:143
Whether a blow scales with the difficulty, by the scaling its damage type declares: never, always, or when_caused_by_living_non_player, which is every mob attack.
Parameters
content
The content build, for the damage type definitions.
cause
string
The cause name the blow carries.
damageType?
string
The Java damage type the blow names, when it names one.
Returns
damageSourceOfType()
damageSourceOfType(
content,type,origins?):DamageSource
Defined in: packages/prismarine/src/entity/damageTypes.ts:179
Builds the source for a damage type and the entities behind it, the way Java's /damage does.
With by alone the entity is both who made contact and who is answerable. With from as well, from is answerable and by made contact, so an arrow shot by a skeleton blames the skeleton. With neither there is no source entity at all, whoever ran the command.
Parameters
content
The content build, for the type's tags.
type
string
A damage type id.
origins?
DamageOrigins = {}
The optional by, from and at clauses.
Returns
foodExhaustionOf()
foodExhaustionOf(
content,cause,damageType?):number
Defined in: packages/prismarine/src/entity/damageTypes.ts:128
The food exhaustion a blow that takes a player's health costs, Java's DamageSource.getFoodExhaustion: the exhaustion its damage type declares, 0.1 for a blow and 0 for drowning, falling, starving and the other types that are not.
Parameters
content
The content build, for the damage type definitions.
cause
string
The cause name the blow carries.
damageType?
string
The Java damage type the blow names, when it names one.
Returns
number
hasDamageType()
hasDamageType(
content,type):boolean
Defined in: packages/prismarine/src/entity/damageTypes.ts:164
Whether the loaded datapacks declare a damage type.
Parameters
content
The content build.
type
string
A damage type id such as minecraft:in_fire.
Returns
boolean
javaDamageTypeOf()
javaDamageTypeOf(
cause,damageType?):string
Defined in: packages/prismarine/src/entity/damageTypes.ts:113
The Java damage type a blow stands for: the one it names, else the one its cause stands for, else minecraft:generic.
Parameters
cause
string
The cause name the blow carries.
damageType?
string
The Java damage type the blow names, when it names one.
Returns
string