misc cleanup
This commit is contained in:
parent
51f1cadbb8
commit
fb7d729b11
@ -263,9 +263,8 @@ public class MovementTraverse extends Movement {
|
|||||||
if (Objects.equals(LookBehaviorUtils.getSelectedBlock().orElse(null), against1) && Minecraft.getMinecraft().player.isSneaking()) {
|
if (Objects.equals(LookBehaviorUtils.getSelectedBlock().orElse(null), against1) && Minecraft.getMinecraft().player.isSneaking()) {
|
||||||
if (LookBehaviorUtils.getSelectedBlock().get().offset(side).equals(positionToPlace)) {
|
if (LookBehaviorUtils.getSelectedBlock().get().offset(side).equals(positionToPlace)) {
|
||||||
return state.setInput(InputOverrideHandler.Input.CLICK_RIGHT, true);
|
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());
|
System.out.println("Trying to look at " + against1 + ", actually looking at" + LookBehaviorUtils.getSelectedBlock());
|
||||||
return state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true);
|
return state.setInput(InputOverrideHandler.Input.CLICK_LEFT, true);
|
||||||
|
@ -212,7 +212,7 @@ public class PathExecutor implements Helper {
|
|||||||
}
|
}
|
||||||
long end = System.nanoTime() / 1000000L;
|
long end = System.nanoTime() / 1000000L;
|
||||||
if (end - start > 0) {
|
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);
|
Movement movement = path.movements().get(pathPosition);
|
||||||
if (costEstimateIndex == null || costEstimateIndex != pathPosition) {
|
if (costEstimateIndex == null || costEstimateIndex != pathPosition) {
|
||||||
|
@ -22,24 +22,37 @@ import baritone.pathing.goals.Goal;
|
|||||||
import baritone.utils.pathing.BetterBlockPos;
|
import baritone.utils.pathing.BetterBlockPos;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.junit.runners.Parameterized;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
@RunWith(Parameterized.class)
|
||||||
public class OpenSetsTest {
|
public class OpenSetsTest {
|
||||||
|
|
||||||
@Test
|
private final int size;
|
||||||
public void testOpenSets() {
|
|
||||||
for (int size = 1; size < 100; size++) {
|
public OpenSetsTest(int size) {
|
||||||
testSize(size);
|
this.size = size;
|
||||||
}
|
|
||||||
for (int size = 100; size < 10000; size += 100) {
|
|
||||||
testSize(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];
|
double[][] results = new double[test.length][amount];
|
||||||
for (int i = 0; i < test.length; i++) {
|
for (int i = 0; i < test.length; i++) {
|
||||||
long before = System.nanoTime() / 1000000L;
|
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);
|
System.out.println("Testing size " + size);
|
||||||
// Include LinkedListOpenSet even though it's not performant because I absolutely trust that it behaves properly
|
// 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
|
// I'm really testing the heap implementations against it as the ground truth
|
||||||
|
@ -20,6 +20,8 @@ package baritone.utils.pathing;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
public class BetterBlockPosTest {
|
public class BetterBlockPosTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -33,7 +35,9 @@ public class BetterBlockPosTest {
|
|||||||
for (int i = 0; i < 10; i++) {
|
for (int i = 0; i < 10; i++) {
|
||||||
// eliminate any advantage to going first
|
// eliminate any advantage to going first
|
||||||
benchN();
|
benchN();
|
||||||
|
assertTrue(i<10);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void benchOne() {
|
public void benchOne() {
|
||||||
|
Loading…
Reference in New Issue
Block a user