mojira.dev
MCPE-108988

Entity component: damage_sensor with has_damage/fatal will fire events immediately on damage from blocks

When using the damage_sensor component with the has_damage filter compared against "fatal", any event associated with this filter will fire immediately (regardless of health)  if any damage is taken by the entity from the following blocks:

Sweet Berry Bush
Magma Block
Cactus

The filter behaved normally when used with the following damage blocks:
Campfire (both kinds)
Wither Rose

 

"minecraft:damage_sensor": {
	"triggers": [
		{
			"deals_damage": false,
			"on_damage": {
				"filters": {
					"test": "has_damage",
					"value": "fatal"
				},
				"event": "minecraft:event_to_run",
				"target": "self"
			}
		}
	]
}

These are not exhaustive lists. Tested on Windows 10 PC and Xbox

Steps to Reproduce:

  1. Load a world with the attached Bug Test add-on.

  2. Create a horizontal pad using one of the following blocks: Sweet Berry Bush, Magma Block, Cactus (see attached image).

  3. Summon a Zombie Pigman onto the blocks (no event required).

 

Observed Results:

The event associated with the has_damage/fatal executes immediately.

  • In the case with the attached add-on, the event creates an explosion.

 

Expected Results:

Damage should be take from the block, and the fatal damage event should only fire when the entity health value crosses zero.

 

/Edit: I've attached an image of the blocks used, an add-on with an entity configured to demonstrate the bug, and updated the description accordingly.

Linked issues

Attachments

Comments 13

The current fix is for the filter to not run the event if has_damage = contact but that only works for cactus and berry bushes since magma blocks don't use the magma value for has_damage or it seems any of them. If anyone has the value of magma block's damage that would be great.

Still a issue in 1.16.221

still an issue in 1.17.2

Is this still an issue in the latest version (1.17.11)? If so, can you please add it to the affected versions (or mention it if you are not the reporter).
This ticket will automatically reopen when you reply.

3 more comments

Could you please attach an example add-on to this ticket?

Add-on attached. This bug is still present in 1.19.20.

I cannot reproduce this in 1.21.70, even with an updated pack using the 1.21.70 syntax.

bobmhac

(Unassigned)

877876

Confirmed

Multiple

1.16.100, 1.16.201 Hotfix, 1.18.30, 1.18.31, 1.19.20, 1.20.10

Retrieved