this actually fixes breaking blocks

This commit is contained in:
Leijurv 2018-08-11 18:05:55 -07:00
parent d3ae1d27c8
commit b5b7863d9a
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 4 additions and 4 deletions

View File

@ -33,7 +33,7 @@ public final class LookBehaviorUtils implements Helper {
/** /**
* Offsets from the root block position to the center of each side. * Offsets from the root block position to the center of each side.
*/ */
private static final Vec3d[] BLOCK_SIDE_MULTIPLIERS = new Vec3d[] { private static final Vec3d[] BLOCK_SIDE_MULTIPLIERS = new Vec3d[]{
new Vec3d(0.5, 0, 0.5), // Down new Vec3d(0.5, 0, 0.5), // Down
new Vec3d(0.5, 1, 0.5), // Up new Vec3d(0.5, 1, 0.5), // Up
new Vec3d(0.5, 0.5, 0), // North new Vec3d(0.5, 0.5, 0), // North
@ -58,7 +58,7 @@ public final class LookBehaviorUtils implements Helper {
public static Optional<Rotation> reachable(BlockPos pos) { public static Optional<Rotation> reachable(BlockPos pos) {
if (pos.equals(getSelectedBlock().orElse(null))) { if (pos.equals(getSelectedBlock().orElse(null))) {
return Optional.of(new Rotation(mc.player.rotationYaw, mc.player.rotationPitch)); return Optional.of(new Rotation(mc.player.rotationYaw, mc.player.rotationPitch + 0.000001f));
} }
Optional<Rotation> possibleRotation = reachableCenter(pos); Optional<Rotation> possibleRotation = reachableCenter(pos);
if (possibleRotation.isPresent()) if (possibleRotation.isPresent())

View File

@ -175,7 +175,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
bestDist = dist; bestDist = dist;
} }
if (dist > MIN_DIST_PATH * MIN_DIST_PATH) { // square the comparison since distFromStartSq is squared if (dist > MIN_DIST_PATH * MIN_DIST_PATH) { // square the comparison since distFromStartSq is squared
System.out.println("A* cost coefficient " + COEFFICIENTS[i]); displayChatMessageRaw("A* cost coefficient " + COEFFICIENTS[i]);
if (COEFFICIENTS[i] >= 3) { if (COEFFICIENTS[i] >= 3) {
System.out.println("Warning: cost coefficient is greater than three! Probably means that"); System.out.println("Warning: cost coefficient is greater than three! Probably means that");
System.out.println("the path I found is pretty terrible (like sneak-bridging for dozens of blocks)"); System.out.println("the path I found is pretty terrible (like sneak-bridging for dozens of blocks)");
@ -186,7 +186,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper {
return Optional.of(new Path(startNode, bestSoFar[i], goal, numNodes)); return Optional.of(new Path(startNode, bestSoFar[i], goal, numNodes));
} }
} }
System.out.println("Even with a cost coefficient of " + COEFFICIENTS[COEFFICIENTS.length - 1] + ", I couldn't get more than " + bestDist + " blocks =("); displayChatMessageRaw("Even with a cost coefficient of " + COEFFICIENTS[COEFFICIENTS.length - 1] + ", I couldn't get more than " + bestDist + " blocks =(");
displayChatMessageRaw("No path found =("); displayChatMessageRaw("No path found =(");
currentlyRunning = null; currentlyRunning = null;
return Optional.empty(); return Optional.empty();