{
  "format_version": "1.16.0",
  "minecraft:entity": {
    "description": {
      "identifier": "lifeboat:totem",
      "runtime_identifier": "minecraft:ghast",
      "is_spawnable": false,
      "is_summonable": true,
      "is_experimental": false,
      "scripts": {
        "animate": [ "totem" ]
      },
      "animations": {
        "totem": "controller.animation.totem"
      }
    },

    "component_groups": {

      "detonation": {
        "minecraft:transformation": {
          "into": "lifeboat:explode_gas",
          "delay": {
            "value": 0.1
          }
        }
      },

      "turn_0":{
        "minecraft:mark_variant": {
          "value": 0
        }
      },
      "turn_1":{
        "minecraft:mark_variant": {
          "value": 1
        }
      },
      "turn_2":{
        "minecraft:mark_variant": {
          "value": 2
        }
      },
      "turn_3":{
        "minecraft:mark_variant": {
          "value": 3
        }
      },
      "turn_4":{
        "minecraft:mark_variant": {
          "value": 4
        }
      },
      "turn_5":{
        "minecraft:mark_variant": {
          "value": 5
        }
      },
      "turn_6":{
        "minecraft:mark_variant": {
          "value": 6
        }
      },
      "turn_7":{
        "minecraft:mark_variant": {
          "value": 7
        }
      },

      "text0": {
        "minecraft:variant": {
          "value": 0
        }
      },
      "text1": {
        "minecraft:variant": {
          "value": 1
        }
      },
      "text2": {
        "minecraft:variant": {
          "value": 2
        }
      },


      "zombie": {
        "minecraft:spawn_entity": {
          "entities": [
          {
            "min_wait_time": 0,
            "max_wait_time": 0,
            "spawn_sound": "plop",
            "num_to_spawn": 3,
            "single_use": true,
            "spawn_entity": "minecraft:zombie"
          }
        ]
        },
        "minecraft:skin_id": {
          "value": 0
        }
      },
      "skeleton": {
        "minecraft:spawn_entity": {
          "entities": [
          {
            "min_wait_time": 0,
            "max_wait_time": 0,
            "spawn_sound": "plop",
            "num_to_spawn": 3,
            "single_use": true,
            "spawn_entity": "minecraft:skeleton"
          }
        ]
        },
        "minecraft:skin_id": {
          "value": 1
        }
      },
      "creeper": {
        "minecraft:spawn_entity": {
          "entities": [
          {
            "min_wait_time": 0,
            "max_wait_time": 0,
            "spawn_sound": "plop",
            "num_to_spawn": 3,
            "single_use": true,
            "spawn_entity": "minecraft:creeper"
          }
        ]
        },
        "minecraft:skin_id": {
          "value": 2
        }
      },
      "enderman": {
        "minecraft:spawn_entity": {
          "entities": [
          {
            "min_wait_time": 0,
            "max_wait_time": 0,
            "spawn_sound": "plop",
            "num_to_spawn": 3,
            "single_use": true,
            "spawn_entity": "minecraft:enderman"
          }
        ]
        },
        "minecraft:skin_id": {
          "value": 3
        }
      },
      "ghast": {
        "minecraft:spawn_entity": {
          "entities": [
          {
            "min_wait_time": 0,
            "max_wait_time": 0,
            "spawn_sound": "plop",
            "num_to_spawn": 3,
            "single_use": true,
            "spawn_entity": "minecraft:ghast"
          }
        ]
        },
        "minecraft:skin_id": {
          "value": 4
        }
      },
      "slime": {
        "minecraft:spawn_entity": {
          "entities": [
          {
            "min_wait_time": 0,
            "max_wait_time": 0,
            "spawn_sound": "plop",
            "num_to_spawn": 3,
            "single_use": true,
            "spawn_entity": "minecraft:slime"
          }
        ]
        },
        "minecraft:skin_id": {
          "value": 5
        }
      },
      "spider": {
        "minecraft:spawn_entity": {
          "entities": [
          {
            "min_wait_time": 0,
            "max_wait_time": 0,
            "spawn_sound": "plop",
            "num_to_spawn": 3,
            "single_use": true,
            "spawn_entity": "minecraft:spider"
          }
        ]
        },
        "minecraft:skin_id": {
          "value": 6
        }
      },
      "phantom": {
        "minecraft:spawn_entity": {
          "entities": [
          {
            "min_wait_time": 0,
            "max_wait_time": 0,
            "spawn_sound": "plop",
            "num_to_spawn": 3,
            "single_use": true,
            "spawn_entity": "minecraft:phantom"
          }
        ]
        },
        "minecraft:skin_id": {
          "value": 7
        }
      },

      "timer_inside": {
        "minecraft:timer": {
          "time": [30.0, 30.0],
          "looping": true,
          "time_down_event": {
            "event": "spawn_entity",
            "target": "self"
          }
        }
      },
      "timer_outside": {
        "minecraft:timer": {
          "time": [300.0, 300.0],
          "looping": true,
          "time_down_event": {
            "event": "spawn_entity",
            "target": "self"
          }
        }
      }
      
    },

    "components": {
      "minecraft:collision_box": {
          "width": 1.5,
          "height": 6.0
      },
      "minecraft:target_nearby_sensor": {
        "inside_range": 50.0,
        "outside_range": 52.0,
        "must_see": false,
        "on_inside_range": {
          "event": "timer_inside",
          "target": "self"
        },
        "on_outside_range": {
          "event": "timer_outside",
          "target": "self"
        }
      },
      "minecraft:behavior.ranged_attack": {
        "priority": 3,
        "burst_shots": 3,
        "burst_interval": 1.0,
        "charge_charged_trigger": 2.0,
        "charge_shoot_trigger": 2.0,
        "attack_interval_min": 5.0,
        "attack_interval_max": 7.0,
        "attack_radius": 25.0
      },
      "minecraft:shooter": {
        "def": "minecraft:fireball"
      },
      "minecraft:navigation.walk": {},
      "minecraft:movement": {
        "value": 0.0
      },
      "minecraft:fire_immune": {},
      //"minecraft:behavior.hurt_by_target": {},
      "minecraft:behavior.nearest_attackable_target": {
        "priority": 1,
        "within_radius": 50,
        "reselect_targets": true,
        "entity_types": [
          { 
            "filters": 
            {  
              "test": "is_family", "subject": "other", "value": "player" 
            }, 
            "max_dist": 50
          }
        ],
        "must_see": true
      },
      "minecraft:follow_range": {
        "value": 50,
        "max": 50
      },
      "minecraft:boss": {
        "hud_range": 30,
        "name": "Totem",
        "should_darken_sky": true
      },
      "minecraft:area_attack" : {
        "damage_range": 1.0,
        "damage_per_tick": 3,
        "cause": "contact",
        "entity_filter": {
          "any_of": [
            { "test": "is_family", "subject": "other", "value": "player" }
          ]
        }
      },
      "minecraft:tick_world": {},
      "minecraft:damage_sensor": {
        "triggers": [

          {
            "on_damage": {
              "filters": {
                "all_of": [
                  { "test": "has_damage", "value": "fatal" }
                ]
              },
              "event": "detonation",
              "target": "self"
            }
          },

          {
            "on_damage": {
              "filters": {
                "all_of": [
                  { "test": "is_family", "subject": "other", "value": "player" },
                  { "test": "has_equipment", "domain": "hand", "subject": "other", "value": "bone" }
                ]
              },
              "event": "rotate",
              "target": "self"
            },
            "deals_damage": false
          }

        ]
      },
      "minecraft:health": {
        "value": 150,
        "max": 150
      },
      "minecraft:type_family": {
        "family": [ "totem" ]
      },
      "minecraft:nameable": {},
      "minecraft:pushable": {
        "is_pushable": false
      },
      "minecraft:knockback_resistance": {
        "value": 10.0
      },
	    "minecraft:physics": {},
      "minecraft:movement.basic":{}
    },

    "events":{

      "detonation": {
        "add": {
          "component_groups": [
            "detonation"
          ]
        }
      },

      "timer_inside": {
        "remove": {
          "component_groups": [
            "timer_outside"
          ]
        },
        "add": {
          "component_groups": [
            "timer_inside"
          ]
        }
      },
      "timer_outside": {
        "remove": {
          "component_groups": [
            "timer_inside"
          ]
        },
        "add": {
          "component_groups": [
            "timer_outside"
          ]
        }
      },

      "minecraft:entity_spawned": {
        "sequence": [
          {
            "randomize": [
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "text0",
                    "timer_outside"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "text1",
                    "timer_outside"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "text2",
                    "timer_outside"
                  ]
                }
              }
            ]
          }
        ]
      },

      "spawn_entity": {
        "sequence": [
          {
            "filters": {
              "test": "is_skin_id", 
              "value": 0
            },
            "remove": {
              "component_groups": [
                "zombie"
              ]
            },
            "randomize": [
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "skeleton"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "creeper"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "enderman"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "ghast"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "slime"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "spider"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "phantom"
                  ]
                }
              }
            ]
          },
          {
            "filters": {
              "test": "is_skin_id", 
              "value": 1
            },
            "remove": {
              "component_groups": [
                "skeleton"
              ]
            },
            "randomize": [
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "zombie"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "creeper"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "enderman"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "ghast"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "slime"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "spider"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "phantom"
                  ]
                }
              }
            ]
          },
          {
            "filters": {
              "test": "is_skin_id", 
              "value": 2
            },
            "remove": {
              "component_groups": [
                "creeper"
              ]
            },
            "randomize": [
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "skeleton"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "zombie"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "enderman"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "ghast"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "slime"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "spider"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "phantom"
                  ]
                }
              }
            ]
          },
          {
            "filters": {
              "test": "is_skin_id", 
              "value": 3
            },
            "remove": {
              "component_groups": [
                "enderman"
              ]
            },
            "randomize": [
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "skeleton"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "creeper"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "zombie"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "ghast"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "slime"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "spider"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "phantom"
                  ]
                }
              }
            ]
          },
          {
            "filters": {
              "test": "is_skin_id", 
              "value": 4
            },
            "remove": {
              "component_groups": [
                "ghast"
              ]
            },
            "randomize": [
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "skeleton"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "creeper"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "enderman"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "zombie"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "slime"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "spider"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "phantom"
                  ]
                }
              }
            ]
          },
          {
            "filters": {
              "test": "is_skin_id", 
              "value": 5
            },
            "remove": {
              "component_groups": [
                "slime"
              ]
            },
            "randomize": [
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "skeleton"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "creeper"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "enderman"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "ghast"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "zombie"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "spider"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "phantom"
                  ]
                }
              }
            ]
          },
          {
            "filters": {
              "test": "is_skin_id", 
              "value": 6
            },
            "remove": {
              "component_groups": [
                "spider"
              ]
            },
            "randomize": [
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "skeleton"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "creeper"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "enderman"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "ghast"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "slime"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "zombie"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "phantom"
                  ]
                }
              }
            ]
          },
          {
            "filters": {
              "test": "is_skin_id", 
              "value": 7
            },
            "remove": {
              "component_groups": [
                "phantom"
              ]
            },
            "randomize": [
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "skeleton"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "creeper"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "enderman"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "ghast"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "slime"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "spider"
                  ]
                }
              },
              {
                "weight": 1,
                "add": {
                  "component_groups": [
                    "zombie"
                  ]
                }
              }
            ]
          }
        ]
      },

      "rotate": {
        "sequence": [
          {
            "filters": {
              "test": "is_mark_variant", 
              "value": 0
            },
            "remove": {
              "component_groups": [
                "turn_0"
              ]
            },
            "add": {
              "component_groups": [
                "turn_1"
              ]
            }
          },
          {
            "filters": {
              "test": "is_mark_variant", 
              "value": 1
            },
            "remove": {
              "component_groups": [
                "turn_1"
              ]
            },
            "add": {
              "component_groups": [
                "turn_2"
              ]
            }
          },
          {
            "filters": {
              "test": "is_mark_variant", 
              "value": 2
            },
            "remove": {
              "component_groups": [
                "turn_2"
              ]
            },
            "add": {
              "component_groups": [
                "turn_3"
              ]
            }
          },
          {
            "filters": {
              "test": "is_mark_variant", 
              "value": 3
            },
            "remove": {
              "component_groups": [
                "turn_3"
              ]
            },
            "add": {
              "component_groups": [
                "turn_4"
              ]
            }
          },
          {
            "filters": {
              "test": "is_mark_variant", 
              "value": 4
            },
            "remove": {
              "component_groups": [
                "turn_4"
              ]
            },
            "add": {
              "component_groups": [
                "turn_5"
              ]
            }
          },
          {
            "filters": {
              "test": "is_mark_variant", 
              "value": 5
            },
            "remove": {
              "component_groups": [
                "turn_5"
              ]
            },
            "add": {
              "component_groups": [
                "turn_6"
              ]
            }
          },
          {
            "filters": {
              "test": "is_mark_variant", 
              "value": 6
            },
            "remove": {
              "component_groups": [
                "turn_6"
              ]
            },
            "add": {
              "component_groups": [
                "turn_7"
              ]
            }
          },
          {
            "filters": {
              "test": "is_mark_variant", 
              "value": 7
            },
            "remove": {
              "component_groups": [
                "turn_7"
              ]
            },
            "add": {
              "component_groups": [
                "turn_0"
              ]
            }
          }
        ]
      }

    }
  }
}
