misc fixes to coefficients, descend, and pathexecutor
This commit is contained in:
parent
4ba5d81b5c
commit
bc9f76d1c7
@ -57,7 +57,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder {
|
|||||||
*
|
*
|
||||||
* @see <a href="https://docs.google.com/document/d/1WVHHXKXFdCR1Oz__KtK8sFqyvSwJN_H4lftkHFgmzlc/edit"></a>
|
* @see <a href="https://docs.google.com/document/d/1WVHHXKXFdCR1Oz__KtK8sFqyvSwJN_H4lftkHFgmzlc/edit"></a>
|
||||||
*/
|
*/
|
||||||
protected static final double[] COEFFICIENTS = {1.5, 2, 2.5, 3, 4, 5, 10};
|
protected static final double[] COEFFICIENTS = {1, 1.5, 2, 2.5, 3, 4, 5, 10};
|
||||||
/**
|
/**
|
||||||
* If a path goes less than 5 blocks and doesn't make it to its goal, it's not worth considering.
|
* If a path goes less than 5 blocks and doesn't make it to its goal, it's not worth considering.
|
||||||
*/
|
*/
|
||||||
|
@ -23,6 +23,7 @@ import net.minecraft.util.math.Vec3d;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Useful for long-range goals that don't have a specific Y level.
|
* Useful for long-range goals that don't have a specific Y level.
|
||||||
|
*
|
||||||
* @author leijurv
|
* @author leijurv
|
||||||
*/
|
*/
|
||||||
public class GoalXZ implements Goal {
|
public class GoalXZ implements Goal {
|
||||||
@ -97,7 +98,7 @@ public class GoalXZ implements Goal {
|
|||||||
diagonal = z;
|
diagonal = z;
|
||||||
}
|
}
|
||||||
diagonal *= SQRT_2;
|
diagonal *= SQRT_2;
|
||||||
return (diagonal + straight) * WALK_ONE_BLOCK_COST;
|
return (diagonal + straight) * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) {
|
public static GoalXZ fromDirection(Vec3d origin, float yaw, double distance) {
|
||||||
|
@ -22,13 +22,13 @@ public interface ActionCosts extends ActionCostsButOnlyTheOnesThatMakeMickeyDieI
|
|||||||
/**
|
/**
|
||||||
* These costs are measured roughly in ticks btw
|
* These costs are measured roughly in ticks btw
|
||||||
*/
|
*/
|
||||||
double WALK_ONE_BLOCK_COST = 20 / 4.317;
|
double WALK_ONE_BLOCK_COST = 20 / 4.317; // // 4.633
|
||||||
double WALK_ONE_IN_WATER_COST = 20 / 2.2;
|
double WALK_ONE_IN_WATER_COST = 20 / 2.2;
|
||||||
double JUMP_ONE_BLOCK_COST = 5.72854;//see below calculation for fall. 1.25 blocks
|
double JUMP_ONE_BLOCK_COST = 5.72854;//see below calculation for fall. 1.25 blocks
|
||||||
double LADDER_UP_ONE_COST = 20 / 2.35;
|
double LADDER_UP_ONE_COST = 20 / 2.35;
|
||||||
double LADDER_DOWN_ONE_COST = 20 / 3.0;
|
double LADDER_DOWN_ONE_COST = 20 / 3.0;
|
||||||
double SNEAK_ONE_BLOCK_COST = 20 / 1.3;
|
double SNEAK_ONE_BLOCK_COST = 20 / 1.3;
|
||||||
double SPRINT_ONE_BLOCK_COST = 20 / 5.612;
|
double SPRINT_ONE_BLOCK_COST = 20 / 5.612; // 3.564
|
||||||
/**
|
/**
|
||||||
* To walk off an edge you need to walk 0.5 to the edge then 0.3 to start falling off
|
* To walk off an edge you need to walk 0.5 to the edge then 0.3 to start falling off
|
||||||
*/
|
*/
|
||||||
|
@ -68,10 +68,14 @@ public class MovementDescend extends Movement {
|
|||||||
case RUNNING:
|
case RUNNING:
|
||||||
BlockPos playerFeet = playerFeet();
|
BlockPos playerFeet = playerFeet();
|
||||||
|
|
||||||
if (playerFeet.equals(dest) && (BlockStateInterface.isLiquid(dest) || player().posY - playerFeet.getY() < 0.01)) {
|
if (playerFeet.equals(dest)) {
|
||||||
// Wait until we're actually on the ground before saying we're done because sometimes we continue to fall if the next action starts immediately
|
if (BlockStateInterface.isLiquid(dest) || player().posY - playerFeet.getY() < 0.01) {
|
||||||
state.setStatus(MovementStatus.SUCCESS);
|
// Wait until we're actually on the ground before saying we're done because sometimes we continue to fall if the next action starts immediately
|
||||||
return state;
|
state.setStatus(MovementStatus.SUCCESS);
|
||||||
|
return state;
|
||||||
|
} else {
|
||||||
|
System.out.println(player().posY + " " + playerFeet.getY() + " " + (player().posY - playerFeet.getY()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
double diffX = player().posX - (dest.getX() + 0.5);
|
double diffX = player().posX - (dest.getX() + 0.5);
|
||||||
double diffZ = player().posZ - (dest.getZ() + 0.5);
|
double diffZ = player().posZ - (dest.getZ() + 0.5);
|
||||||
@ -79,15 +83,19 @@ public class MovementDescend extends Movement {
|
|||||||
double x = player().posX - (src.getX() + 0.5);
|
double x = player().posX - (src.getX() + 0.5);
|
||||||
double z = player().posZ - (src.getZ() + 0.5);
|
double z = player().posZ - (src.getZ() + 0.5);
|
||||||
double fromStart = Math.sqrt(x * x + z * z);
|
double fromStart = Math.sqrt(x * x + z * z);
|
||||||
if (!playerFeet.equals(dest) || ab > 0.2) {
|
if (!playerFeet.equals(dest) || ab > 0.25) {
|
||||||
BlockPos fakeDest = new BlockPos(dest.getX() * 2 - src.getX(), dest.getY(), dest.getZ() * 2 - src.getZ());
|
BlockPos fakeDest = new BlockPos(dest.getX() * 2 - src.getX(), dest.getY(), dest.getZ() * 2 - src.getZ());
|
||||||
double diffX2 = player().posX - (fakeDest.getX() + 0.5);
|
double diffX2 = player().posX - (fakeDest.getX() + 0.5);
|
||||||
double diffZ2 = player().posZ - (fakeDest.getZ() + 0.5);
|
double diffZ2 = player().posZ - (fakeDest.getZ() + 0.5);
|
||||||
double d = Math.sqrt(diffX2 * diffX2 + diffZ2 * diffZ2);
|
double d = Math.sqrt(diffX2 * diffX2 + diffZ2 * diffZ2);
|
||||||
MovementHelper.moveTowards(state, fakeDest);
|
if (numTicks++ < 20) {
|
||||||
if (fromStart > 1.2 && numTicks++ < 10) {
|
MovementHelper.moveTowards(state, fakeDest);
|
||||||
state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, false);
|
if (fromStart > 1.25) {
|
||||||
state.setInput(InputOverrideHandler.Input.MOVE_BACK, true);
|
state.setInput(InputOverrideHandler.Input.MOVE_FORWARD, false);
|
||||||
|
state.setInput(InputOverrideHandler.Input.MOVE_BACK, true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MovementHelper.moveTowards(state, dest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return state;
|
return state;
|
||||||
|
@ -91,6 +91,7 @@ public class PathExecutor implements Helper {
|
|||||||
if (whereAmI.equals(path.positions().get(i))) {
|
if (whereAmI.equals(path.positions().get(i))) {
|
||||||
displayChatMessageRaw("Skipping back " + (pathPosition - i) + " steps, to " + i);
|
displayChatMessageRaw("Skipping back " + (pathPosition - i) + " steps, to " + i);
|
||||||
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
|
||||||
|
Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -100,6 +101,7 @@ public class PathExecutor implements Helper {
|
|||||||
displayChatMessageRaw("Skipping forward " + (i - pathPosition) + " steps, to " + i);
|
displayChatMessageRaw("Skipping forward " + (i - pathPosition) + " steps, to " + i);
|
||||||
}
|
}
|
||||||
pathPosition = i - 1;
|
pathPosition = i - 1;
|
||||||
|
Baritone.INSTANCE.getInputOverrideHandler().clearAllKeys();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user