Carpet

Carpet

2M Downloads

on_move unexpected behavior

GunnyWaffle opened this issue ยท 3 comments

commented

The on_move entity event is documented as:
executes every time an entity changes position, invoked just after it has been moved to the new position.

Yet in my testing on players, it executes regardless of a change in position up to 4 times per tick, with pos1 and pos2 equating to be the same a majority of the time.
The 4 times per tick issue can be reproduced by falling or flying. Though I can see this being intentional if position truly changes more than once per tick. Which is not the case in my testing so far outside of an app/command setting positions itself.
Standing still sees the event execute once per tick, with pos1 equating to pos2.

Either this is incorrect behavior, or the documentation ought to be adjusted to:
executes every time an entity position is set regardless of it changing, invoked just after it has been set to the new position.

commented

maybe only call event if position actually changed, then?

commented

seems that adding a if(pos1==pos2,return()) in your function could solve it?

commented

if (pos1 == pos2, return()); does create the behavior that I expected, and I am currently using that.
Though that doesn't address the problem of misleading/incorrect documentation, should this behavior be expected.

Either way, be it docs or code, there is an issue.