Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Commit

Permalink
fix once and for all
Browse files Browse the repository at this point in the history
  • Loading branch information
iam4722202468 committed Feb 7, 2024
1 parent e5ff162 commit 7a43e0e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.sql.SQLOutput;
import java.util.List;
import java.util.function.Consumer;

// TODO all pathfinding requests could be processed in another thread

Expand Down Expand Up @@ -238,16 +236,17 @@ public synchronized void tick() {
// drawPath(path);
moveTowards(currentTarget, movementSpeed, path.capabilities(), nextIsRepath ? currentTarget : nextTarget);

if (entity.getPosition().sameBlock(currentTarget)) {
path.next();
return;
}

if ((path.getCurrentType() == PNode.NodeType.JUMP)
&& entity.isOnGround()
&& path.capabilities().canJump()
) {
jump(4f);
}

if (entity.getPosition().sameBlock(currentTarget) && entity.isOnGround()) {
path.next();
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ private PNode newNode(double cost, Pos point, Point goal) {
}

static Pos gravitySnap(Instance instance, Point point, BoundingBox boundingBox, double maxFall) {
point = new Pos(point.blockX() + 0.5, point.blockY(), point.blockZ() + 0.5);

Chunk c = instance.getChunkAt(point);
if (c == null) return null;

Expand Down

0 comments on commit 7a43e0e

Please sign in to comment.