diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index ab758f40..fdbaaf45 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -193,6 +193,18 @@ public class Settings { */ public Setting planningTickLookAhead = new Setting<>(100); + /** + * Default size of the Long2ObjectOpenHashMap used in pathing + */ + public Setting pathingMapDefaultSize = new Setting<>(1024); + + /** + * Load factor coefficient for the Long2ObjectOpenHashMap used in pathing + *

+ * Decrease for faster map operations, but higher memory usage + */ + public Setting 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 diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java index 21f6d848..b3ffa427 100644 --- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java @@ -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() {