Skip to content

Commit

Permalink
test more pathfinding changes
Browse files Browse the repository at this point in the history
  • Loading branch information
aesthetic0001 committed Feb 4, 2024
1 parent 2547f5d commit f0058ad
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ function inject (bot) {
let dx = nextPoint.x - p.x
const dy = nextPoint.y - p.y
let dz = nextPoint.z - p.z
const yChangeFromGround = lp ? p.y - lp.y : 0

/* eslint-disable multiline-ternary */
// const direction = previousNode ? {
Expand All @@ -593,7 +594,7 @@ function inject (bot) {

// console.log(direction)

if (Math.abs(dx) <= (!bot.entity.onGround ? 1.25 : 0.5) && Math.abs(dz) <= (!bot.entity.onGround ? 1.25 : 0.5) && Math.abs(dy) < 12) {
if (Math.abs(dx) <= (yChangeFromGround >= 1.5 ? Math.max(2, yChangeFromGround / 2) : 0.5) && Math.abs(dz) <= (yChangeFromGround > 1.5 ? Math.max(2, yChangeFromGround / 2) : 0.5) && Math.abs(dy) < 12) {
// arrived at next point
lastNodeTime = performance.now()
if (stopPathing) {
Expand Down

0 comments on commit f0058ad

Please sign in to comment.