{
  "format_version": "1.16.0",
  "minecraft:entity": {
    "description": {
      "identifier": "lv_te:tech_mech_suit",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false,
      "properties": {
        "lv.te:cracking": {
          "client_sync": true,
          "default": 0,
          "range": [
            0,
            3
          ],
          "type": "int"
        }
      }
    },
    "component_groups": {
      "lv_te:despawn": {
        "minecraft:instant_despawn": {
          "remove_child_entities": false
        }
      },
      "not_attacking": {
        "minecraft:variant": {
          "value": 0
        },
        "minecraft:movement": {
          "value": 0.15
        }
      },
      "melee_attack": {
        "minecraft:timer": {
          "time": 0.4,
          "looping": true,
          "time_down_event": {
            "event": "reset_attacks",
            "target": "self"
          }
        },
        "minecraft:variant": {
          "value": 1
        },
        "minecraft:movement": {
          "value": 0.05
        }
      }
    },
    "components": {
      "minecraft:type_family": {
        "family": [
          "lv_te.tech_mech_suit"
        ]
      },
      "minecraft:health": {
        "value": 150,
        "max": 150
      },
      "minecraft:scale": {
        "value": 1.2
      },
      "minecraft:movement": {
        "value": 0.15
      },
      "minecraft:navigation.walk": {
        "can_float": false,
        "avoid_damage_blocks": true
      },
      "minecraft:input_ground_controlled": {},
      "minecraft:movement.basic": {},
      "minecraft:jump.static": {},
      "minecraft:physics": {},
      "minecraft:rideable": {
        "seat_count": 1,
        "controlling_seat": 0,
        "family_types": [
          "player"
        ],
        "interact_text": "action.interact.ride.tech_mech_suit",
        "pull_in_entities": false,
        "rider_can_interact": true,
        "seats": [
          {
            "position": [
              0,
              1.3,
              0.0
            ],
            "min_rider_count": 0,
            "max_rider_count": 1
          }
        ]
      },
      "minecraft:collision_box": {
        "width": 1.5,
        "height": 3
      },
      "minecraft:damage_sensor": {
        "triggers": [
          {
            "on_damage": {
              "filters": [
                {
                  "all_of": [
                    {
                      "test": "is_family",
                      "subject": "damager",
                      "value": "player"
                    },
                    {
                      "test": "rider_count",
                      "subject": "self",
                      "operator": ">",
                      "value": 0
                    }
                  ]
                }
              ],
              "target": "self",
              "event": "lv_te:melee_attack"
            },
            "deals_damage": false
          },
          {
            "on_damage": {
              "filters": [
                {
                  "all_of": [
                    {
                      "test": "is_family",
                      "subject": "damager",
                      "value": "player"
                    },
                    {
                      "test": "rider_count",
                      "subject": "self",
                      "value": 0
                    }
                  ]
                }
              ],
              "target": "self",
              "event": "lv_te:cracking"
            },
            "deals_damage": false
          },
          {
            "on_damage": {
              "filters": [
                {
                  "all_of": [
                    {
                      "test": "has_damage",
                      "subject": "self",
                      "value": "fall"
                    }
                  ]
                }
              ]
            },
            "deals_damage": false
          }
        ]
      }
    },
    "events": {
      "minecraft:entity_spawned": {
        "add": {
          "component_groups": [
            "not_attacking",
            "alive"
          ]
        }
      },
      "minecraft:entity_transformed": {
        "add": {
          "component_groups": [
            "not_attacking",
            "alive"
          ]
        }
      },
      "lv_te:melee_attack": {
        "sequence": [
          {
            "filters": {
              "test": "is_variant",
              "subject": "self",
              "operator": "equals",
              "value": 0
            },
            "add": {
              "component_groups": [
                "melee_attack"
              ]
            },
            "remove": {
              "component_groups": [
                "not_attacking"
              ]
            },
            "queue_command": {
              "command": "scriptevent lv.te:tech_mech.attack"
            }
          }
        ]
      },
      "reset_attacks": {
        "add": {
          "component_groups": [
            "not_attacking"
          ]
        },
        "remove": {
          "component_groups": [
            "melee_attack"
          ]
        }
      },
      "lv_te:remove_machine": {
        "add": {
          "component_groups": [
            "lv_te:despawn"
          ]
        }
      },
      "lv_te:reset_cracking": {
        "set_property": {
          "lv.te:cracking": 0
        }
      },
      "lv_te:cracking": {
        "queue_command": {
          "command": "scriptevent lv.te:tech_mech.cracking"
        }
      }
    }
  }
}