MCPcopy Create free account
hub / github.com/cabaletta/baritone / updateGoal

Method updateGoal

src/main/java/baritone/process/MineProcess.java:176–224  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

174 }
175
176 private PathingCommand updateGoal() {
177 BlockOptionalMetaLookup filter = filterFilter();
178 if (filter == null) {
179 return null;
180 }
181
182 boolean legit = Baritone.settings().legitMine.value;
183 List<BlockPos> locs = knownOreLocations;
184 if (!locs.isEmpty()) {
185 CalculationContext context = new CalculationContext(baritone);
186 List<BlockPos> locs2 = prune(context, new ArrayList<>(locs), filter, Baritone.settings().mineMaxOreLocationsCount.value, blacklist, droppedItemsScan());
187 // can't reassign locs, gotta make a new var locs2, because we use it in a lambda right here, and variables you use in a lambda must be effectively final
188 Goal goal = new GoalComposite(locs2.stream().map(loc -> coalesce(loc, locs2, context)).toArray(Goal[]::new));
189 knownOreLocations = locs2;
190 return new PathingCommand(goal, legit ? PathingCommandType.FORCE_REVALIDATE_GOAL_AND_PATH : PathingCommandType.REVALIDATE_GOAL_AND_PATH);
191 }
192 // we don't know any ore locations at the moment
193 if (!legit && !Baritone.settings().exploreForBlocks.value) {
194 return null;
195 }
196 // only when we should explore for blocks or are in legit mode we do this
197 int y = Baritone.settings().legitMineYLevel.value;
198 if (branchPoint == null) {
199 /*if (!baritone.getPathingBehavior().isPathing() && playerFeet().y == y) {
200 // cool, path is over and we are at desired y
201 branchPoint = playerFeet();
202 branchPointRunaway = null;
203 } else {
204 return new GoalYLevel(y);
205 }*/
206 branchPoint = ctx.playerFeet();
207 }
208 // TODO shaft mode, mine 1x1 shafts to either side
209 // TODO also, see if the GoalRunAway with maintain Y at 11 works even from the surface
210 if (branchPointRunaway == null) {
211 branchPointRunaway = new GoalRunAway(1, y, branchPoint) {
212 @Override
213 public boolean isInGoal(int x, int y, int z) {
214 return false;
215 }
216
217 @Override
218 public double heuristic() {
219 return Double.NEGATIVE_INFINITY;
220 }
221 };
222 }
223 return new PathingCommand(branchPointRunaway, PathingCommandType.REVALIDATE_GOAL_AND_PATH);
224 }
225
226 private void rescan(List<BlockPos> already, CalculationContext context) {
227 BlockOptionalMetaLookup filter = filterFilter();

Callers 1

onTickMethod · 0.95

Calls 9

filterFilterMethod · 0.95
settingsMethod · 0.95
pruneMethod · 0.95
droppedItemsScanMethod · 0.95
coalesceMethod · 0.95
mapMethod · 0.80
playerFeetMethod · 0.80
isEmptyMethod · 0.65
streamMethod · 0.45

Tested by

no test coverage detected