{
    "format_version": "1.16.100",
    "minecraft:entity": {
        "description": {
            "identifier": "bd:mini_huggy_wuggy_bd",
            "is_spawnable": true,
            "is_summonable": true,
            "is_experimental": false,
            "scripts": {
                "animate": [
					"mini_huggy_wuggy_hug_kill",
					"mini_huggy_wuggy_fall",
					"mini_huggy_wuggy_hug",
					"mini_huggy_cooldown",
					"mini_huggy_wuggy_speed",
					"mini_hug_duck_other",
					"mini_hug_self_control",
					"mini_huggy_hunt_time"
                ]
            },
            "animations": {
				"mini_huggy_wuggy_hug_kill": "controller.animation.mini_huggy_wuggy_hug_kill",
				"mini_huggy_wuggy_hug": "controller.animation.mini_huggy_wuggy_hug",
				"mini_huggy_cooldown": "controller.animation.mini_huggy_cooldown",
				"mini_huggy_wuggy_fall": "controller.animation.mini_huggy_wuggy_fall",
				"mini_huggy_wuggy_speed": "controller.animation.mini_huggy_wuggy_speed",
				"mini_hug_self_control": "controller.animation.mini_hug_self_control",
				"mini_huggy_hunt_time": "controller.animation.mini_huggy_hunt_time",
				
				"mini_hug_time": "animation.mini_hug_time",
				"mini_hug_cooldown_time": "animation.mini_hug_cooldown_time",
				"mini_hug_skill_back": "animation.mini_hug_skill_back",
				"mini_hug_time_kill2": "animation.mini_hug_time_kill2",
				"mini_huggy_knock_time": "animation.mini_huggy_knock_time",
				"mini_huggy_knock_time2": "animation.mini_huggy_knock_time2",
				"mini_huggy_hug2": "animation.mini_huggy_hug2",
				"mini_huggy_speed": "animation.mini_huggy_speed",
				"mini_huggy_calm": "animation.mini_huggy_calm",
				"mini_hug_duck_other": "animation.mini_huggy_duck_other"
            }
        },
        "component_groups": {
			"blue": {
				"minecraft:skin_id": {
					"value": 0
				}
			},
			"green": {
				"minecraft:skin_id": {
					"value": 1
				}
			},
			"red": {
				"minecraft:skin_id": {
					"value": 2
				}
			},
			"yellow": {
				"minecraft:skin_id": {
					"value": 3
				}
			},
			"melee_control": {
				"minecraft:target_nearby_sensor": {
					"inside_range": 2.0,
					"outside_range": 10,
					"must_see": false,
					"on_inside_range": {
						"event": "bd:switch_to_delay",
						"target": "self"
					},
					"on_outside_range": {
						"event": "bd:switch_to_melee",
						"target": "self"
					}
				}
			},
			"show_health": {
				"minecraft:boss": {
					"should_darken_sky": false,
					"name": "§l§eHuggy Wuggy",
					"hud_range": 60
				},
				"minecraft:health": {
					"value": 30,
					"max": 30,
					"min": 0
				}
			},
			"hugged": {
				"minecraft:timer": {
                    "time": 3,
                    "looping": true,
                    "time_down_event": {
                        "event": "bd:stop_hug"
                    }
                }
			},
			"hugged2": {
				"minecraft:timer": {
                    "time": 3,
                    "looping": true,
                    "time_down_event": {
                        "event": "bd:stop_hug"
                    }
                }
			},
			"time_to_hug": {
				"minecraft:timer": {
                    "time": 0.15,
                    "looping": true,
                    "time_down_event": {
                        "event": "bd:hugged"
                    }
                }
			},
			"pro_hit": {
				"minecraft:timer": {
                    "time": 0.3,
                    "looping": true,
                    "time_down_event": {
                        "event": "bd:stop_pro_hit"
                    }
                }
			},
			"attack_target": {
			},
			"attack_target_melee": {
				"minecraft:behavior.stalk_and_pounce_on_target": {
                    "priority": 3,
                    "stalk_speed": 0.8,
                    "max_stalk_dist": 20.0,
                    "leap_height": 0.8,
                    "leap_dist": 1.5,
                    "pounce_max_dist": 10.0,
                    "strike_dist": 6.0,
                    "stuck_time": 1.0,
                    "interest_time": 5,
                    "stuck_blocks": {
                        "test": "is_block",
                        "subject": "block",
                        "operator": "!=",
                        "value": "snow_layer"
                    }
                }
			},
			"jumpscare_duck": {
				"minecraft:rideable": {
					"seat_count": 3,
					"interact_text": "action.interact.ride.bd:huggy_wuggy_bd",
						"family_types": [
							"huggy_hug", "player"
						],
						"seats": [
						{
							"position": [0, 1.1, 1.4],
							"rotate_rider_by": 180,
							"lock_rider_rotation": 0
						},
						{
							"position": [0, 1.1, 1.4],
							"rotate_rider_by": 180,
							"lock_rider_rotation": 0
						},
						{
							"position": [0, 1.1, 1.4],
							"rotate_rider_by": 180,
							"lock_rider_rotation": 0
						}
					]
				},
				"minecraft:variant": {
					"value": 0
				},
				"minecraft:collision_box": {
					"width": 0.6,
					"height": 1.9
				},
				"minecraft:custom_hit_test": {
					"hitboxes": [
						{
							"width": 1,
							"height": 4,
							"pivot": [0, 2, 0]
						}
					]
				},
				"minecraft:is_stunned": {
				}
			},
			"jumpscare_vent": {
				"minecraft:rideable": {
					"seat_count": 3,
					"interact_text": "action.interact.ride.bd:huggy_wuggy_bd",
						"family_types": [
							"huggy_hug", "player"
						],
						"seats": [
						{
							"position": [0, -0.5, 1.4],
							"rotate_rider_by": 180,
							"lock_rider_rotation": 0
						},
						{
							"position": [0, -0.5, 1.4],
							"rotate_rider_by": 180,
							"lock_rider_rotation": 0
						},
						{
							"position": [0, -0.5, 1.4],
							"rotate_rider_by": 180,
							"lock_rider_rotation": 0
						}
					]
				},
				"minecraft:variant": {
					"value": 1
				},
				"minecraft:collision_box": {
					"width": 0.6,
					"height": 1.8
				},
				"minecraft:custom_hit_test": {
					"hitboxes": [
						{
							"width": 1,
							"height": 4,
							"pivot": [0, 2, 0]
						}
					]
				},
				"minecraft:is_sheared": {
				}
			},
			"jumpscare_novent": {
				"minecraft:rideable": {
					"seat_count": 3,
					"interact_text": "action.interact.ride.bd:huggy_wuggy_bd",
						"family_types": [
							"huggy_hug", "player"
						],
						"seats": [
						{
							"position": [0, 1.1, 1.4],
							"rotate_rider_by": 180,
							"lock_rider_rotation": 0
						},
						{
							"position": [0, 1.1, 1.4],
							"rotate_rider_by": 180,
							"lock_rider_rotation": 0
						},
						{
							"position": [0, 1.1, 1.4],
							"rotate_rider_by": 180,
							"lock_rider_rotation": 0
						}
					]
				},
				"minecraft:variant": {
					"value": 0
				},
				"minecraft:collision_box": {
					"width": 0.6,
					"height": 1.9
				},
				"minecraft:custom_hit_test": {
					"hitboxes": [
						{
							"width": 1,
							"height": 4,
							"pivot": [0, 2, 0]
						}
					]
				}
			},
			"in_fall": {
				"minecraft:collision_box": {
					"width": 2.5,
					"height": 1.9
				}
			},
			"not_in_fall": {
				"minecraft:collision_box": {
					"width": 0.6,
					"height": 1.9
				}
			},
			"passive_mode": {
				"minecraft:mark_variant": {
					"value": 0
				}
			},
			"hunt_mode": {
				"minecraft:mark_variant": {
					"value": 1
				}
			},
			"enable_knock_resistance": {
				"minecraft:knockback_resistance": {
					"value": 1.0
				}
			},
			"stop_knock_resistance": {
				"minecraft:knockback_resistance": {
					"value": 0.0
				}
			},
			"main_com": {
				"minecraft:type_family": {
					"family": ["huggy_wuggy_bd", "monster"]
				},
				"minecraft:health": {
					"value": 30,
					"max": 30
				},
				"minecraft:movement": {
					"value": 0.25
				},
				"minecraft:movement.skip": {},
				"minecraft:navigation.walk": {
					"can_path_over_water": true,
					"can_path_over_lava": true,
					"can_pass_doors": true,
					"can_open_doors": true,
					"can_path_from_air": true,
					"avoid_damage_blocks": true,
					"blocks_to_avoid": [
						{
							"name": "minecraft:powder_snow",
							"name": "minecraft:web"
						}
					]
				},
				"minecraft:annotation.open_door": {},
				"minecraft:jump.static": {},
				"minecraft:can_climb": {},
				"minecraft:behavior.nearest_prioritized_attackable_target": {
					"priority": 3,
					"must_see": true,
					"reselect_targets": true,
					"within_radius": 100,
					"must_see_forget_duration": 60,
					"set_persistent": true,
					"entity_types": [{
							"filters": {
								"any_of": [{
										"test": "has_tag",
										"subject": "other",
										"value": "huggy_prey"
									}
								]
							},
							"max_dist": 80,
							"priority": 3
						}, {
							"filters": {
								"all_of": [{
										"test": "is_family",
										"subject": "other",
										"value": "player"
									}, {
										"test": "has_tag",
										"subject": "other",
										"value": "huggy_prey"
									}
								]
							},
							"max_dist": 80,
							"priority": 2
						}
					]
				},
				"minecraft:behavior.delayed_attack": {
					"priority": 4,
					"track_target": true,
					"reach_multiplier": 2.0,
					"attack_duration": 0.5,
					"hit_delay_pct": 0.2,
					"speed_multiplier": 1.8
				},
				"minecraft:damage_sensor": {
					"triggers": [{
							"on_damage": {
								"filters": {
									"all_of": [{
											"test": "is_family",
											"subject": "other",
											"value": "huggy_wuggy_force"
										}
									]
								}
							},
							"deals_damage": false
						}, {
						"deals_damage": true,
							"on_damage": {
								"event": "bd:pro_hit",
								"filters": {
									"all_of": [{
											"test": "has_damage",
											"value": "projectile"
										}
									]
								}
							}
						}
					]
				},
				"minecraft:behavior.random_strol": {
					"priority": 6,
					"interval": 40,
					"xz_dist": 60,
					"y_dist": 30,
					"speed_multiplier": 0.7
				},
				"minecraft:behavior.hurt_by_target": {
					"priority": 2,
					"entity_types": {
						"filters": {
							"test": "is_family",
							"subject": "other",
							"operator": "!=",
							"value": "inanimate"
						},
						"max_dist": 64
					}
				},
				"minecraft:behavior.look_at_player": {
					"priority": 7,
					"look_distance": 6,
					"probability": 0.02
				},
				"minecraft:behavior.random_look_around": {
					"priority": 7
				}
			},
			"jumpscare_skill": {
				"minecraft:behavior.summon_entity": {
					"priority": 1,
					"probability": 100.0,
					"summon_choices": [{
							"weight": 1,
							"cooldown_time": 20.0,
							"cast_duration": 2,
							"max_activation_range": 2.0,
							"min_activation_range": 0,
							"start_sound_event": "plop",
							"sequence": [{
									"shape": "circle",
									"target": "self",
									"base_delay": 0.2,
									"delay_per_summon": 0.0,
									"num_entities_spawned": 1,
									"entity_type": "",
									"entity_lifespan": 1000.0,
									"size": 3.0,
									"sound_event": ""
								}
							]
						}
					]
				}
			}
		},
        "components": {
            "minecraft:nameable": {},
			//huggy component
            "minecraft:experience_reward": {
                "on_death": "query.last_hit_by_player ? 5 + (query.equipment_count * Math.Random(10,50)) : 0"
            },
			"minecraft:variant": {
				"value": 0
			},
			"minecraft:can_power_jump": {},
				"minecraft:horse.jump_strength": {
					"value": 0
				},
			"minecraft:scale":{
				"value": 0.5
			},
			"minecraft:preferred_path": {
				"max_fall_blocks": 20
			},
            "minecraft:collision_box": {
                "width": 0.6,
                "height": 1.9
            },
			"minecraft:rideable": {
				"seat_count": 3,
				"interact_text": "action.interact.ride.bd:huggy_wuggy_bd",
					"family_types": [
						"huggy_hug", "player"
					],
					"seats": [
					{
						"position": [0, 1.1, 1.4],
						"rotate_rider_by": 180,
						"lock_rider_rotation": 0
					},
					{
						"position": [0, 1.1, 1.4],
						"rotate_rider_by": 180,
						"lock_rider_rotation": 0
					},
					{
						"position": [0, 1.1, 1.4],
						"rotate_rider_by": 180,
						"lock_rider_rotation": 0
					}
				]
			},
			"minecraft:behavior.target_when_pushed": {
				"priority": 1,
				"percent_chance": 5.0,
				"entity_types": [
				  {
					"filters": {
					  "any_of": [{
									"test": "is_family",
									"subject": "other",
									"value": "villager"
								}, {
									"test": "is_family",
									"subject": "other",
									"value": "fairy"
								}, {
									"test": "is_family",
									"subject": "other",
									"value": "illager"
								}, {
									"test": "is_family",
									"subject": "other",
									"value": "pig"
								}, {
									"test": "is_family",
									"subject": "other",
									"value": "cow"
								}, {
									"test": "is_family",
									"subject": "other",
									"value": "sheep"
								}, {
									"test": "is_family",
									"subject": "other",
									"value": "irongolem"
								}, {
									"test": "is_family",
									"subject": "other",
									"value": "player"
								}
							]
						}
					}
				]
			},
            "minecraft:pushable": {
                "is_pushable": true,
                "is_pushable_by_piston": true
            },
			"minecraft:follow_range": {
				"value": 100
			},
			"minecraft:behavior.random_stroll": {
				"priority": 6,
				"speed_multiplier": 0.8
			},
            "minecraft:behavior.stay_while_sitting": {
                "priority": 3
            },
            "minecraft:behavior.open_door": {
                "priority": 5,
                "close_door_after": true
            },
			"minecraft:behavior.lay_down": {
                "priority": 7,
                "random_interval": 230,
                "random_stop_interval": 2300
            },

            "minecraft:attack": {
                "damage": [ 5, 10 ]
            },
            "minecraft:behavior.float": {
                "priority": 2
            },
            "minecraft:breathable": {
                "totalSupply": 15,
                "suffocateTime": 0,
                "breathesAir": true,
                "breathesWater": true
            },
			"minecraft:despawn": {
				"despawn_from_distance":{}
			},
            "minecraft:loot": {
                "table": "loot_tables/entities/huggy_wuggy_bd.json"
            },
			"minecraft:physics": {}
        },
        "events": {
			"minecraft:entity_spawned": {
                "add": {
                    "component_groups": ["attack_target", "passive_mode", "jumpscare_novent", "fake_dead", "main_com", "jumpscare_skill", "melee_control", "enable_knock_resistance"]
                },
				"run_command": {
					"command": [
						"event entity @s bd:huggy_color"
					],
					"target": "self"
				}
            },
			"bd:huggy_color": {
				"randomize": [{
                        "weight": 4,
                        "add": {
                            "component_groups": ["blue"]
                        }
                    }, {
                        "weight": 4,
                        "add": {
                            "component_groups": ["green"]
						}
                    }, {
                        "weight": 4,
                        "add": {
                            "component_groups": ["red"]
                        }
                    }, {
                        "weight": 4,
                        "add": {
                            "component_groups": ["yellow"]
                        }
                    }
				]
            },
			"bd:to_dead2": {
                "add": {
                    "component_groups": ["to_become_dead2"]
                }
            },
			"bd:to_dead": {
                "add": {
                    "component_groups": ["to_become_dead", "enable_knock_resistance"]
                }
            },
			"bd:become_dead": {
                "add": {
                    "component_groups": ["become_dead"]
                }
            },
			"bd:stop_fake_dead": {
				"add": {
                    "component_groups": ["melee_control", "main_com"]
                },
                "remove": {
                    "component_groups": ["fake_dead"]
                }
            },
			"bd:is_faking_dead": {
				"remove": {
                    "component_groups": ["melee_control"]
                }
            },
			"bd:fake_dead": {
                "add": {
                    "component_groups": ["fake_dead"]
                }
            },
			"bd:time_to_hug": {
                "add": {
                    "component_groups": ["time_to_hug"]
                }
            },
			"bd:use_melee_control": {
                "add": {
                    "component_groups": ["melee_control"]
                }
            },
			"bd:switch_to_delay": {
                "add": {
                    "component_groups": ["attack_target"]
                },
				"remove": {
                    "component_groups": ["attack_target_melee"]
                }
            },
			"bd:switch_to_melee": {
                "add": {
                    "component_groups": ["attack_target_melee"]
                },
				"remove": {
                    "component_groups": ["attack_target"]
                }
            },
			"bd:pro_hit": {
				"add": {
                    "component_groups": ["pro_hit"]
                },
                "run_command": {
					"command": [
						"tag @s add fall_back"
					],
					"target": "self"
				}
            },
			"bd:stop_pro_hit": {
				"remove": {
                    "component_groups": ["pro_hit"]
                },
                "run_command": {
					"command": [
						"tag @s remove fall_back"
					],
					"target": "self"
				}
            },
			"bd:hugged": {
				"randomize": [{
                        "weight": 4,
                        "add": {
                            "component_groups": ["hugged"]
                        },
						"remove": {
                            "component_groups": ["time_to_hug"]
                        },
						"run_command": {
							"command": [
								"ride @s summon_rider bd:mini_huggy_hug"
							],
							"target": "self"
						}
                    }, {
                        "weight": 5,
                        "add": {
                            "component_groups": ["hugged2"]
                        },
						"remove": {
                            "component_groups": ["time_to_hug"]
                        },
						"run_command": {
							"command": [
								"ride @s summon_rider bd:mini_huggy_hug2"
							],
							"target": "self"
						}
                    }
				]
            },
			"bd:stop_hug": {
                "remove": {
                    "component_groups": ["hugged"]
                }
            },
			"bd:jumpscare_vent": {
                "add": {
                    "component_groups": ["jumpscare_vent"]
                },
				"remove": {
                    "component_groups": ["jumpscare_novent", "jumpscare_duck"]
                }
            },
			"bd:jumpscare_novent": {
                "add": {
                    "component_groups": ["jumpscare_novent"]
                },
				"remove": {
                    "component_groups": ["jumpscare_vent", "jumpscare_duck"]
                }
            },
			"bd:jumpscare_duck": {
                "add": {
                    "component_groups": ["jumpscare_duck"]
                },
				"remove": {
                    "component_groups": ["jumpscare_vent", "jumpscare_novent"]
                }
            },
			"bd:passive_mode": {
                "add": {
                    "component_groups": ["passive_mode"]
                },
				"remove": {
                    "component_groups": ["hunt_mode"]
                }
            },
			"bd:hunt_mode": {
                "add": {
                    "component_groups": ["hunt_mode"]
                },
				"remove": {
                    "component_groups": ["passive_mode"]
                }
            },
			"bd:show_health": {
                "add": {
                    "component_groups": ["show_health"]
                }
            },
			"bd:hide_health": {
                "remove": {
                    "component_groups": ["show_health"]
                }
            },
			"bd:use_jumpscare": {
                "add": {
                    "component_groups": ["jumpscare_skill"]
                }
            },
			"bd:stop_jumpscare": {
                "remove": {
                    "component_groups": ["jumpscare_skill"]
                }
            },
			"bd:enable_knock_resistance": {
                "add": {
                    "component_groups": ["enable_knock_resistance"]
                }
            },
			"bd:stop_knock_resistance": {
				"add": {
                    "component_groups": ["stop_knock_resistance"]
                }
            },
			"bd:in_fall": {
				"add": {
                    "component_groups": ["in_fall"]
                }
            },
			"bd:not_in_fall": {
				"add": {
                    "component_groups": ["not_in_fall"]
                }
            },
			"bd:knock_when_hit": {
				"randomize": [{
                        "weight": 4,
						"run_command": {
							"command": [
								"execute as @s at @s run summon bd:huggy_force ^^-0.01^-0.001",
								"execute as @s at @s run particle bd:huggy_blood ^^0.1^-1"
								
							],
							"target": "self"
						}
                    }, {
                        "weight": 5,
                        "run_command": {
							"command": [
								"execute as @s at @s run summon bd:huggy_force ^^-0.01^0.001",
								"execute as @s at @s run particle bd:huggy_blood ^^0.1^1"
							],
							"target": "self"
						}
                    }, {
                        "weight": 4,
                        "run_command": {
							"command": [
								"execute as @s at @s run summon bd:huggy_force ^0.001^-0.01^",
								"execute as @s at @s run particle bd:huggy_blood ^1^0.1^"
							],
							"target": "self"
						}
                    }, {
                        "weight": 5,
                        "run_command": {
							"command": [
								"execute as @s at @s run summon bd:huggy_force ^-0.001^-0.01^",
								"execute as @s at @s run particle bd:huggy_blood ^-1^0.1^"
							],
							"target": "self"
						}
                    }, {
                        "weight": 4,
						"run_command": {
							"command": [
								"execute as @s at @s run summon bd:huggy_force ^0.001^-0.01^-0.001",
								"execute as @s at @s run particle bd:huggy_blood ^1^0.1^-1"
							],
							"target": "self"
						}
                    }, {
                        "weight": 5,
                        "run_command": {
							"command": [
								"execute as @s at @s run summon bd:huggy_force ^-0.001^-0.01^0.001",
								"execute as @s at @s run particle bd:huggy_blood ^-1^0.1^1"
							],
							"target": "self"
						}
                    }, {
                        "weight": 4,
                        "run_command": {
							"command": [
								"execute as @s at @s run summon bd:huggy_force ^0.001^-0.01^0.001",
								"execute as @s at @s run particle bd:huggy_blood ^1^0.1^1"
							],
							"target": "self"
						}
                    }, {
                        "weight": 5,
                        "run_command": {
							"command": [
								"execute as @s at @s run summon bd:huggy_force ^-0.001^-0.01^-0.001",
								"execute as @s at @s run particle bd:huggy_blood ^-1^0.1^-1"
							],
							"target": "self"
						}
                    }
				]
            }
		}
    }
}