mojira.dev
MCPE-236992

"deals_damage" field doesn't work on player entity

I was trying to use “minecraft:damage_sensor” to build a blocking skill, here’s the JSON

{
  "format_version": "1.21.0",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:player",
      "spawn_category": "creature",
      "is_spawnable": false,
      "is_summonable": false
    },

    "component_groups": {
      "minecraft:add_raid_omen": {
        "minecraft:spell_effects": {
          "add_effects": [
            {
              "effect": "raid_omen",
              "duration": 30,
              "display_on_screen_animation": true
            }
          ],
          "remove_effects": "bad_omen"
        },
        "minecraft:timer": {
          "time": [ 0.0, 0.0 ],
          "looping": false,
          "time_down_event": {
            "event": "minecraft:clear_add_raid_omen",
            "target": "self"
          }
        }
      },
      "minecraft:clear_raid_omen_spell_effect": {
        "minecraft:spell_effects": {
        }
      },
      "minecraft:raid_trigger": {
        "minecraft:raid_trigger": {
          "triggered_event": {
            "event": "minecraft:remove_raid_trigger",
            "target": "self"
          }
        }
      }
    },

    "components": {
      "minecraft:experience_reward": {
        "on_death": "Math.Min(query.player_level * 7, 100)"
      },
      "minecraft:type_family": {
        "family": [ "player" ]
      },
      "minecraft:is_hidden_when_invisible": {
      },
      "minecraft:loot": {
        "table": "loot_tables/empty.json"
      },
      "minecraft:collision_box": {
        "width": 0.6,
        "height": 1.8
      },
      "minecraft:can_climb": {
      },
      "minecraft:movement": {
        "value": 0.1
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": {
              "test": "in_lava",
              "subject": "self",
              "operator": "==",
              "value": true
            },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:attack": {
        "damage": 1
      },
      "minecraft:exhaustion_values": {
        "heal": 6.0,
        "jump": 0.05,
        "sprint_jump": 0.2,
        "mine": 0.005,
        "attack": 0.1,
        "damage": 0.1,
        "walk": 0.0,
        "sprint": 0.1,
        "swim": 0.01,
        "lunge": 4.0
      },
      "minecraft:player.saturation": {
        "value": 5,
        "max": 20
      },
      "minecraft:player.exhaustion": {
        "value": 0,
        "max": 20
      },
      "minecraft:player.level": {
        "value": 0,
        "max": 24791
      },
      "minecraft:player.experience": {
        "value": 0,
        "max": 1
      },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": -1,
        "inhale_time": 3.75,
        "generates_bubbles": false
      },
      "minecraft:nameable": {
        "always_show": true,
        "allow_name_tag_renaming": false
      },
      "minecraft:physics": {
        "push_towards_closest_space": true
      },
      "minecraft:pushable": {
        "is_pushable": false,
        "is_pushable_by_piston": true
      },
      "minecraft:insomnia": {
        "days_until_insomnia": 3
      },
      "minecraft:rideable": {
        "seat_count": 2,
        "family_types": [
          "parrot_tame"
        ],
        "pull_in_entities": true,
        "seats": [
          {
            "position": [ 0.4, -0.2, -0.1 ],
            "min_rider_count": 0,
            "max_rider_count": 0,
            "lock_rider_rotation": 0
          },
          {
            "position": [ -0.4, -0.2, -0.1 ],
            "min_rider_count": 1,
            "max_rider_count": 2,
            "lock_rider_rotation": 0
          }
        ]
      },
      "minecraft:conditional_bandwidth_optimization": {
      },
      "minecraft:block_climber": {},
      "minecraft:damage_sensor": {
        "triggers": [
          {
            "on_damage": {
              "filters": {
                "all_of": [
                  {
                    "test": "has_tag",
                    "subject": "self",
                    "value": "gm:blocking"
                  }
                ]
              },
              "event": "gm:blocking"
            }
          },//successful
          {
            "on_damage": {
              "filters": {
                "all_of": [
                  {
                    "test": "has_tag",
                    "subject": "self",
                    "value": "gm:blocking"
                  }
                ]
              }
            },
            "deals_damage": "no"
          }//failed
        ]
      },
      "minecraft:environment_sensor": {
        "triggers": {
          "filters": {
            "all_of": [
              {
                "test": "has_mob_effect",
                "subject": "self",
                "value": "bad_omen"
              },
              {
                "test": "is_in_village",
                "subject": "self",
                "value": true
              }
            ]
          },
          "event": "minecraft:gain_raid_omen"
        }
      }
    },

    "events": {
      "minecraft:gain_raid_omen": {
        "add": {
          "component_groups": [
            "minecraft:add_raid_omen"
          ]
        }
      },
      "minecraft:clear_add_raid_omen": {
        "remove": {
          "component_groups": [
            "minecraft:add_raid_omen"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:clear_raid_omen_spell_effect"
          ]
        }
      },
      "minecraft:trigger_raid": {
        "add": {
          "component_groups": [ "minecraft:raid_trigger" ]
        }
      },
      "minecraft:remove_raid_trigger": {
        "remove": {
          "component_groups": [ "minecraft:raid_trigger" ]
        }
      },
      "gm:blocking": {
        "queue_command": {
          "command": [
            "playsound random.anvil_land @a"
          ]
        }
      }
    }
  }
}

When you get “gm:blocking” tag while being attacked it may successfully trigger the event and play sound. However, the damage still applied on you.

Steps to reproduce

  1. Open a world with a pack contains the JSON file

  2. Type “/tag @s add gm:blocking” and enter in the chat box

  3. Summon a zombie to attack you

Expected result

Anvil sound is played, no damage applied

Observed result

Anvil sound is played, damage is applied

Linked issues

Attachments

Comments 5

Hi!
Thank you for your report! 

However, this issue has been temporarily closed as Awaiting Response.

  • Can you record a video of the issue and upload it?

  • Could you provide the datapack you used to test this issue?

  • Did the issue happen only once, or does it occur consistently?

This ticket will automatically reopen when you reply. Thanks!

Quick Links: 
📓 Issue Guidelines – 💬 Mojang Support – 📧 Suggestions – 📖 Minecraft Wiki

[media]

If you want a pack, here it is.

Acontece que eu perdi todas as capas que eu tinha na minha conta, minha conta não fica salva toda vez que eu entro no jogo e a função de tirar foto no meu mundo simplesmente desapareceu e era uma função que mais me ajudava.

Dito isso espero que ocorra uma correção,Obrigado

This is not a bug.

The first trigger that matches is used. Your first trigger matches, and since deals_damage defaults to true, you take damage. Your second trigger is never reached. To get your intended result, you should only have one trigger with both desired properties.

Actually, they acts the same when only one trigger exists

mingwangdada

(Unassigned)

Unconfirmed

Multiple

26.3

Retrieved