misc cleanup

This commit is contained in:
Leijurv 2018-09-16 17:11:04 -07:00
parent 51f1cadbb8
commit fb7d729b11
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
4 changed files with 30 additions and 13 deletions

View File

@ -263,9 +263,8 @@ public class MovementTraverse extends Movement {
if (Objects.equals(LookBehaviorUtils.getSelectedBlock().orElse(null), against1) && Minecraft.getMinecraft().player.isSneaking()) {
if (LookBehaviorUtils.getSelectedBlock().get().offset(side).equals(positionToPlace)) {
return state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
} else {
// Out.gui("Wrong. " + side + " " + LookBehaviorUtils.getSelectedBlock().get().offset(side) + " " + positionsToPlace[0], Out.Mode.Debug);
}
// wrong side?
}
System.out.println("Trying to look at " + against1 + ", actually looking at" + LookBehaviorUtils.getSelectedBlock());
return state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true);

View File

@ -212,7 +212,7 @@ public class PathExecutor implements Helper {
}
long end = System.nanoTime() / 1000000L;
if (end - start > 0) {
//logDebug("Recalculating break and place took " + (end - start) + "ms");
System.out.println("Recalculating break and place took " + (end - start) + "ms");
}
Movement movement = path.movements().get(pathPosition);
if (costEstimateIndex == null || costEstimateIndex != pathPosition) {

View File

@ -22,24 +22,37 @@ import baritone.pathing.goals.Goal;
import baritone.utils.pathing.BetterBlockPos;
import net.minecraft.util.math.BlockPos;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.*;
import static org.junit.Assert.*;
@RunWith(Parameterized.class)
public class OpenSetsTest {
@Test
public void testOpenSets() {
for (int size = 1; size < 100; size++) {
testSize(size);
}
for (int size = 100; size < 10000; size += 100) {
testSize(size);
}
private final int size;
public OpenSetsTest(int size) {
this.size = size;
}
public void removeAndTest(int amount, IOpenSet[] test, Optional<Collection<PathNode>> mustContain) {
@Parameterized.Parameters
public static Collection<Object[]> data() {
ArrayList<Object[]> testSizes = new ArrayList<>();
for (int size = 1; size < 20; size++) {
testSizes.add(new Object[]{size});
}
for (int size = 100; size <= 1000; size += 100) {
testSizes.add(new Object[]{size});
}
testSizes.add(new Object[]{5000});
testSizes.add(new Object[]{10000});
return testSizes;
}
private static void removeAndTest(int amount, IOpenSet[] test, Optional<Collection<PathNode>> mustContain) {
double[][] results = new double[test.length][amount];
for (int i = 0; i < test.length; i++) {
long before = System.nanoTime() / 1000000L;
@ -62,7 +75,8 @@ public class OpenSetsTest {
}
}
public void testSize(int size) {
@Test
public void testSize() {
System.out.println("Testing size " + size);
// Include LinkedListOpenSet even though it's not performant because I absolutely trust that it behaves properly
// I'm really testing the heap implementations against it as the ground truth

View File

@ -20,6 +20,8 @@ package baritone.utils.pathing;
import net.minecraft.util.math.BlockPos;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
public class BetterBlockPosTest {
@Test
@ -33,7 +35,9 @@ public class BetterBlockPosTest {
for (int i = 0; i < 10; i++) {
// eliminate any advantage to going first
benchN();
assertTrue(i<10);
}
}
public void benchOne() {