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

Method coalesce

src/main/java/baritone/process/MineProcess.java:260–300  ·  view source on GitHub ↗
(BlockPos loc, List<BlockPos> locs, CalculationContext context)

Source from the content-addressed store, hash-verified

258 }
259
260 private Goal coalesce(BlockPos loc, List<BlockPos> locs, CalculationContext context) {
261 boolean assumeVerticalShaftMine = !(baritone.bsi.get0(loc.above()).getBlock() instanceof FallingBlock);
262 if (!Baritone.settings().forceInternalMining.value) {
263 if (assumeVerticalShaftMine) {
264 // we can get directly below the block
265 return new GoalThreeBlocks(loc);
266 } else {
267 // we need to get feet or head into the block
268 return new GoalTwoBlocks(loc);
269 }
270 }
271 boolean upwardGoal = internalMiningGoal(loc.above(), context, locs);
272 boolean downwardGoal = internalMiningGoal(loc.below(), context, locs);
273 boolean doubleDownwardGoal = internalMiningGoal(loc.below(2), context, locs);
274 if (upwardGoal == downwardGoal) { // symmetric
275 if (doubleDownwardGoal && assumeVerticalShaftMine) {
276 // we have a checkerboard like pattern
277 // this one, and the one two below it
278 // therefore it's fine to path to immediately below this one, since your feet will be in the doubleDownwardGoal
279 // but only if assumeVerticalShaftMine
280 return new GoalThreeBlocks(loc);
281 } else {
282 // this block has nothing interesting two below, but is symmetric vertically so we can get either feet or head into it
283 return new GoalTwoBlocks(loc);
284 }
285 }
286 if (upwardGoal) {
287 // downwardGoal known to be false
288 // ignore the gap then potential doubleDownward, because we want to path feet into this one and head into upwardGoal
289 return new GoalBlock(loc);
290 }
291 // upwardGoal known to be false, downwardGoal known to be true
292 if (doubleDownwardGoal && assumeVerticalShaftMine) {
293 // this block and two below it are goals
294 // path into the center of the one below, because that includes directly below this one
295 return new GoalTwoBlocks(loc.below());
296 }
297 // upwardGoal false, downwardGoal true, doubleDownwardGoal false
298 // just this block and the one immediately below, no others
299 return new GoalBlock(loc.below());
300 }
301
302 private static class GoalThreeBlocks extends GoalTwoBlocks {
303

Callers 1

updateGoalMethod · 0.95

Calls 6

settingsMethod · 0.95
internalMiningGoalMethod · 0.95
aboveMethod · 0.80
belowMethod · 0.80
getBlockMethod · 0.65
get0Method · 0.45

Tested by

no test coverage detected