execute unless score global availableResets matches 99.. run scoreboard players add global availableResets 1

scoreboard players add global undoStackHead 1
execute if score global undoStackHead matches 101.. run scoreboard players set global undoStackHead 1

scoreboard players set global hasArm 0
execute if entity @e[limit=1,tag=player_char,tag=!arm_disconnected] run scoreboard players set global hasArm 1

clone 0 79 0 31 87 31 16 4 16

execute if score global undoStackHead matches 1..10 positioned 15 3 15 run function bd:game/record_undo/_index_1_10
execute if score global undoStackHead matches 11..20 positioned 15 3 15 run function bd:game/record_undo/_index_11_20
execute if score global undoStackHead matches 21..30 positioned 15 3 15 run function bd:game/record_undo/_index_21_30
execute if score global undoStackHead matches 31..40 positioned 15 3 15 run function bd:game/record_undo/_index_31_40
execute if score global undoStackHead matches 41..50 positioned 15 3 15 run function bd:game/record_undo/_index_41_50
execute if score global undoStackHead matches 51..60 positioned 15 3 15 run function bd:game/record_undo/_index_51_60
execute if score global undoStackHead matches 61..70 positioned 15 3 15 run function bd:game/record_undo/_index_61_70
execute if score global undoStackHead matches 71..80 positioned 15 3 15 run function bd:game/record_undo/_index_71_80
execute if score global undoStackHead matches 81..90 positioned 15 3 15 run function bd:game/record_undo/_index_81_90
execute if score global undoStackHead matches 91..100 positioned 15 3 15 run function bd:game/record_undo/_index_91_100

setblock 15 3 16 redstone_block

scoreboard players set global recordNextReset 0