Skip to content

Commit

Permalink
Remove useless subtraction from isMoving and isFalling
Browse files Browse the repository at this point in the history
  • Loading branch information
superpowers04 committed May 25, 2024
1 parent 661d878 commit 1399de1
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,17 +318,16 @@ public boolean isCrouching() {
@LuaMethodDoc("entity.is_moving")
public boolean isMoving() {
checkEntity();
return entity.getX() - entity.xOld != 0
|| entity.getY() - entity.yOld != 0
|| entity.getZ() - entity.zOld != 0;
return entity.getX() != entity.xOld
|| entity.getY() != entity.yOld
|| entity.getZ() != entity.zOld;
}

@LuaWhitelist
@LuaMethodDoc("entity.is_falling")
public boolean isFalling() {
checkEntity();
return !entity.onGround()
&& entity.getY() - entity.yOld < 0;
return !entity.onGround() && entity.getY() < entity.yOld;
}

@LuaWhitelist
Expand Down

0 comments on commit 1399de1

Please sign in to comment.