
# -> Remove Display
execute as @n[type=block_display,tag=OverlyRealistic.Block.TanningRack,distance=..0.5] \
    on passengers run \
        kill @s
kill @n[type=block_display,tag=OverlyRealistic.Block.TanningRack,distance=..0.5]

# -> If tanning rack is filled then drop items
execute if entity @s[tag=OverlyRealistic.Block.TanningRack_Status_Filled] run \
    function overly_realistic:general/custom_blocks/tanning_rack/drop_current_item_filled_rack

# -> Remove barrier
fill ~ ~ ~ ~ ~ ~ air replace barrier

# -> Check for creative mode
scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 0
execute on origin \
    if entity @s[gamemode=creative] run \
        scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 1

# -> Drop item
execute unless score #or.global OverlyRealistic.General.ArbitraryData matches 1 run \
    function overly_realistic:general/custom_blocks/tanning_rack/tanning_rack_break with entity @s data

# -> Sound
playsound block.wood.break block @a ~ ~ ~ 1 1
playsound block.wood.break block @a ~ ~ ~ 1 1
playsound entity.zombie.break_wooden_door block @a ~ ~ ~ 0.2 1.5

# -> Remove marker
kill @s