scoreboard players set global stickyBlock 0
execute if block ~ ~ ~ #bd:sticky run scoreboard players set global stickyBlock 1
execute if block ~ ~ ~ #bd:sticky_alt run scoreboard players set global stickyBlock 2

scoreboard players set global linkedBlock 0
execute if block ~ ~ ~ #bd:x_axis_linked run scoreboard players set global linkedBlock 1
execute if block ~ ~ ~ #bd:z_axis_linked run scoreboard players set global linkedBlock 2

#do the block -> entity conversion NOW to prevent endless logic loops
function bd:movement/object/convert_to_shulker

#recursively push blocks that are linked to this one
execute if score global linkedBlock matches 1 run function bd:movement/object/linked_blocks/x_axis_move_1

#deal with sticky blocks
execute if score global stickyBlock matches 1 run function bd:movement/object/sticky_block_1
execute if score global stickyBlock matches 2 run function bd:movement/object/sticky_block_alt_1

scoreboard players set @e[limit=1,sort=nearest,tag=setme] moveCommit 1
execute as @e[limit=1,sort=nearest,tag=setme] run scoreboard players operation @s moveCommitTime = global MOVECOMMITTIME
execute positioned ~ ~ ~1 unless block ~ ~ ~ #bd:passable run tag @e[limit=1,sort=nearest,tag=setme] add no_slip
execute if score global linkedBlock matches 1 run tag @e[limit=1,sort=nearest,tag=setme] add log_flip
tag @e[limit=1,sort=nearest,tag=setme] remove setme

#recursively push all blocks that can be pushed
execute positioned ~ ~ ~1 if block ~ ~ ~ #bd:pushable run function bd:movement/object/block_move_1