The following code works in singleplayer, but not on realms:
world.afterEvents.entityDie.subscribe((event) => {
const deadEntity = event.deadEntity;
const damageSource = event.damageSource.damagingEntity;
const damageProjectile = event.damageSource.damagingProjectile;
if (
damageSource.typeId === "minecraft:player" &&
damageProjectile.typeId === "minecraft:fireball" &&
deadEntity.typeId === "minecraft:ghast"
)
damageSource.runCommand("say Success!");
});Even if I remove the fireball requirement in line 7 (included in this sample code to avoid accidentally killing the ghast some other way), it still does not work on realms but does work on singleplayer. The only variable remaining is that the Player is not counted as the damagingEntity on realms.
Steps to reproduce: Run a scripting addon with this in the script.
Expected result: “Success!” shows in chat on both singleplayer and realms – consistent behavior across both environments.
Actual result: “Success!” shows only in singleplayer.
Comments 0
No comments.