From 199d5d57d5155de566777964673cf619639fb747 Mon Sep 17 00:00:00 2001 From: Harry Date: Mon, 21 Jun 2021 09:49:18 +1000 Subject: [PATCH 1/6] Update .gitignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index bd3b054a..84a7e431 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,12 @@ classes/ *.iws /logs/ +# Eclipse Files +.classpath +.project +.settings/ +baritone_Client.launch + # Copyright Files !/.idea/copyright/Baritone.xml !/.idea/copyright/profiles_settings.xml From 051325e10fc541604a1d4a3e86f0986bcc69abcb Mon Sep 17 00:00:00 2001 From: Harry Date: Mon, 21 Jun 2021 10:58:11 +1000 Subject: [PATCH 2/6] allow smaller parkour place jumps allows 2 and 1 block parkour place jumps --- .../movement/movements/MovementParkour.java | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index b9a0fd44..55930a04 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -124,7 +124,7 @@ public class MovementParkour extends Movement { return; } IBlockState landingOn = context.bsi.get0(destX, y - 1, destZ); - // farmland needs to be canwalkon otherwise farm can never work at all, but we want to specifically disallow ending a jumy on farmland haha + // farmland needs to be canWalkOn otherwise farm can never work at all, but we want to specifically disallow ending a jump on farmland haha if (landingOn.getBlock() != Blocks.FARMLAND && MovementHelper.canWalkOn(context.bsi, destX, y - 1, destZ, landingOn)) { if (checkOvershootSafety(context.bsi, destX + xDiff, y, destZ + zDiff)) { res.x = destX; @@ -138,39 +138,39 @@ public class MovementParkour extends Movement { return; } } - if (maxJump != 4) { - return; - } + // parkour place starts here if (!context.allowParkourPlace) { return; } - // time 2 pop off with that dank skynet parkour place - int destX = x + 4 * xDiff; - int destZ = z + 4 * zDiff; - IBlockState toReplace = context.get(destX, y - 1, destZ); - double placeCost = context.costOfPlacingAt(destX, y - 1, destZ, toReplace); - if (placeCost >= COST_INF) { - return; - } - if (!MovementHelper.isReplaceable(destX, y - 1, destZ, toReplace, context.bsi)) { - return; - } - if (!checkOvershootSafety(context.bsi, destX + xDiff, y, destZ + zDiff)) { - return; - } - for (int i = 0; i < 5; i++) { - int againstX = destX + HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP[i].getXOffset(); - int againstY = y - 1 + HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP[i].getYOffset(); - int againstZ = destZ + HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP[i].getZOffset(); - if (againstX == x + xDiff * 3 && againstZ == z + zDiff * 3) { // we can't turn around that fast - continue; + // check parkour jumps from largest to smallest + for (int i = maxJump; i > 1; i--) { + int destX = x + i * xDiff; + int destZ = z + i * zDiff; + IBlockState toReplace = context.get(destX, y - 1, destZ); + double placeCost = context.costOfPlacingAt(destX, y - 1, destZ, toReplace); + if (placeCost >= COST_INF) { + continue; } - if (MovementHelper.canPlaceAgainst(context.bsi, againstX, againstY, againstZ)) { - res.x = destX; - res.y = y; - res.z = destZ; - res.cost = costFromJumpDistance(4) + placeCost + context.jumpPenalty; - return; + if (!MovementHelper.isReplaceable(destX, y - 1, destZ, toReplace, context.bsi)) { + continue; + } + if (!checkOvershootSafety(context.bsi, destX + xDiff, y, destZ + zDiff)) { + continue; + } + for (int j = 0; j < 5; j++) { + int againstX = destX + HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP[j].getXOffset(); + int againstY = y - 1 + HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP[j].getYOffset(); + int againstZ = destZ + HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP[j].getZOffset(); + if (againstX == x + xDiff * 3 && againstZ == z + zDiff * 3) { // we can't turn around that fast + continue; + } + if (MovementHelper.canPlaceAgainst(context.bsi, againstX, againstY, againstZ)) { + res.x = destX; + res.y = y; + res.z = destZ; + res.cost = costFromJumpDistance(i) + placeCost + context.jumpPenalty; + return; + } } } } From 3142387e455c2d8e8c41841d36be9105bc286fb7 Mon Sep 17 00:00:00 2001 From: Harry Date: Wed, 23 Jun 2021 06:25:10 +1000 Subject: [PATCH 3/6] Fix collision early return not tested yet - fixes early returns --- .../movement/movements/MovementParkour.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 55930a04..162c20cc 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -108,10 +108,12 @@ public class MovementParkour extends Movement { int destX = x + xDiff * i; int destZ = z + zDiff * i; if (!MovementHelper.fullyPassable(context, destX, y + 1, destZ)) { - return; + maxJump = i - 1; + break; } if (!MovementHelper.fullyPassable(context, destX, y + 2, destZ)) { - return; + maxJump = i - 1; + break; } IBlockState destInto = context.bsi.get0(destX, y, destZ); if (!MovementHelper.fullyPassable(context.bsi.access, context.bsi.isPassableBlockPos.setPos(destX, y, destZ), destInto)) { @@ -120,8 +122,10 @@ public class MovementParkour extends Movement { res.y = y + 1; res.z = destZ; res.cost = i * SPRINT_ONE_BLOCK_COST + context.jumpPenalty; + return; } - return; + maxJump = i - 1; + break; } IBlockState landingOn = context.bsi.get0(destX, y - 1, destZ); // farmland needs to be canWalkOn otherwise farm can never work at all, but we want to specifically disallow ending a jump on farmland haha @@ -131,11 +135,14 @@ public class MovementParkour extends Movement { res.y = y; res.z = destZ; res.cost = costFromJumpDistance(i) + context.jumpPenalty; + return; } - return; + maxJump = i - 1; + break; } if (!MovementHelper.fullyPassable(context, destX, y + 3, destZ)) { - return; + maxJump = i - 1; + break; } } // parkour place starts here From 2159773723c7b392a8ec2c67c57cca50e4ffb3d9 Mon Sep 17 00:00:00 2001 From: Harry Date: Thu, 1 Jul 2021 10:09:06 +1000 Subject: [PATCH 4/6] requested changes - tabs changed to 4 spaces - fixed checking if block place is behind player --- .../pathing/movement/movements/MovementParkour.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 162c20cc..f7b84b58 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -156,19 +156,19 @@ public class MovementParkour extends Movement { IBlockState toReplace = context.get(destX, y - 1, destZ); double placeCost = context.costOfPlacingAt(destX, y - 1, destZ, toReplace); if (placeCost >= COST_INF) { - continue; + continue; } if (!MovementHelper.isReplaceable(destX, y - 1, destZ, toReplace, context.bsi)) { - continue; + continue; } if (!checkOvershootSafety(context.bsi, destX + xDiff, y, destZ + zDiff)) { - continue; + continue; } for (int j = 0; j < 5; j++) { int againstX = destX + HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP[j].getXOffset(); int againstY = y - 1 + HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP[j].getYOffset(); int againstZ = destZ + HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP[j].getZOffset(); - if (againstX == x + xDiff * 3 && againstZ == z + zDiff * 3) { // we can't turn around that fast + if (againstX == destX - xDiff && againstZ == destZ - zDiff) { // we can't turn around that fast continue; } if (MovementHelper.canPlaceAgainst(context.bsi, againstX, againstY, againstZ)) { From 7a7b050615e9d16654cf4f08edb0580bd3e61880 Mon Sep 17 00:00:00 2001 From: Harry Date: Sat, 17 Jul 2021 12:34:58 +1000 Subject: [PATCH 5/6] weird verifiedMaxJump --- .../movement/movements/MovementParkour.java | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index f7b84b58..416c9072 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -104,17 +104,23 @@ public class MovementParkour extends Movement { maxJump = 3; } } + + // check parkour jumps from smallest to largest for obstacles/walls and landing positions + int verifiedMaxJump = -1; for (int i = 2; i <= maxJump; i++) { + verifiedMaxJump = i - 1; int destX = x + xDiff * i; int destZ = z + zDiff * i; + + // check head/feet if (!MovementHelper.fullyPassable(context, destX, y + 1, destZ)) { - maxJump = i - 1; break; } if (!MovementHelper.fullyPassable(context, destX, y + 2, destZ)) { - maxJump = i - 1; break; } + + // check for ascend landing position IBlockState destInto = context.bsi.get0(destX, y, destZ); if (!MovementHelper.fullyPassable(context.bsi.access, context.bsi.isPassableBlockPos.setPos(destX, y, destZ), destInto)) { if (i <= 3 && context.allowParkourAscend && context.canSprint && MovementHelper.canWalkOn(context.bsi, destX, y, destZ, destInto) && checkOvershootSafety(context.bsi, destX + xDiff, y + 1, destZ + zDiff)) { @@ -124,9 +130,10 @@ public class MovementParkour extends Movement { res.cost = i * SPRINT_ONE_BLOCK_COST + context.jumpPenalty; return; } - maxJump = i - 1; break; } + + // check for flat landing position IBlockState landingOn = context.bsi.get0(destX, y - 1, destZ); // farmland needs to be canWalkOn otherwise farm can never work at all, but we want to specifically disallow ending a jump on farmland haha if (landingOn.getBlock() != Blocks.FARMLAND && MovementHelper.canWalkOn(context.bsi, destX, y - 1, destZ, landingOn)) { @@ -137,20 +144,23 @@ public class MovementParkour extends Movement { res.cost = costFromJumpDistance(i) + context.jumpPenalty; return; } - maxJump = i - 1; break; } + if (!MovementHelper.fullyPassable(context, destX, y + 3, destZ)) { - maxJump = i - 1; break; } + + // reset verifiedMaxJump so that if we exit out of the for loop here it is not changed + verifiedMaxJump = maxJump; } + // parkour place starts here if (!context.allowParkourPlace) { return; } - // check parkour jumps from largest to smallest - for (int i = maxJump; i > 1; i--) { + // check parkour jumps from largest to smallest for positions to place blocks + for (int i = verifiedMaxJump; i > 1; i--) { int destX = x + i * xDiff; int destZ = z + i * zDiff; IBlockState toReplace = context.get(destX, y - 1, destZ); From 335cb7016e11eb232fa5bab502c4a8201c955416 Mon Sep 17 00:00:00 2001 From: Harry Date: Sat, 17 Jul 2021 13:28:12 +1000 Subject: [PATCH 6/6] fix verifiedMaxJump - remove redundant assignment by changing some values - testing Co-Authors Co-Authored-By: Leijurv --- .../pathing/movement/movements/MovementParkour.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 416c9072..e5d17b9a 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -106,9 +106,8 @@ public class MovementParkour extends Movement { } // check parkour jumps from smallest to largest for obstacles/walls and landing positions - int verifiedMaxJump = -1; + int verifiedMaxJump = 1; // i - 1 (when i = 2) for (int i = 2; i <= maxJump; i++) { - verifiedMaxJump = i - 1; int destX = x + xDiff * i; int destZ = z + zDiff * i; @@ -151,8 +150,7 @@ public class MovementParkour extends Movement { break; } - // reset verifiedMaxJump so that if we exit out of the for loop here it is not changed - verifiedMaxJump = maxJump; + verifiedMaxJump = i; } // parkour place starts here