
# -> Remove temp tag
tag @s remove OverlyRealistic.Animal.TempAnimalCorpse

# -> Apply effects
effect give @s resistance infinite 255 true
effect give @s regeneration infinite 255 true

# -> Apply scale
function overly_realistic:animals/operations/animal_death/apply_scale_to_corpse with storage overly_realistic:animal_attributes

# -> Move corpse
tp @s ~ ~-0.1 ~

# -> Apply data
execute if entity @s[type=sheep] run \
    data modify entity @s Color set from storage overly_realistic:animal_attributes animal_corpses.sheep_color
execute if entity @s[type=sheep] run \
    data modify entity @s Sheared set from storage overly_realistic:animal_attributes animal_corpses.sheep_sheared
execute if entity @s[type=horse] run \
    data modify entity @s Variant set from storage overly_realistic:animal_attributes animal_corpses.horse_variant
execute if entity @s[type=#overly_realistic:specialized_animals_with_variants] run \
    data modify entity @s variant set from storage overly_realistic:animal_attributes animal_corpses.variant

data modify entity @s attributes set from storage overly_realistic:animal_attributes animal_corpses.attributes

execute if score #or.animal_corpse_is_baby OverlyRealistic.General.ArbitraryData matches 1 run \
    data merge entity @s {Age:-1,AgeLocked:1b}

# -> Get var data
scoreboard players operation @s OverlyRealistic.Animal.CorpseHarvestMax = #or.animal_corpse_data OverlyRealistic.Animal.CorpseHarvestMax
scoreboard players operation @s OverlyRealistic.Animal.GeneSet = #or.animal_corpse_data OverlyRealistic.Animal.GeneSet
scoreboard players operation @s OverlyRealistic.Animal.MaxHealth = #or.animal_corpse_data OverlyRealistic.Animal.MaxHealth
scoreboard players operation @s OverlyRealistic.Animal.ScaleSize = #or.animal_corpse_data OverlyRealistic.Animal.ScaleSize
