{
  "format_version": "1.16.0",
  "minecraft:entity": {
    "description": {
      "identifier": "minecraft:player",
      "is_spawnable": false,
      "is_summonable": false,
      "is_experimental": false,
      "scripts": {
        "animate": [
          "root",
          "shields_mainhand",
          "shields_offhand"
        ]
      },
      "animations": {
        "root": "controller.animation.spartan_variables",
        "ataque": "controller.animation.player.ataque",
        "delay": "animation.player.delay",
        "faces": "controller.animation.player.faces2d",
        "crossbow": "controller.animation.player.throw_arrow2",
        "bow": "controller.animation.player.throw_arrow",
        "trident": "controller.animation.player.throw_trident",
        "supports": "controller.animation.player.throw_supports",
        "shields_mainhand": "controller.animation.shields_mainhand",
        "shields_offhand": "controller.animation.shields_offhand",
        "fluidez": "animation.spartan_fluidez",
        "spartan_hands": "controller.animation.spartan_hands",
        "hand_events": "controller.animation.spartan_hand_events",
        "shield_mainhand": "controller.animation.shield_mainhand",
        "shield_offhand": "controller.animation.shield_offhand",
        "damage_condition": "controller.animation.damage_condition"
      }
    },

    "component_groups": {
      "add:hit": {
        "minecraft:is_sheared": {}
      },
      "add:ataque": {
        "minecraft:is_baby": {}
      },
      "minecraft:mhns": {
        "minecraft:knockback_resistance": {
          "value": 0.9
        }
      },
      "minecraft:normal_knockback": {
        "minecraft:knockback_resistance": {
          "value": 0.0
        }
      },
      "minecraft:charged_mainhand": {
        "minecraft:entity_sensor": {
          "sensor_range": 2,
          "minimum_count": 1,
          "event_filters": {
            "all_of": [
              { "test": "is_family", "subject": "other", "value": "projectile" }
            ]
          },
          "event": "minecraft:mainhand_projectile"
        },
        "minecraft:damage_sensor": {
          "triggers": [
            {
              "on_damage": {
                "filters": {
                  "all_of": [
                    { "test": "has_tag", "subject": "other", "operator": "==", "value": "shield_front" }
                  ]
                },
                "event": "minecraft:delay_mainhand_animation"
              },
              "deals_damage": false,
              "on_damage_sound_event": "item.shield.block"
            },
            {
              "cause": "block_explosion",
              "deals_damage": false,
              "on_damage": { "event": "minecraft:delay_mainhand_animation" },
              "on_damage_sound_event": "item.shield.block"
            },
            {
              "on_damage_sound_event": "item.shield.block",
              "on_damage": { "event": "minecraft:delay_mainhand_animation" },
              "cause": "entity_explosion",
              "deals_damage": false
            },
            {
              "deals_damage": true
            }
          ]
        }
      },
      "minecraft:charged_offhand": {
        "minecraft:entity_sensor": {
          "sensor_range": 2,
          "minimum_count": 1,
          "event_filters": {
            "all_of": [
              { "test": "is_family", "subject": "other", "value": "projectile" }
            ]
          },
          "event": "minecraft:offhand_projectile"
        },
        "minecraft:damage_sensor": {
          "triggers": [
            {
              "on_damage": {
                "filters": {
                  "all_of": [
                    { "test": "has_tag", "subject": "other", "operator": "==", "value": "shield_front" }
                  ]
                },
                "event": "minecraft:delay_offhand_animation"
              },
              "deals_damage": false,
              "on_damage_sound_event": "item.shield.block"
            },
            {
              "cause": "block_explosion",
              "deals_damage": false,
              "on_damage": { "event": "minecraft:delay_offhand_animation" },
              "on_damage_sound_event": "item.shield.block"
            },
            {
              "on_damage_sound_event": "item.shield.block",
              "on_damage": { "event": "minecraft:delay_offhand_animation" },
              "cause": "entity_explosion",
              "deals_damage": false
            },
            {
              "deals_damage": true
            }
          ]
        }
      },
      "minecraft:add_bad_omen": {
        "minecraft:spell_effects": {
          "add_effects": [
            {
              "effect": "bad_omen",
              "duration": 6000,
              "display_on_screen_animation": true
            }
          ]
        },
        "minecraft:timer": {
          "time": [ 0.0, 0.0 ],
          "looping": false,
          "time_down_event": {
            "event": "minecraft:clear_add_bad_omen",
            "target": "self"
          }
        }
      },
      "minecraft:clear_bad_omen_spell_effect": {
        "minecraft:spell_effects": {
        }
      },
      "minecraft:raid_trigger": {
        "minecraft:raid_trigger": {
          "triggered_event": {
            "event": "minecraft:remove_raid_trigger",
            "target": "self"
          }
        },
        "minecraft:spell_effects": {
          "remove_effects": "bad_omen"
        }
      }
    },

    "components": {
      "minecraft:experience_reward": {
        "on_death": "Math.Min(query.player_level * 7, 100)"
      },
      "minecraft:type_family": {
        "family": [ "player" ]
      },
      "minecraft:is_hidden_when_invisible": {
      },
      "minecraft:loot": {
        "table": "loot_tables/empty.json"
      },
      "minecraft:collision_box": {
        "width": 0.6,
        "height": 1.8
      },
      "minecraft:can_climb": {
      },
      "minecraft:movement": {
        "value": 0.1
      },
      "minecraft:hurt_on_condition": {
        "damage_conditions": [
          {
            "filters": { "test": "in_lava", "subject": "self", "operator": "==", "value": true },
            "cause": "lava",
            "damage_per_tick": 4
          }
        ]
      },
      "minecraft:attack": {
        "damage": 1
      },
      "minecraft:player.saturation": {
        "value": 20
      },
      "minecraft:player.exhaustion": {
        "value": 0,
        "max": 4
      },
      "minecraft:player.level": {
        "value": 0,
        "max": 24791
      },
      "minecraft:player.experience": {
        "value": 0,
        "max": 1
      },
      "minecraft:breathable": {
        "total_supply": 15,
        "suffocate_time": -1,
        "inhale_time": 3.75,
        "generates_bubbles": false
      },
      "minecraft:nameable": {
        "always_show": true,
        "allow_name_tag_renaming": false
      },
      "minecraft:physics": {
      },
      "minecraft:pushable": {
        "is_pushable": false,
        "is_pushable_by_piston": true
      },
      "minecraft:insomnia": {
        "days_until_insomnia": 3
      },
      "minecraft:rideable": {
        "seat_count": 2,
        "family_types": [
          "parrot_tame"
        ],
        "pull_in_entities": true,
        "seats": [
          {
            "position": [ 0.4, -0.2, -0.1 ],
            "min_rider_count": 0,
            "max_rider_count": 0,
            "lock_rider_rotation": 0
          },
          {
            "position": [ -0.4, -0.2, -0.1 ],
            "min_rider_count": 1,
            "max_rider_count": 2,
            "lock_rider_rotation": 0
          }
        ]
      },
      "minecraft:conditional_bandwidth_optimization": {
      },
      "minecraft:scaffolding_climber": {},
      "minecraft:environment_sensor": {
        "triggers": {
          "filters": {
            "all_of": [
              {
                "test": "has_mob_effect",
                "subject": "self",
                "value": "bad_omen"
              },
              {
                "test": "is_in_village",
                "subject": "self",
                "value": true
              }
            ]
          },
          "event": "minecraft:trigger_raid"
        }
      }
    },

    "events": {
      "minecraft:mainhand_projectile": {
        "run_command": {
          "command": [ "execute @s[tag=este] ~~~ summon add:projectile_mainhand ~1.2 ~ ~", "execute @s[tag=oeste] ~~~ summon add:projectile_mainhand ~-1.2 ~ ~", "execute @s[tag=norte] ~~~ summon add:projectile_mainhand ~ ~ ~-1.2", "execute @s[tag=sur] ~~~ summon add:projectile_mainhand ~ ~ ~1.2"
]
        }
      },
      "minecraft:offhand_projectile": {
        "run_command": {
          "command": [ "execute @s[tag=este] ~~~ summon add:projectile_offhand ~1.2 ~ ~", "execute @s[tag=oeste] ~~~ summon add:projectile_offhand ~-1.2 ~ ~", "execute @s[tag=norte] ~~~ summon add:projectile_offhand ~ ~ ~-1.2", "execute @s[tag=sur] ~~~ summon add:projectile_offhand ~ ~ ~1.2" ]
        }
      },
      "minecraft:mhns": {
        "add": {
          "component_groups": [ "minecraft:mhns" ]
        },

        "remove": {
          "component_groups": [ "minecraft:normal_knockback" ]
        }
      },
      "minecraft:no_mhns": {
        "add": {
          "component_groups": [ "minecraft:normal_knockback" ]
        },
        "remove": {
          "component_groups": [ "minecraft:mhns" ]
        }
      },
      "minecraft:gain_bad_omen": {
        "add": {
          "component_groups": [
            "minecraft:add_bad_omen"
          ]
        }
      },
      "minecraft:spartan_charged_mainhand": {
        "add": {
          "component_groups": [
            "minecraft:charged_mainhand"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:charged_offhand"
          ]
        }
      },
      "minecraft:spartan_charged_offhand": {
        "add": {
          "component_groups": [
            "minecraft:charged_offhand"
          ]
        },
        "remove": {
          "component_groups": [
            "minecraft:charged_mainhand"
          ]
        }
      },
      "minecraft:delay_mainhand_animation": {
        "sequence": [
        {
          "trigger": "add:ataque"
        },
        {
        "filters": {
          "all_of": [
            { "test": "has_tag", "subject": "self", "value": "player_shield" }
          ]
        },
        "run_command": {
          "command": [ "summon add:knockback ~~~" ]
        },
        "trigger": "minecraft:query_shield_mainhand"
        }]
      },
      "minecraft:delay_offhand_animation": {
        "sequence": [
          {
            "trigger": "add:ataque"
          },
          {
            "run_command": {
              "command": [ "summon add:knockback ~~~" ]
            },
            "trigger": "minecraft:query_shield_offhand"
          }
        ]
      },
      "minecraft:query_shield_offhand": {
        "sequence": [
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "wood_shield_offhand" }
              ]
            },
            "trigger": "minecraft:remove_wood_shield_offhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "stone_shield_offhand" }
              ]
            },
            "trigger": "minecraft:remove_stone_shield_offhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "gold_shield_offhand" }
              ]
            },
            "trigger": "minecraft:remove_gold_shield_offhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "iron_shield_offhand" }
              ]
            },
            "trigger": "minecraft:remove_iron_shield_offhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "obsidian_shield_offhand" }
              ]
            },
            "trigger": "minecraft:remove_obsidian_shield_offhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "netherite_shield_offhand" }
              ]
            },
            "trigger": "minecraft:remove_netherite_shield_offhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "diamond_shield_offhand" }
              ]
            },
            "trigger": "minecraft:remove_diamond_shield_offhand"
          }
        ]
      },
      "minecraft:query_shield_mainhand": {
        "sequence": [
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "wood_shield_mainhand" }
              ]
            },
            "trigger": "minecraft:remove_wood_shield_mainhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "stone_shield_mainhand" }
              ]
            },
            "trigger": "minecraft:remove_stone_shield_mainhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "gold_shield_mainhand" }
              ]
            },
            "trigger": "minecraft:remove_gold_shield_mainhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "iron_shield_mainhand" }
              ]
            },
            "trigger": "minecraft:remove_iron_shield_mainhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "obsidian_shield_mainhand" }
              ]
            },
            "trigger": "minecraft:remove_obsidian_shield_mainhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "netherite_shield_mainhand" }
              ]
            },
            "trigger": "minecraft:remove_netherite_shield_mainhand"
          },
          {
            "filters": {
              "all_of": [
                { "test": "has_tag", "subject": "self", "operator": "==", "value": "diamond_shield_mainhand" }
              ]
            },
            "trigger": "minecraft:remove_diamond_shield_mainhand"

          }
        ]
      },
      "minecraft:remove_gold_shield_offhand": {
        "randomize": [
          {
            "weight": 90
          },
          {
            "weight": 10,
            "randomize": [
              {
                "weight": 5,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.offhand 0 air 1" ]
                }
              },
              {
                "weight": 95
              }
            ]            
          }
        ]
      }, 
      "minecraft:remove_wood_shield_mainhand": {
        "randomize": [
          {
            "weight": 95
          },
          {
            "weight": 5,
            "run_command": {
              "command": "replaceitem entity @s slot.weapon.mainhand 0 air 1"
            }
          }
        ]
      },
      "minecraft:remove_wood_shield_offhand": {
        "randomize": [
          {
            "weight": 95 
          },
          {
            "weight": 5,
            "run_command": {
              "command": "replaceitem entity @s slot.weapon.offhand 0 air 1"
            }
          }
        ]
      },
      "minecraft:remove_gold_shield_mainhand": {
        "randomize": [
          {
            "weight": 90
          },
          {
            "weight": 10,
            "randomize": [
              {
                "weight": 5,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.mainhand 0 air 1" ]
                }
              },
              {
                "weight": 95
              }
            ]            
          }
        ]
      },    
      "minecraft:remove_netherite_shield_offhand": {
        "randomize": [
          {
            "weight": 99
          },
          {
            "weight": 1,
            "randomize": [
              {
                "weight": 5,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.offhand 0 air 1"]
                }
              },
              {
                "weight": 995
              }
            ]            
          }
        ]
      },
      "minecraft:remove_netherite_shield_mainhand": {
        "randomize": [
          {
            "weight": 99
          },
          {
            "weight": 1,
            "randomize": [
              {
                "weight": 5,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.mainhand 0 air 1"]
                }
              },
              {
                "weight": 995
              }
            ]            
          }
        ]
      },    
      "minecraft:remove_obsidian_shield_offhand": {
        "randomize": [
          {
            "weight": 99
          },
          {
            "weight": 1,
            "randomize": [
              {
                "weight": 12,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.offhand 0 air 1"]
                }
              },
              {
                "weight": 988
              }
            ]            
          }
        ]
      },
      "minecraft:remove_obsidian_shield_mainhand": {
        "randomize": [
          {
            "weight": 99
          },
          {
            "weight": 1,
            "randomize": [
              {
                "weight": 12,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.mainhand 0 air 1"]
                }
              },
              {
                "weight": 988
              }

            ]            
          }
        ]
      },
      "minecraft:remove_diamond_shield_offhand": {
        "randomize": [
          {
            "weight": 99
          },
          {
            "weight": 1,
            "randomize": [
              {
                "weight": 2,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.offhand 0 air 1"]
                }
              },
              {
                "weight": 98
              }
            ]            
          }

        ]
      },
      "add:ataque": {
        "add": { 
          "component_groups": [ "add:ataque" ]
}
      },
      "minecraft:remove_diamond_shield_mainhand": {
        "randomize": [
          {
            "weight": 99
          },
          {
            "weight": 1,
            "randomize": [
              {
                "weight": 2,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.mainhand 0 air 1"]
                }
              },
              {
                "weight": 98
              }
            ]            
          }
        ]
      },
      "minecraft:remove_iron_shield_offhand": {
        "randomize": [
          {
            "weight": 97
          },
          {
            "weight": 3
          },
          {
            "weight": 25,
            "randomize": [
              {
                "weight": 5,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.offhand 0 air 1"]
                }
              },
              {
                "weight": 95
              }
            ]            
          }
        ]
      },
      "minecraft:remove_iron_shield_mainhand": {
        "randomize": [
          {
            "weight": 97
          },
          {
            "weight": 3,
            "randomize": [
              {
                "weight": 5,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.mainhand 0 air 1"]
                }
              },
              {
                "weight": 95
              }
            ]            
          }
        ]
      },
      "add:hit": {
        "add": {
          "component_groups": [
            "add:hit"
          ]
        }
      },
      "add:none": {
        "remove": {
          "component_groups": [ "add:hit", "add:ataque" ]
        }
      },
      "minecraft:remove_stone_shield_offhand": {
        "randomize": [
          {
            "weight": 99
          },
          {
            "weight": 1,
            "randomize": [
              {
                "weight": 99,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.offhand 0 air 1"]
                }
              },
              {
                "weight": 1
              }
            ]            
          }
        ]
      },
      "minecraft:remove_stone_shield_mainhand": {
        "randomize": [
          {
            "weight": 95
          },
          {
            "weight": 5,
            "randomize": [
              {
                "weight": 95,
                "run_command": {
                  "command": [ "replaceitem entity @s slot.weapon.mainhand 0 air 1"]
                }
              },
              {
                "weight": 5
              }
            ]            
          }
        ]
      },
      "minecraft:spartan_no_charged": {
        "remove": {
          "component_groups": [
            "minecraft:charged_mainhand",
            "minecraft:charged_offhand"
          ]
        }
      },
      "minecraft:clear_add_bad_omen": {
        "remove": {
          "component_groups": [
            "minecraft:add_bad_omen"
          ]
        },
        "add": {
          "component_groups": [
            "minecraft:clear_bad_omen_spell_effect"
          ]
        }
      },
      "minecraft:trigger_raid": {
        "add": {
          "component_groups": [ "minecraft:raid_trigger" ]
        }
      },
      "minecraft:remove_raid_trigger": {
        "remove": {
          "component_groups": [ "minecraft:raid_trigger" ]
        }
      }
    }
  }
}




