add settings for pathing hashmap

This commit is contained in:
Leijurv 2018-09-26 15:01:07 -07:00
parent 1d931a4bb6
commit 2aa4770b45
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A
2 changed files with 14 additions and 1 deletions

View File

@ -193,6 +193,18 @@ public class Settings {
*/
public Setting<Integer> planningTickLookAhead = new Setting<>(100);
/**
* Default size of the Long2ObjectOpenHashMap used in pathing
*/
public Setting<Integer> pathingMapDefaultSize = new Setting<>(1024);
/**
* Load factor coefficient for the Long2ObjectOpenHashMap used in pathing
* <p>
* Decrease for faster map operations, but higher memory usage
*/
public Setting<Float> pathingMapLoadFactor = new Setting<>(0.75f);
/**
* How far are you allowed to fall onto solid ground (without a water bucket)?
* 3 won't deal any damage. But if you just want to get down the mountain quickly and you have

View File

@ -17,6 +17,7 @@
package baritone.pathing.calc;
import baritone.Baritone;
import baritone.api.pathing.goals.Goal;
import baritone.pathing.path.IPath;
import baritone.utils.pathing.BetterBlockPos;
@ -71,7 +72,7 @@ public abstract class AbstractNodeCostSearch implements IPathFinder {
AbstractNodeCostSearch(BlockPos start, Goal goal) {
this.start = new BetterBlockPos(start.getX(), start.getY(), start.getZ());
this.goal = goal;
this.map = new Long2ObjectOpenHashMap<>();
this.map = new Long2ObjectOpenHashMap<>(Baritone.settings().pathingMapDefaultSize.value, Baritone.settings().pathingMapLoadFactor.get());
}
public void cancel() {