Attacking any type of boat, minecart or armor stand does not trigger entityHitEntity and entityHurt afterEvents in 1.4.0-beta
Steps to reproduce
1. Write a script that is using entityHurt event in script api v1.4.0-beta
You may use this script or the sample add-on (bug_bp_new.mcpack)
2. Launch the game
3. Try to trigger the event
Observed results:
Attacking Boat, Minecart or Armor Stand entity does not trigger entityHurt event
Attacking any other does trigger those script events
No console log messages shown
Expected results:
Attacking Boat, Minecart or Armor Stand entity will trigger entityHurt event
Event is triggered when I attack the cow
But is not triggered when I hit the boat
Attachments
Comments 10
Are you actually using version 1.4.0-beta?
Please list Steps to Reproduce, Observed Results, and Expected Behavior in the Description, as shown here:
Steps to Reproduce:
1. (list every step completely, so someone else can reproduce the issue, and try following your list to make sure you can still reproduce the issue yourself)
2.
3.
Observed Results:
(briefly describe what you see happen, including any message(s) shown)
Expected Results:
(briefly describe what should happen)
Use screenshots or video to help explain (but not replace) the above information
This report has been temporarily resolved as Awaiting Response. It will automatically reopen when you add information. Please follow the format shown and include all sections (steps, observed, expected). Reports that do not contain all of the requested information and complete steps to reproduce the issue may be closed as Incomplete. For more information please read the Bug Tracker Guidelines.
You may find this Report Creation Form helpful for any future reports you create.
Are you actually using version 1.4.0-beta?
Please list Steps to Reproduce, Observed Results, and Expected Behavior in the Description, as shown here:
Steps to Reproduce:
1. (list every step completely, so someone else can reproduce the issue, and try following your list to make sure you can still reproduce the issue yourself)
2.
3.
Observed Results:
(briefly describe what you see happen, including any message(s) shown)
Expected Results:
(briefly describe what should happen)
Use screenshots or video to help explain (but not replace) the above information
This report has been temporarily resolved as Awaiting Response. It will automatically reopen when you add information. Please follow the format shown and include all sections (steps, observed, expected). Reports that do not contain all of the requested information and complete steps to reproduce the issue may be closed as Incomplete. For more information please read the Bug Tracker Guidelines.
You may find this Report Creation Form helpful for any future reports you create.
For issues with addon functionality we need you to attach a sample addon that can be used to reproduce the bug.
Resolving temporarily as Awaiting Response. We can't reproduce this issue on the 1.20.15 Hotfix using the example behavior pack, the events are triggered correctly when the entities are hit in survival mode. Could you please check that version again?
This ticket will reopen automatically when you reply.
Resolving temporarily as Awaiting Response. We can't reproduce this issue on the 1.20.15 Hotfix using the example behavior pack, the events are triggered correctly when the entities are hit in survival mode. Could you please check that version again?
This ticket will reopen automatically when you reply.
After a small test I figured out that entityHitEntity actually works, however entityHurt is not triggered by attacking a boat, minecart or armor_stand
Can confirm, affects 1.20.51. See the attached video.
Important to note: The BP provided was built using an older and outdated version of the beta API. You'll have to manually update the @minecraft/server "version" in the manifest.json file to the latest stable release of the API, which can be found at https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/minecraft-server?view=minecraft-bedrock-stable
I can confirm this issue is still reproducible on the current stable Bedrock release.
The original report predates EntityHurtBeforeEvent, so I also tested the newer cancellable hurt event to determine whether it provides a way to intercept these attacks.
Tested environment
Minecraft Bedrock 26.51 stable
@minecraft/server2.10.0 stableSurvival and Creative
Steps to reproduce
Apply the attached reproduction behavior pack.
Spawn a cow as normal living entity control.
Spawn affected non-living entities such as a boat, minecart, chest minecart, hopper minecart, chest boat, or armor stand.
Attack the entities in Survival.
Repeat with fresh targets in Creative.
The pack logs entityHurt before/after, entityHitEntity, playerSwingStart, and entity removal events.
Observed results
For normal living entities, attacks produce EntityHurtBeforeEvent, EntityHitEntityAfterEvent, and EntityHurtAfterEvent. EntityHurtBeforeEvent is cancellable, so the damage can be prevented.
For the affected non-living entities:
EntityHurtBeforeEventandEntityHurtAfterEventare not emitted.In Survival,
EntityHitEntityAfterEventcan fire when the target survives the hit, but this is an after-event and cannot prevent the attack.When the target is destroyed,
EntityRemoveBeforeEventmay fire, but it is not cancellable.In Creative, these entities can be destroyed in a single hit. The destruction/removal path can complete before
EntityHitEntityAfterEventis delivered, so the target may already be gone before the API reports the hit.EntityHurtBeforeEventstill does not fire beforehand, leaving no opportunity to cancel the attack.
This leaves no cancellable event equivalent to EntityHurtBeforeEvent with which to prevent the attack/destruction.
I have attached the minimal observation-only reproduction pack covering both Survival and Creative behavior. Source and the packaged reproduction are also available on GitHub here: MCPE-174388 Repro v1.0.0