
# -> Remove Display
execute on passengers run \
    kill @s[tag=OverlyRealistic.Block.WoodenRack]

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

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

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

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

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

# -> Remove interaction
kill @s