Hey! I'd like to suggest adding support for custom damage types to the Bedrock Script API.
Currently, developers are limited to vanilla damage causes, making it difficult to distinguish between custom attacks without relying on workarounds.
Similar to custom dimension registration, a damageTypeRegistry property could be exposed in the startup event:
system.beforeEvents.startup.subscribe(({ damageTypeRegistry }) => {
damageTypeRegistry.registerCustomDamageType(
"namespace:kick",
EntityDamageCause.EntityAttack
);
});
The second parameter would define which vanilla or custom damage type the new one inherits its behavior from.
Once registered, it could be used with existing APIs:
entity.applyDamage(5, {
cause: "myaddon:kick"
});
Ideally, custom types would also work with the /damage command and relevant damage events, preserving their unique identifiers instead of only exposing their inherited vanilla cause.
Additionally, EntityDamageCause.getAll() could return all registered causes, including custom ones.
This would be especially useful for combat-focused addons, RPGs, and ability-based systems, allowing developers to identify individual attacks natively, reduce workarounds, and improve compatibility between addons.
That's all, thank you for your time.
0 Comments
Please sign in to leave a comment.
Post a new comment: