From bb000c4e3fbd301bccb963d1a75e50537d9e995a Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 10 Feb 2019 16:44:09 -0800 Subject: [PATCH] include diagonals, and better settings --- README.md | 2 ++ USAGE.md | 2 +- src/api/java/baritone/api/Settings.java | 13 +++++++++++++ src/main/java/baritone/process/MineProcess.java | 10 ++++++---- 4 files changed, 22 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4c4b35a3b..e7e51c018 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,8 @@ Here are some links to help to get started: - [Javadocs](https://baritone.leijurv.com/) +- [Settings](https://baritone.leijurv.com/baritone/api/Settings.html) + # Chat control - [Baritone chat control usage](USAGE.md) diff --git a/USAGE.md b/USAGE.md index dab1edb13..a34244ce9 100644 --- a/USAGE.md +++ b/USAGE.md @@ -43,7 +43,7 @@ Some common examples: For the rest of the commands, you can take a look at the code [here](https://github.com/cabaletta/baritone/blob/master/src/main/java/baritone/utils/ExampleBaritoneControl.java). -All the settings and documentation are here. If you find HTML easier to read than Javadoc, you can look here and navigate to Settings in the left sidebar. +All the settings and documentation are here. If you find HTML easier to read than Javadoc, you can look here. There are about a hundred settings, but here are some fun / interesting / important ones that you might want to look at changing in normal usage of Baritone. The documentation for each can be found at the above links. - `allowBreak` diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 2e1115acf..1182579fd 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -563,6 +563,19 @@ public final class Settings { */ public final Setting legitMineYLevel = new Setting<>(11); + /** + * Magically see ores that are separated diagonally from existing ores. Basically like mining around the ores that it finds + * in case there's one there touching it diagonally, except it checks it un-legit-ly without having the mine blocks to see it. + * You can decide whether this looks plausible or not. + *

+ * This is disabled because it results in some weird behavior. For example, it can """see""" the top block of a vein of iron_ore + * through a lava lake. This isn't an issue normally since it won't consider anything touching lava, so it just ignores it. + * However, this setting expands that and allows it to see the entire vein so it'll mine under the lava lake to get the iron that + * it can reach without mining blocks adjacent to lava. This really defeats the purpose of legitMine since a player could never + * do that lol, so thats one reason why its disabled + */ + public final Setting legitMineIncludeDiagonals = new Setting<>(false); + /** * When mining block of a certain type, try to mine two at once instead of one. * If the block above is also a goal block, set GoalBlock instead of GoalTwoBlocks diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index 513caed04..a299bf314 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -228,7 +228,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro return prune(ctx, locs, mining, max); } - public void addNearby() { + private void addNearby() { knownOreLocations.addAll(droppedItemsScan(mining, ctx.world())); BlockPos playerFeet = ctx.playerFeet(); BlockStateInterface bsi = new BlockStateInterface(ctx); @@ -239,8 +239,11 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro for (int z = playerFeet.getZ() - searchDist; z <= playerFeet.getZ() + searchDist; z++) { // crucial to only add blocks we can see because otherwise this // is an x-ray and it'll get caught - if (mining.contains(bsi.get0(x, y, z).getBlock()) && RotationUtils.reachable(ctx.player(), new BlockPos(x, y, z), fakedBlockReachDistance).isPresent()) { - knownOreLocations.add(new BlockPos(x, y, z)); + if (mining.contains(bsi.get0(x, y, z).getBlock())) { + BlockPos pos = new BlockPos(x, y, z); + if ((Baritone.settings().legitMineIncludeDiagonals.get() && knownOreLocations.stream().anyMatch(ore -> ore.distanceSq(pos) <= 2 /* sq means this is pytha dist <= sqrt(2) */)) || RotationUtils.reachable(ctx.player(), pos, fakedBlockReachDistance).isPresent()) { + knownOreLocations.add(pos); + } } } } @@ -263,7 +266,6 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro .distinct() // remove any that are within loaded chunks that aren't actually what we want - .filter(pos -> !ctx.bsi.worldContainsLoadedChunk(pos.getX(), pos.getZ()) || mining.contains(ctx.getBlock(pos.getX(), pos.getY(), pos.getZ())) || dropped.contains(pos)) // remove any that are implausible to mine (encased in bedrock, or touching lava)