(boolean calcFailed, boolean isSafeToCancel)
| 201 | } |
| 202 | |
| 203 | @Override |
| 204 | public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) { |
| 205 | if (Baritone.settings().mineGoalUpdateInterval.value != 0 && tickCount++ % Baritone.settings().mineGoalUpdateInterval.value == 0) { |
| 206 | ArrayList<Block> scan = new ArrayList<>(); |
| 207 | for (Harvest harvest : Harvest.values()) { |
| 208 | scan.add(harvest.block); |
| 209 | } |
| 210 | if (Baritone.settings().replantCrops.value) { |
| 211 | scan.add(Blocks.FARMLAND); |
| 212 | scan.add(Blocks.JUNGLE_LOG); |
| 213 | if (Baritone.settings().replantNetherWart.value) { |
| 214 | scan.add(Blocks.SOUL_SAND); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | Baritone.getExecutor().execute(() -> locations = BaritoneAPI.getProvider().getWorldScanner().scanChunkRadius(ctx, scan, Baritone.settings().farmMaxScanSize.value, 10, 10)); |
| 219 | } |
| 220 | if (locations == null) { |
| 221 | return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE); |
| 222 | } |
| 223 | List<BlockPos> toBreak = new ArrayList<>(); |
| 224 | List<BlockPos> openFarmland = new ArrayList<>(); |
| 225 | List<BlockPos> bonemealable = new ArrayList<>(); |
| 226 | List<BlockPos> openSoulsand = new ArrayList<>(); |
| 227 | List<BlockPos> openLog = new ArrayList<>(); |
| 228 | for (BlockPos pos : locations) { |
| 229 | //check if the target block is out of range. |
| 230 | if (range != 0 && pos.distSqr(center) > range * range) { |
| 231 | continue; |
| 232 | } |
| 233 | |
| 234 | BlockState state = ctx.world().getBlockState(pos); |
| 235 | boolean airAbove = ctx.world().getBlockState(pos.above()).getBlock() instanceof AirBlock; |
| 236 | if (state.getBlock() == Blocks.FARMLAND) { |
| 237 | if (airAbove) { |
| 238 | openFarmland.add(pos); |
| 239 | } |
| 240 | continue; |
| 241 | } |
| 242 | if (state.getBlock() == Blocks.SOUL_SAND) { |
| 243 | if (airAbove) { |
| 244 | openSoulsand.add(pos); |
| 245 | } |
| 246 | continue; |
| 247 | } |
| 248 | if (state.getBlock() == Blocks.JUNGLE_LOG) { |
| 249 | for (Direction direction : Direction.Plane.HORIZONTAL) { |
| 250 | if (ctx.world().getBlockState(pos.relative(direction)).getBlock() instanceof AirBlock) { |
| 251 | openLog.add(pos); |
| 252 | break; |
| 253 | } |
| 254 | } |
| 255 | continue; |
| 256 | } |
| 257 | if (readyForHarvest(ctx.world(), pos, state)) { |
| 258 | toBreak.add(pos); |
| 259 | continue; |
| 260 | } |
nothing calls this directly
no test coverage detected