mirror of https://github.com/cabaletta/baritone
fix an array oob with dynamic worldheight
This commit is contained in:
parent
af240d38e0
commit
407f4dbbae
|
@ -65,8 +65,8 @@ public interface ActionCosts {
|
|||
|
||||
|
||||
static double[] generateFallNBlocksCost() {
|
||||
double[] costs = new double[257];
|
||||
for (int i = 0; i < 257; i++) {
|
||||
double[] costs = new double[4097];
|
||||
for (int i = 0; i < 4096; i++) {
|
||||
costs[i] = distanceToTicks(i);
|
||||
}
|
||||
return costs;
|
||||
|
|
|
@ -26,7 +26,7 @@ public class ActionCostsTest {
|
|||
|
||||
@Test
|
||||
public void testFallNBlocksCost() {
|
||||
assertEquals(FALL_N_BLOCKS_COST.length, 257); // Fall 0 blocks through fall 256 blocks
|
||||
assertEquals(FALL_N_BLOCKS_COST.length, 4097); // Fall 0 blocks through fall 4096 blocks
|
||||
for (int i = 0; i < 257; i++) {
|
||||
double blocks = ticksToBlocks(FALL_N_BLOCKS_COST[i]);
|
||||
assertEquals(blocks, i, 0.000000000001); // If you add another 0 the test fails at i=217 LOL
|
||||
|
|
Loading…
Reference in New Issue