// Copyright (c) JaylyMC.
// Licensed under the GPL-3.0 License.

{
  "format_version": "1.20.70",
  "minecraft:entity": {
    "description": {
      "identifier": "entity:dummy",
      "is_summonable": true,
      "is_spawnable": false,
      "is_experimental": false,
      "scripts": {
        "animate": [
          { "dummy.escape_pathfind": "q.property('dummy:task_type') == 2" },
          {
            "dummy.spawn_terminator": "q.property('dummy:task_type') == 1 || q.property('dummy:task_type') == 3 || q.property('dummy:task_type') == 4"
          }
        ]
      },
      "animations": {
        "dummy.escape_pathfind": "controller.animation.dummy.escape_pathfind",
        "dummy.spawn_terminator": "controller.animation.dummy.spawn_terminator"
      },
      "properties": {
        "dummy:task_type": {
          "range": [0, 4],
          "type": "int",
          "default": 0
        }
      }
    },
    "component_groups": {
      "dummy:roar": {
        "minecraft:behavior.knockback_roar": {
          "duration": 0.1,
          "attack_time": 0.1,
          "cooldown_time": 0.0,
          "knockback_damage": 0,
          "knockback_range": 6,
          "knockback_horizontal_strength": 2,
          "knockback_vertical_strength": 1,
          "knockback_filters": {
            "all_of": [
              {
                "test": "is_family",
                "subject": "other",
                "operator": "!=",
                "value": "dummy"
              }
            ]
          },
          "damage_filters": {
            "all_of": [
              {
                "test": "is_family",
                "subject": "other",
                "operator": "==",
                "value": "unset"
              }
            ]
          }
        }
      },
      "dummy:force_spawn_entity": {
        "minecraft:instant_despawn": {
          "remove_child_entities": true
        },
        "minecraft:explode": {
          "fuse_length": -1,
          "fuse_lit": true,
          "power": 200,
          "causes_fire": true,
          "destroy_affected_by_griefing": false,
          "breaks_blocks": true,
          "fire_affected_by_griefing": false,
          "max_resistance": 3.40282e38
        }
      },
      "dummy:detect_terminator": {
        "minecraft:entity_sensor": {
          "subsensors": [
            {
              "event_filters": {
                "all_of": [
                  {
                    "test": "is_family",
                    "subject": "other",
                    "operator": "equals",
                    "value": "terminator"
                  }
                ]
              },
              "minimum_count": 1,
              "maximum_count": 32767,
              "range": [10, 10],
              "require_all": true,
              "event": "dummy:request_despawn"
            }
          ]
        }
      },
      "dummy:despawn": {
        "minecraft:instant_despawn": {
          "remove_child_entities": true
        }
      }
    },
    "components": {
      "minecraft:custom_hit_test": {
        "hitboxes": [
          {
            "pivot": [0, 100, 0],
            "width": 0,
            "height": 0
          }
        ]
      },
      "minecraft:type_family": {
        "family": ["dummy"]
      },
      "minecraft:damage_sensor": {
        "triggers": {
          "deals_damage": false
        }
      },
      "minecraft:pushable": {
        "is_pushable": false,
        "is_pushable_by_piston": false
      },
      "minecraft:collision_box": {
        "width": 0.0001,
        "height": 0.0001
      },
      "minecraft:tick_world": {
        "never_despawn": true,
        "radius": 4
      }
    },
    "events": {
      "dummy:force_roar": {
        "add": {
          "component_groups": ["dummy:roar"]
        }
      },
      "dummy:finish_setup": {
        "remove": {
          "component_groups": ["dummy:roar"]
        }
      },
      "dummy:spawn_terminator": {
        "add": {
          "component_groups": ["dummy:force_spawn_entity"]
        }
      },
      "dummy:request_spawning_steve": {
        "set_property": {
          "dummy:task_type": 1
        }
      },
      "dummy:request_pathfind": {
        "set_property": {
          "dummy:task_type": 2
        }
      },
      "dummy:request_spawning_alex": {
        "set_property": {
          "dummy:task_type": 3
        }
      },
      "dummy:request_spawning_custom": {
        "set_property": {
          "dummy:task_type": 4
        }
      },
      "dummy:create_terminator_target": {
        "add": {
          "component_groups": ["dummy:detect_terminator"]
        },
        "queue_command": {
          "command": ["spreadplayers ~ ~ 32 48 @s"]
        }
      },
      "dummy:request_despawn": {
        "add": {
          "component_groups": ["dummy:despawn"]
        },
        "queue_command": {
          "command": [
            "tellraw @a[tag=dev] {\"rawtext\":[{\"text\": \"[\"},{\"selector\": \"@s\"}, {\"text\": \"] dummy:request_despawn\"}]}"
          ]
        }
      }
    }
  }
}
