
# -> Datafix
#execute if data storage overly_realistic:animal_attributes {animal_death_current_scale:0.0d} run \
    data modify storage overly_realistic:animal_attributes animal_death_current_scale set value 1.0d

# -> Particle
particle block_crumble{block_state:"redstone_block"} ~ ~ ~ 1 2 1 1 30 normal @a

# -> Create animal corpse
function overly_realistic:animals/operations/animal_death/create_animal_corpse

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

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

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

# -> Operate on animal corpse
execute as @n[type=#overly_realistic:all_specialized_animals,tag=OverlyRealistic.Animal.TempAnimalCorpse,distance=..1] run \
    function overly_realistic:animals/operations/animal_death/edit_animal_corpse

# -> Remove entity
tp @s ~ ~-9999 ~
#execute on vehicle run \
    kill @s
