appease codacy

This commit is contained in:
Leijurv
2019-02-22 14:05:29 -08:00
parent e63b2f1bf1
commit 3b46dbd6a1
2 changed files with 28 additions and 30 deletions
@@ -106,33 +106,31 @@ public class PathExecutor implements IPathExecutor, Helper {
} }
BetterBlockPos whereShouldIBe = path.positions().get(pathPosition); BetterBlockPos whereShouldIBe = path.positions().get(pathPosition);
BetterBlockPos whereAmI = ctx.playerFeet(); BetterBlockPos whereAmI = ctx.playerFeet();
if (!whereShouldIBe.equals(whereAmI)) { if (!whereShouldIBe.equals(whereAmI) && !Blocks.AIR.equals(BlockStateInterface.getBlock(ctx, whereAmI.down()))) {//do not skip if standing on air, because our position isn't stable to skip
if (!Blocks.AIR.equals(BlockStateInterface.getBlock(ctx, whereAmI.down()))) {//do not skip if standing on air, because our position isn't stable to skip for (int i = 0; i < pathPosition - 1 && i < path.length(); i++) {//this happens for example when you lag out and get teleported back a couple blocks
for (int i = 0; i < pathPosition - 1 && i < path.length(); i++) {//this happens for example when you lag out and get teleported back a couple blocks if (whereAmI.equals(path.positions().get(i))) {
if (whereAmI.equals(path.positions().get(i))) { logDebug("Skipping back " + (pathPosition - i) + " steps, to " + i);
logDebug("Skipping back " + (pathPosition - i) + " steps, to " + i); int previousPos = pathPosition;
int previousPos = pathPosition; pathPosition = Math.max(i - 1, 0); // previous step might not actually be done
pathPosition = Math.max(i - 1, 0); // previous step might not actually be done for (int j = pathPosition; j <= previousPos; j++) {
for (int j = pathPosition; j <= previousPos; j++) { path.movements().get(j).reset();
path.movements().get(j).reset();
}
onChangeInPathPosition();
onTick();
return false;
} }
onChangeInPathPosition();
onTick();
return false;
} }
for (int i = pathPosition + 3; i < path.length(); i++) { //dont check pathPosition+1. the movement tells us when it's done (e.g. sneak placing) }
// also don't check pathPosition+2 because reasons for (int i = pathPosition + 3; i < path.length(); i++) { //dont check pathPosition+1. the movement tells us when it's done (e.g. sneak placing)
if (whereAmI.equals(path.positions().get(i))) { // also don't check pathPosition+2 because reasons
if (i - pathPosition > 2) { if (whereAmI.equals(path.positions().get(i))) {
logDebug("Skipping forward " + (i - pathPosition) + " steps, to " + i); if (i - pathPosition > 2) {
} logDebug("Skipping forward " + (i - pathPosition) + " steps, to " + i);
//System.out.println("Double skip sundae");
pathPosition = i - 1;
onChangeInPathPosition();
onTick();
return false;
} }
//System.out.println("Double skip sundae");
pathPosition = i - 1;
onChangeInPathPosition();
onTick();
return false;
} }
} }
} }
@@ -561,10 +559,7 @@ public class PathExecutor implements IPathExecutor, Helper {
if (MovementHelper.avoidWalkingInto(ctx.world().getBlockState(current.getSrc().up(3)).getBlock())) { if (MovementHelper.avoidWalkingInto(ctx.world().getBlockState(current.getSrc().up(3)).getBlock())) {
return false; return false;
} }
if (MovementHelper.avoidWalkingInto(ctx.world().getBlockState(next.getDest().up(2)).getBlock())) { return !MovementHelper.avoidWalkingInto(ctx.world().getBlockState(next.getDest().up(2)).getBlock()); // codacy smh my head
return false;
}
return true;
} }
private static boolean canSprintFromDescendInto(IPlayerContext ctx, IMovement current, IMovement next) { private static boolean canSprintFromDescendInto(IPlayerContext ctx, IMovement current, IMovement next) {
@@ -131,8 +131,11 @@ public class GetToBlockProcess extends BaritoneProcessHelper implements IGetToBl
} }
} }
} }
if (true) { // i can't do break; (codacy gets mad), and i can't do if(true){break}; (codacy gets mad)
break; // codacy gets mad if i just end on a break LOL // so i will do this
switch (newBlacklist.size()) {
default:
break outer;
} }
} }
logDebug("Blacklisting unreachable locations " + newBlacklist); logDebug("Blacklisting unreachable locations " + newBlacklist);