{
  "format_version": "1.13.0",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:zombie_pigman",
      "is_spawnable": true,
      "is_summonable": true,
      "is_experimental": false,
      "scripts": {
        "animate": [
          { "particle": "query.is_stunned" }
        ]
      },
      "animations": {
        "particle": "controller.animation.chemical_mutating"
      }
    },
    "component_groups": {
      "mutant_explode": {
        "minecraft:explode": {
          "fuse_length": 1.5,
          "fuse_lit": true,
          "power": 1,
          "causes_fire": true,
          "destroy_affected_by_griefing": true
        }
      },

      "mutant_transform": {
    
        "minecraft:movement": {
          "value": 0.1
        },
        "minecraft:behavior.knockback_roar": {
          "priority": 1,
          "duration": 0.1,
          "attack_time": 0.1,
          "knockback_damage": 1,
          "knockback_strength": 3,
          "knockback_range": 10,
          "cooldown_time": 30,
          "knockback_filters": {
        "all_of": [
          { "test": "is_family", "subject": "other", "operator": "!=", "value": "chemical_x" }
        ]
          },
        
          "damage_filters": {
        "all_of": [
          { "test": "is_family", "subject": "other", "value": "player" }
        ]
          }
        },
        "minecraft:transformation": {
         
          "transformation_sound": "remedy",
          "into": "mutant:mutant_zombified_piglin",
          "delay": 0.2
        }
      },
      "mutation": {
        "minecraft:is_stunned": {
        },
        "minecraft:damage_sensor": {
          "triggers": {
            "on_damage": {
              "filters": { "test" :  "is_family", "subject" : "other", "value" :  "chemical_x"}
            },
            "deals_damage": true
          }
        },
        "minecraft:spell_effects": {

          "add_effects": [
            {
              "effect": "fire_resistance",
              "amplifier": 4,
              "visible": true,
              "ambient": false,
              "duration": 20
            },
            {
              "effect": "wither",
              "amplifier": 1,
              "visible": true,
              "ambient": false,
              "duration": 20
            },
            {
              "effect": "regeneration",
              "amplifier": 4,
              "visible": false,
              "ambient": false,
              "duration": 20
            }
 
          ]
        },
        "minecraft:transformation": {
          "into": "",
          "begin_transform_sound": "remedy",
          "transformation_sound": "unfect",
          "keep_level": true,
          "delay": 30
        },
     
        "minecraft:is_shaking": {
        },

        "minecraft:attack_cooldown": {
          "attack_cooldown_time": [ 8.0, 15.0 ],
          "attack_cooldown_complete_event": {
            "event": "mutate",
            "target": "self"
          }
        },
        "minecraft:mark_variant": {
          "value": 3
        }
   
      
       
      },
      "minecraft:pig_zombie_baby": {
        "minecraft:experience_reward": {
          "on_death": "query.last_hit_by_player ? 12 + (query.equipment_count * Math.Random(1,3)) : 0"
        },
        "minecraft:is_baby": {
        },
        "minecraft:scale": {
          "value": 0.5
        }
      },

      "minecraft:pig_zombie_adult": {
        "minecraft:rideable": {
          "seat_count": 1,
          "family_types": [
            "zombie"
          ],
          "seats": {
            "position": [ 0.0, 1.1, -0.35 ],
            "lock_rider_rotation": 0
          }
        },
        "minecraft:experience_reward": {
          "on_death": "query.last_hit_by_player ? 5 + (query.equipment_count * Math.Random(1,3)) : 0"
        }
      },
      "minecraft:pig_zombie_angry": {
        "minecraft:angry": {
          "duration": 25,
          "broadcast_anger": true,
          "broadcast_range": 20,
          "calm_event": {
            "event": "minecraft:on_calm",
            "target": "self"
          }
        }
      },
      "minecraft:pig_zombie_calm": {
        "minecraft:behavior.hurt_by_target": {
          "priority": 1
        }
      }
    },

    "components": {
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": 0,
        "breathes_water": true
      },
      "minecraft:collision_box": {
        "width": 0.6,
        "height": 1.9
      },
      "minecraft:nameable": {
      },
      "minecraft:damage_sensor": {
        "triggers": {
          "on_damage": {
            "filters": { "test" :  "is_family", "subject" : "other", "value" :  "chemical_x"},
            "event": "become_mutated"
          },
          "deals_damage": false
        }
      },
      "minecraft:navigation.walk": {
        "is_amphibious": true,
        "can_pass_doors": true,
        "can_open_doors": true,
        "avoid_water": true,
        "avoid_portals": true
      },
      "minecraft:movement.basic": {
      },
      "minecraft:jump.static": {
      },
      "minecraft:can_climb": {
      },
      "minecraft:fire_immune": true,
      "minecraft:burns_in_daylight": false,
      "minecraft:type_family": {
        "family": [ "zombie_pigman", "undead", "monster", "mob" ]
      },
      "minecraft:loot": {
        "table": "loot_tables/entities/zombie_pigman.json"
      },
      "minecraft:equipment": {
        "table": "loot_tables/entities/zombie_pigman_gear.json"
      },
      "minecraft:health": {
        "value": 20,
        "max": 20
      },
      "minecraft:movement": {
        "value": 0.23
      },
      "minecraft:attack": {
        "damage": 5
      },
      "minecraft:behavior.mount_pathing": {
        "priority": 2,
        "speed_multiplier": 1.25,
        "target_dist": 0,
        "track_target": true
      },
      "minecraft:behavior.melee_attack": {
        "priority": 3,
        "speed_multiplier": 1.5,
        "track_target": false
      },
      "minecraft:behavior.stomp_turtle_egg": {
        "priority": 4,
        "speed_multiplier": 1,
        "search_range": 10,
        "search_height": 3,
        "goal_radius": 1.14,
        "search_count": 4,
        "interval": 20
      },
      "minecraft:behavior.move_towards_restriction": {
        "priority": 5
      },
      "minecraft:behavior.random_stroll": {
        "priority": 7,
        "speed_multiplier": 1.0
      },
      "minecraft:behavior.look_at_player": {
        "priority": 8,
        "look_distance": 6.0,
        "probability": 0.02
      },
      "minecraft:behavior.random_look_around": {
        "priority": 9
      },
     
      "minecraft:physics": {
      },
      "minecraft:pushable": {
        "is_pushable": true,
        "is_pushable_by_piston": true
      }
    },


    "events": {
      "minecraft:entity_transformed": {
        "sequence": [
       
          {
            "filters": {
              "test": "has_component",
              "subject": "other",
              "value": "minecraft:is_baby"
            },
            "add": {
              "component_groups": [
                "minecraft:pig_zombie_baby",
                "minecraft:pig_zombie_calm"
              ]
            }
          },
        
          {
            "filters": {
              "test": "has_component",
              "subject": "other",
              "operator": "!=",
              "value": "minecraft:is_baby"
            },
            "add": {
              "component_groups": [
                "minecraft:pig_zombie_adult",
                "minecraft:pig_zombie_calm"
              ]
            }
          }
        ]
      },
      "minecraft:entity_spawned": {
        "randomize": [
          {
            "weight": 95,
            "remove": {
            },
            "add": {
              "component_groups": [
                "minecraft:pig_zombie_adult",
                "minecraft:pig_zombie_calm"
              ]
            }
          },
          {
            "weight": 5,
            "remove": {
            },
            "add": {
              "component_groups": [
                "minecraft:pig_zombie_baby",
                "minecraft:pig_zombie_calm"
              ]

            }
          }
        ]
      },
      "become_mutated": {
        "add": {
          "component_groups": [
            "mutation"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:pig_zombie_angry",
            "minecraft:pig_zombie_calm"
          ]

        }
      },

      "mutate": {
        "randomize": [
          {
            "weight": 15,
            "remove": {
            },
            "add": {
              "component_groups": [
                "mutant_transform"
              ]

            }
          },


          {
            "weight": 10,
            "remove": {
            },
            "add": {
              "component_groups": [
                "mutant_explode"
              ]
            }
          }
        ]
      },
      "minecraft:on_calm": {
        "remove": {
          "component_groups": [
            "minecraft:pig_zombie_angry"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:pig_zombie_calm"
          ]
        }
      },
      "minecraft:become_angry": {
        "remove": {
          "component_groups": [
            "minecraft:pig_zombie_calm"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:pig_zombie_angry"
          ]
        }
      }
    }
  }
}
