mojira.dev
MCPE-239446

world.beforeEvents.entityHurt ignores immunity cooldown if damage is higher than player's health

If the initial damage is higher than player's health, reducing it with world.beforeEvents.entityHurt disables immunity cooldown and damage effects (sound, screen tilting). This is a duplicate of MCPE-237382, however that report did not provide an example.
This issue is present since the introduction of world.beforeEvents.entityHurt and hasn’t been fixes alongside the recent changes to the event.

Steps to Reproduce:

  1. Install the attached behavior pack.

  2. Create or open a world with the behavior pack active and cheats enabled.

  3. Place a repeating command block with the command: “/damage @a[r=2] 10 entity_attack“.

  4. Stand near the command block in survival mode.

Observed Results:
If the player’s health is above 10, they take 1 damage every half-second. When the health drops below 10, the player begins taking 1 damage per tick, which doesn’t cause the damage sound or screen tilting.

Expected Results:
There should be no difference based on player’s health value - damage should always be dealt every 10 ticks and should trigger a sound and screen tilting.

Other Tests:
Running the same setup with non-player entities produces the expected results.

main.js:

import { world } from "@minecraft/server";

world.beforeEvents.entityHurt.subscribe((event) => {
    event.damage *= 0.1;
});

Attachments

Comments 1

Thank you for helping us improve Minecraft! We saved your files:

[media][media]

Kalendarz2

(Unassigned)

Unconfirmed

Windows

11 25H2

26.40.20 Preview

Retrieved