mojira.dev
MCPE-172779

[ScriptAPI] applyDamage -> Player is not valid type in interface EntityApplyDamageOptions

You can't specify player as source of damage when applyDamage method is used on entities.
Code to reproduce:

anyEntity.applyDamage(5,{damagingEntity:mustBePlayer});

Error message:

[media]

Pack to reproduce available: down below

Attachments

Comments 1

Luckily this is not a bug, you are just missing the non-optional damage cause. e.g.

anyEntity.applyDamage(5, { cause: "magic", damagingEntity: mustBePlayer });

ConMaster2112

(Unassigned)

1074269

Plausible

Multiple

Windows 11

Script-API

1.20.20.20 Preview

1.20.70

Retrieved