Problem with timer
tick.mcfunction:
Continue to help postexecute if data storage cmd:tickdata {susSandTickFunction:1} run function cmd:suspicious_sand_tick
scoreboard players add @a 6mTimer 1
execute as @a[scores={6mTimer=7201}] run scoreboard players set @a 6mTimer 0
These lines are executed every tick.
suspicious_sand_on.mcfunction:
data modify storage cmd:tickdata susSandTickFunction set value 1
suspicious_sand_off.mcfunction:
data modify storage cmd:tickdata susSandTickFunction set value 0
suspicious_sand_tick.mcfunction:
execute as @a[scores={6mTimer=7200}] run function cmd:suspicious_sand
I want this to be executed when the Timer reaches 6 min.
suspicious_sand.mcfunction:
give @a suspicious_sand{BlockEntityTag:{LootTable:"cmd:suspicious_sand_selector"}} 6
As you can see, this line should give every player 6 blocks of suspicious sand. But instead it gives 12. It's probably because suspicious_sand.mcfunction
is executed more than once at the same tick, but I have no idea how to fix that.
Note: It's not a problem with the loot table. When executing the suspicious_sand.mcfunction
using /function in-game, it gives 6 suspicious sand blocks.