detect crossing chunk borders
I have programmed a chunk claim data pack that tries to not do as much as a mod. But somehow the part that puts the people into adventure mode when they enter the chunk is lagging out the server, so I want to redo it and only have it check whether it should put the the player into adventure mode when he crosses a chunk border.
The way I do this right now is I save the players chunk coordinates at the start in two different scores for each axis at the start and at the end of the function.
In the middle I check whether the two pairs of scores have changed.
If I try to do that with an execute command like that:
execute unless score @s x = @s x_alt unless score @s z = @s z_alt
both the coordinates would have to change if I would replace the unless with an if I would have the opposite of the result that I need.
The only way I have been handling that in the past is by adding a return 0 at the end and put everything I want to happen after the command but since I still need to update the scores after that I cant do that here.
A potential solution I have found is by using this predicate.
But since this predicate originally checks for a range it feels unnecessary long.
Is there a better way or a better predicate to do that?
Continue to help post