
#take UUID part 1, divide by 161 and take the remainder to get a random number between 0 and 160. Subtract 80 to shift the number range from -80 to +80. Then get the current X coord and subtract the random number from it.
execute at @s run execute store result score @s KyuDummy run data get entity @s UUID[0] .1
scoreboard players set @s KyuDummy2 161
scoreboard players operation @s KyuDummy %= @s KyuDummy2
scoreboard players remove @s KyuDummy 80
execute at @s run execute store result score @s PosX run data get entity @s Pos[0] 1
execute as @s run scoreboard players operation @s PosX -= @s KyuDummy
execute as @s run execute store result entity @s Pos[0] double 1 run scoreboard players get @s PosX



#same as before, but with the Z coord this time
execute at @s run execute store result score @s KyuDummy run data get entity @s UUID[2] .1
scoreboard players set @s KyuDummy2 161
scoreboard players operation @s KyuDummy %= @s KyuDummy2
scoreboard players remove @s KyuDummy 80
execute at @s run execute store result score @s PosZ run data get entity @s Pos[2] 1
execute as @s run scoreboard players operation @s PosZ -= @s KyuDummy
execute as @s run execute store result entity @s Pos[2] double 1 run scoreboard players get @s PosZ

#center the entity on its current block
execute at @s run tp @s ~.5 ~ ~.5

scoreboard players add @s KyuDummy3 0
execute at @s run execute if block ~ 140 ~ #suhc:bloodboltpassthrough run scoreboard players add @s KyuDummy3 1
execute at @s run execute if block ~ 145 ~ #suhc:bloodboltpassthrough run scoreboard players add @s KyuDummy3 1
execute at @s run execute if block ~ 150 ~ #suhc:bloodboltpassthrough run scoreboard players add @s KyuDummy3 1
execute at @s run execute if block ~ 155 ~ #suhc:bloodboltpassthrough run scoreboard players add @s KyuDummy3 1
execute at @s run execute if block ~ 160 ~ #suhc:bloodboltpassthrough run scoreboard players add @s KyuDummy3 1
execute at @s run execute if block ~ 165 ~ #suhc:bloodboltpassthrough run scoreboard players add @s KyuDummy3 1
execute at @s run execute if block ~ 170 ~ #suhc:bloodboltpassthrough run scoreboard players add @s KyuDummy3 1
tag @s add LowLantern
tag @s[scores={KyuDummy3=..6}] remove LowLantern

execute at @s[tag=LowLantern] run summon armor_stand ~ 175 ~ {Invisible:1,Rotation:[0F,0F],NoGravity:1b,Passengers:[{id:"minecraft:falling_block",DropItem:0b,Tags:["LanternSand"],NoGravity:1b,BlockState:{Name:"minecraft:lantern"},Time:-9999}],Small:1b,Tags:["LanternEventStands"],DisabledSlots:4144959}
execute at @s[tag=!LowLantern] run summon armor_stand ~ 255 ~ {Invisible:1,Rotation:[0F,0F],NoGravity:1b,Passengers:[{id:"minecraft:falling_block",DropItem:0b,Tags:["LanternSand"],NoGravity:1b,BlockState:{Name:"minecraft:lantern"},Time:-9999}],Small:1b,Tags:["LanternEventStands"],DisabledSlots:4144959}

kill @s