From 6dc7a7788e90ddfa32419570473d393b5e3edecc Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 23 Jul 2019 22:30:04 -0700 Subject: [PATCH 01/29] install for 1.14.4 --- README.md | 5 ++++- SETUP.md | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index db5be4c23..68d4af7a8 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,9 @@ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a73d037823b64a5faf597a18d71e3400)](https://www.codacy.com/app/leijurv/baritone?utm_source=github.com&utm_medium=referral&utm_content=cabaletta/baritone&utm_campaign=Badge_Grade) [![HitCount](http://hits.dwyl.com/cabaletta/baritone.svg)](http://hits.dwyl.com/cabaletta/baritone/) [![GitHub All Releases](https://img.shields.io/github/downloads/cabaletta/baritone/total.svg)](https://github.com/cabaletta/baritone/releases/) -[![Minecraft](https://img.shields.io/badge/MC-1.12.2-green.svg)](https://github.com/cabaletta/baritone/tree/master/) +[![Minecraft](https://img.shields.io/badge/MC-1.12.2-brightgreen.svg)](https://github.com/cabaletta/baritone/tree/master/) [![Minecraft](https://img.shields.io/badge/MC-1.13.2-brightgreen.svg)](https://github.com/cabaletta/baritone/tree/1.13.2/) +[![Minecraft](https://img.shields.io/badge/MC-1.14.4-brightgreen.svg)](https://github.com/cabaletta/baritone/tree/1.14.4/) [![Code of Conduct](https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-blue.svg?style=flat)](https://github.com/cabaletta/baritone/blob/master/CODE_OF_CONDUCT.md) [![Known Vulnerabilities](https://snyk.io/test/github/cabaletta/baritone/badge.svg?targetFile=build.gradle)](https://snyk.io/test/github/cabaletta/baritone?targetFile=build.gradle) [![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/cabaletta/baritone/issues/) @@ -31,6 +32,8 @@ Baritone is the pathfinding system used in [Impact](https://impactdevelopment.gi The easiest way to install Baritone is to install [Impact](https://impactdevelopment.github.io/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the forge jar from [releases](https://github.com/cabaletta/baritone/releases). Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. +For 1.14.4, [click here](https://www.dropbox.com/s/rkml3hjokd3qv0m/1.14.4-Baritone.zip?dl=1). + This project is an updated version of [MineBot](https://github.com/leijurv/MineBot/), the original version of the bot for Minecraft 1.8.9, rebuilt for 1.12.2 and 1.13.2. Baritone focuses on reliability and particularly performance (it's over [30x faster](https://github.com/cabaletta/baritone/pull/180#issuecomment-423822928) than MineBot at calculating paths). diff --git a/SETUP.md b/SETUP.md index aca5f6c5a..3492beaa9 100644 --- a/SETUP.md +++ b/SETUP.md @@ -2,6 +2,8 @@ The easiest way to install Baritone is to install [Impact](https://impactdevelopment.github.io/), which comes with Baritone. +For 1.14.4, [click here](https://www.dropbox.com/s/rkml3hjokd3qv0m/1.14.4-Baritone.zip?dl=1). + Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. ## Prebuilt official releases From f5b4de023f8a295dac5321ee7e2ef060410c27ed Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 24 Jul 2019 15:33:39 -0700 Subject: [PATCH 02/29] update usage stuff --- USAGE.md | 5 ++- .../api/utils/ExampleBaritoneControl.java | 45 +++++-------------- 2 files changed, 13 insertions(+), 37 deletions(-) diff --git a/USAGE.md b/USAGE.md index 865670b63..b01bf3fa7 100644 --- a/USAGE.md +++ b/USAGE.md @@ -18,14 +18,15 @@ To toggle a boolean setting, just say its name in chat (for example saying `allo Some common examples: - `thisway 1000` then `path` to go in the direction you're facing for a thousand blocks -- `goal x y z` or `goal x z` or `goal y`, then `path` to go to a certain coordinate +- `goal x y z` or `goal x z` or `goal y`, then `path` to set a goal to a certain coordinate then path to it +- `goto x y z` or `goto x z` or `goto y` to go to a certain coordinate (in a single step, starts going immediately) - `goal` to set the goal to your player's feet - `goal clear` to clear the goal - `cancel` or `stop` to stop everything - `goto portal` or `goto ender_chest` or `goto block_type` to go to a block. (in Impact, `.goto` is an alias for `.b goto` for the most part) - `mine diamond_ore` to mine diamond ore (turn on the setting `legitMine` to only mine ores that it can actually see. It will explore randomly around y=11 until it finds them.) - `click` to click your destination on the screen. Right click path to on top of the block, left click to path into it (either at foot level or eye level), and left click and drag to clear all blocks from an area. -- `follow playerName` to follow a player. `follow` to follow the entity you're looking at (only works if it hitting range). `followplayers` to follow any players in range (combine with Kill Aura for a fun time). +- `follow playerName` to follow a player. `followplayers` to follow any players in range (combine with Kill Aura for a fun time). `followentities` to follow any entities. `followentity pig` to follow entities of a specific type. - `save waypointName` to save a waypoint. `goto waypointName` to go to it. - `build` to build a schematic. `build blah` will load `schematics/blah.schematic` and build it with the origin being your player feet. `build blah x y z` to set the origin. Any of those can be relative to your player (`~ 69 ~-420` would build at x=player x, y=69, z=player z-420). - `schematica` to build the schematic that is currently open in schematica diff --git a/src/api/java/baritone/api/utils/ExampleBaritoneControl.java b/src/api/java/baritone/api/utils/ExampleBaritoneControl.java index 463001501..bfa6a6403 100644 --- a/src/api/java/baritone/api/utils/ExampleBaritoneControl.java +++ b/src/api/java/baritone/api/utils/ExampleBaritoneControl.java @@ -40,44 +40,16 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.ReportedException; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.event.ClickEvent; import net.minecraft.world.chunk.Chunk; import java.nio.file.Path; import java.util.*; public class ExampleBaritoneControl implements Helper, AbstractGameEventListener { - - private static final String HELP_MSG = - "baritone - Output settings into chat\n" + - "settings - Same as baritone\n" + - "goal - Create a goal (one number is '', two is ' ', three is ' , 'clear' to clear)\n" + - "path - Go towards goal\n" + - "repack - (debug) Repacks chunk cache\n" + - "rescan - (debug) Same as repack\n" + - "axis - Paths towards the closest axis or diagonal axis, at y=120\n" + - "cancel - Cancels current path\n" + - "forcecancel - sudo cancel (only use if very glitched, try toggling 'pause' first)\n" + - "gc - Calls System.gc();\n" + - "invert - Runs away from the goal instead of towards it\n" + - "follow - Follows a player 'follow username'\n" + - "reloadall - (debug) Reloads chunk cache\n" + - "saveall - (debug) Saves chunk cache\n" + - "find - (debug) outputs how many blocks of a certain type are within the cache\n" + - "mine - Paths to and mines specified blocks 'mine x_ore y_ore ...'\n" + - "thisway - Creates a goal X blocks where you're facing\n" + - "list - Lists waypoints under a category\n" + - "get - Same as list\n" + - "show - Same as list\n" + - "save - Saves a waypoint (works but don't try to make sense of it)\n" + - "delete - Deletes a waypoint\n" + - "goto - Paths towards specified block or waypoint\n" + - "spawn - Paths towards world spawn or your most recent bed right-click\n" + - "sethome - Sets \"home\"\n" + - "home - Paths towards \"home\" \n" + - "costs - (debug) all movement costs from current location\n" + - "damn - Daniel\n" + - "Go to https://github.com/cabaletta/baritone/blob/master/USAGE.md for more information"; - private static final String COMMAND_PREFIX = "#"; public final IBaritone baritone; @@ -148,9 +120,12 @@ public boolean runCommand(String msg0) { // you may think this can be private, b return true; } if (msg.equals("") || msg.equals("help") || msg.equals("?")) { - for (String line : HELP_MSG.split("\n")) { - logDirect(line); - } + ITextComponent component = MESSAGE_PREFIX.createCopy(); + component.getStyle().setColor(TextFormatting.GRAY); + TextComponentString helpLink = new TextComponentString(" Click here for instructions on how to use Baritone (https://github.com/cabaletta/baritone/blob/master/USAGE.md)"); + helpLink.getStyle().setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "https://github.com/cabaletta/baritone/blob/master/USAGE.md")); + component.appendSibling(helpLink); + BaritoneAPI.getSettings().logger.value.accept(component); return true; } if (msg.contains(" ")) { From bc849daccbb717c75a4fa8f8de28026c375ee99e Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 24 Jul 2019 15:38:14 -0700 Subject: [PATCH 03/29] v1.2.8 --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 1264f0fe1..05b953954 100755 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ */ group 'baritone' -version '1.2.7' +version '1.2.8' buildscript { repositories { @@ -59,7 +59,7 @@ sourceSets { schematica_api { compileClasspath += main.compileClasspath } - + main { compileClasspath += schematica_api.output } From a8226ba4c8351320b5ac69fc74c8787c452b82bb Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 24 Jul 2019 15:43:37 -0700 Subject: [PATCH 04/29] v1.3.4 --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 60787748d..7edc527ee 100755 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ */ group 'baritone' -version '1.3.3' +version '1.3.4' buildscript { repositories { From 1c5e0b4d688c740decf0107ee6f3807c29b7d1fc Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 25 Jul 2019 23:02:44 -0700 Subject: [PATCH 05/29] bump impact badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 68d4af7a8..64c2a0ba3 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ ![Lines of Code](https://tokei.rs/b1/github/cabaletta/baritone?category=code) [![GitHub contributors](https://img.shields.io/github/contributors/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/graphs/contributors/) [![GitHub commits](https://img.shields.io/github/commits-since/cabaletta/baritone/v1.0.0.svg)](https://github.com/cabaletta/baritone/commit/) -[![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.2.6%20/%20v1.3.2-brightgreen.svg)](https://impactdevelopment.github.io/) +[![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.2.8%20/%20v1.3.4-brightgreen.svg)](https://impactdevelopment.github.io/) [![ForgeHax integration](https://img.shields.io/badge/ForgeHax%20%22integration%22-scuffed-yellow.svg)](https://github.com/fr1kin/ForgeHax/) [![WWE integration](https://img.shields.io/badge/WWE%20%22integration%22-master%3F-green.svg)](https://wweclient.com/) [![Future integration](https://img.shields.io/badge/Future%20integration-Soon™%3F%3F%3F-red.svg)](https://futureclient.net/) From 1b481c6765d305300d2fadad4c212aa04319e85c Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 26 Jul 2019 15:14:04 -0700 Subject: [PATCH 06/29] aristois badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 64c2a0ba3..67cdb46c6 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ [![GitHub commits](https://img.shields.io/github/commits-since/cabaletta/baritone/v1.0.0.svg)](https://github.com/cabaletta/baritone/commit/) [![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.2.8%20/%20v1.3.4-brightgreen.svg)](https://impactdevelopment.github.io/) [![ForgeHax integration](https://img.shields.io/badge/ForgeHax%20%22integration%22-scuffed-yellow.svg)](https://github.com/fr1kin/ForgeHax/) +[![Aristois add-on integration](https://img.shields.io/badge/Aristois%20add--on%22integration-v1.3.4-green.svg)](https://gitlab.com/emc-mods-indrit/baritone_api) [![WWE integration](https://img.shields.io/badge/WWE%20%22integration%22-master%3F-green.svg)](https://wweclient.com/) [![Future integration](https://img.shields.io/badge/Future%20integration-Soon™%3F%3F%3F-red.svg)](https://futureclient.net/) [![forthebadge](https://forthebadge.com/images/badges/built-with-swag.svg)](http://forthebadge.com/) From fe6ca97f21a4482bfa915d2d0d0c40e74db5af69 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 26 Jul 2019 15:14:35 -0700 Subject: [PATCH 07/29] whoops --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 67cdb46c6..552d5f80c 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ [![GitHub commits](https://img.shields.io/github/commits-since/cabaletta/baritone/v1.0.0.svg)](https://github.com/cabaletta/baritone/commit/) [![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.2.8%20/%20v1.3.4-brightgreen.svg)](https://impactdevelopment.github.io/) [![ForgeHax integration](https://img.shields.io/badge/ForgeHax%20%22integration%22-scuffed-yellow.svg)](https://github.com/fr1kin/ForgeHax/) -[![Aristois add-on integration](https://img.shields.io/badge/Aristois%20add--on%22integration-v1.3.4-green.svg)](https://gitlab.com/emc-mods-indrit/baritone_api) +[![Aristois add-on integration](https://img.shields.io/badge/Aristois%20add--on%20integration-v1.3.4-green.svg)](https://gitlab.com/emc-mods-indrit/baritone_api) [![WWE integration](https://img.shields.io/badge/WWE%20%22integration%22-master%3F-green.svg)](https://wweclient.com/) [![Future integration](https://img.shields.io/badge/Future%20integration-Soon™%3F%3F%3F-red.svg)](https://futureclient.net/) [![forthebadge](https://forthebadge.com/images/badges/built-with-swag.svg)](http://forthebadge.com/) From 07cbc47fb2bac6d15b460b07493d7e5d175d3216 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 27 Jul 2019 23:51:23 -0700 Subject: [PATCH 08/29] extra line --- src/main/java/baritone/process/BuilderProcess.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 5317c39aa..99edba4ac 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -434,7 +434,6 @@ public int lengthZ() { } } - Goal goal = assemble(bcc, approxPlacable.subList(0, 9)); if (goal == null) { goal = assemble(bcc, approxPlacable); // we're far away, so assume that we have our whole inventory to recalculate placable properly From 551b6b88d2bdafa38a3ca63a18b1fd380c39ce74 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 28 Jul 2019 00:19:14 -0700 Subject: [PATCH 09/29] EXTREMELY old comment that is no longer true --- src/main/java/baritone/pathing/path/PathExecutor.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/path/PathExecutor.java b/src/main/java/baritone/pathing/path/PathExecutor.java index e03a20ccd..97bee4245 100644 --- a/src/main/java/baritone/pathing/path/PathExecutor.java +++ b/src/main/java/baritone/pathing/path/PathExecutor.java @@ -43,8 +43,7 @@ import static baritone.api.pathing.movement.MovementStatus.*; /** - * Behavior to execute a precomputed path. Does not (yet) deal with path segmentation or stitching - * or cutting (jumping onto the next path if it starts with a backtrack of this path's ending) + * Behavior to execute a precomputed path * * @author leijurv */ From 6f251b64f1fbeea2be52f31e7356705fdbe39837 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 29 Jul 2019 17:35:06 -0700 Subject: [PATCH 10/29] i am very stupid --- src/api/java/baritone/api/utils/MyChunkPos.java | 2 +- src/main/java/baritone/process/ExploreProcess.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/utils/MyChunkPos.java b/src/api/java/baritone/api/utils/MyChunkPos.java index 1df7481db..8b61012f9 100644 --- a/src/api/java/baritone/api/utils/MyChunkPos.java +++ b/src/api/java/baritone/api/utils/MyChunkPos.java @@ -27,7 +27,7 @@ public class MyChunkPos { @SerializedName("x") public int x; - @SerializedName("y") + @SerializedName("z") public int z; @Override diff --git a/src/main/java/baritone/process/ExploreProcess.java b/src/main/java/baritone/process/ExploreProcess.java index 54c2a6987..3fa3d4133 100644 --- a/src/main/java/baritone/process/ExploreProcess.java +++ b/src/main/java/baritone/process/ExploreProcess.java @@ -140,6 +140,9 @@ private Goal[] closestUncachedChunks(BlockPos center, IChunkFilter filter) { centers.add(new BlockPos(centerX, 0, centerZ)); } } + if (dist % 10 == 0) { + count = Math.min(filter.countRemain(), Baritone.settings().exploreChunkSetMinimumSize.value); + } if (centers.size() >= count) { return centers.stream().map(pos -> createGoal(pos.getX(), pos.getZ())).toArray(Goal[]::new); } From 06c62029c5455107ac88f0d4b1a1bb286579c92d Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 30 Jul 2019 20:04:50 -0700 Subject: [PATCH 11/29] not iffy --- src/main/java/baritone/Baritone.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index 5838134a0..a4b2d4368 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -148,12 +148,12 @@ public InputOverrideHandler getInputOverrideHandler() { } @Override - public CustomGoalProcess getCustomGoalProcess() { // Iffy + public CustomGoalProcess getCustomGoalProcess() { return this.customGoalProcess; } @Override - public GetToBlockProcess getGetToBlockProcess() { // Iffy + public GetToBlockProcess getGetToBlockProcess() { return this.getToBlockProcess; } From bba4c091954172b6a002f455d3937db61f642f84 Mon Sep 17 00:00:00 2001 From: Conner Date: Tue, 30 Jul 2019 21:07:26 -0700 Subject: [PATCH 12/29] Add parkour ascend --- src/api/java/baritone/api/Settings.java | 7 +++ .../pathing/calc/AbstractNodeCostSearch.java | 2 +- .../pathing/movement/CalculationContext.java | 2 + .../java/baritone/pathing/movement/Moves.java | 8 +-- .../movement/movements/MovementParkour.java | 56 ++++++++++++++----- 5 files changed, 55 insertions(+), 20 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 031443f4f..4ea5f8da1 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -124,6 +124,13 @@ public final class Settings { */ public final Setting allowJumpAt256 = new Setting<>(false); + /** + * This should be monetized it's so good + *

+ * Defaults to true, but only actually takes effect if allowParkour is also true + */ + public final Setting allowParkourAscend = new Setting<>(true); + /** * Allow descending diagonally *

diff --git a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java index 302827481..a67384acc 100644 --- a/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java +++ b/src/main/java/baritone/pathing/calc/AbstractNodeCostSearch.java @@ -127,7 +127,7 @@ public synchronized PathCalculationResult calculate(long primaryTimeout, long fa return new PathCalculationResult(PathCalculationResult.Type.SUCCESS_SEGMENT, path); } } catch (Exception e) { - Helper.HELPER.logDebug("Pathing exception: " + e); + Helper.HELPER.logDirect("Pathing exception: " + e); e.printStackTrace(); return new PathCalculationResult(PathCalculationResult.Type.EXCEPTION); } finally { diff --git a/src/main/java/baritone/pathing/movement/CalculationContext.java b/src/main/java/baritone/pathing/movement/CalculationContext.java index 4dda32831..2f82513ea 100644 --- a/src/main/java/baritone/pathing/movement/CalculationContext.java +++ b/src/main/java/baritone/pathing/movement/CalculationContext.java @@ -58,6 +58,7 @@ public class CalculationContext { public final boolean allowParkour; public final boolean allowParkourPlace; public final boolean allowJumpAt256; + public final boolean allowParkourAscend; public final boolean assumeWalkOnWater; public final boolean allowDiagonalDescend; public final boolean allowDownward; @@ -90,6 +91,7 @@ public CalculationContext(IBaritone baritone, boolean forUseOnAnotherThread) { this.allowParkour = Baritone.settings().allowParkour.value; this.allowParkourPlace = Baritone.settings().allowParkourPlace.value; this.allowJumpAt256 = Baritone.settings().allowJumpAt256.value; + this.allowParkourAscend = Baritone.settings().allowParkourAscend.value; this.assumeWalkOnWater = Baritone.settings().assumeWalkOnWater.value; this.allowDiagonalDescend = Baritone.settings().allowDiagonalDescend.value; this.allowDownward = Baritone.settings().allowDownward.value; diff --git a/src/main/java/baritone/pathing/movement/Moves.java b/src/main/java/baritone/pathing/movement/Moves.java index c626327e1..da278436f 100644 --- a/src/main/java/baritone/pathing/movement/Moves.java +++ b/src/main/java/baritone/pathing/movement/Moves.java @@ -276,7 +276,7 @@ public void apply(CalculationContext context, int x, int y, int z, MutableMoveRe } }, - PARKOUR_NORTH(0, 0, -4, true, false) { + PARKOUR_NORTH(0, 0, -4, true, true) { @Override public Movement apply0(CalculationContext context, BetterBlockPos src) { return MovementParkour.cost(context, src, EnumFacing.NORTH); @@ -288,7 +288,7 @@ public void apply(CalculationContext context, int x, int y, int z, MutableMoveRe } }, - PARKOUR_SOUTH(0, 0, +4, true, false) { + PARKOUR_SOUTH(0, 0, +4, true, true) { @Override public Movement apply0(CalculationContext context, BetterBlockPos src) { return MovementParkour.cost(context, src, EnumFacing.SOUTH); @@ -300,7 +300,7 @@ public void apply(CalculationContext context, int x, int y, int z, MutableMoveRe } }, - PARKOUR_EAST(+4, 0, 0, true, false) { + PARKOUR_EAST(+4, 0, 0, true, true) { @Override public Movement apply0(CalculationContext context, BetterBlockPos src) { return MovementParkour.cost(context, src, EnumFacing.EAST); @@ -312,7 +312,7 @@ public void apply(CalculationContext context, int x, int y, int z, MutableMoveRe } }, - PARKOUR_WEST(-4, 0, 0, true, false) { + PARKOUR_WEST(-4, 0, 0, true, true) { @Override public Movement apply0(CalculationContext context, BetterBlockPos src) { return MovementParkour.cost(context, src, EnumFacing.WEST); diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 88ffb1d92..fc170e62e 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -43,18 +43,20 @@ public class MovementParkour extends Movement { private final EnumFacing direction; private final int dist; + private final boolean ascend; - private MovementParkour(IBaritone baritone, BetterBlockPos src, int dist, EnumFacing dir) { - super(baritone, src, src.offset(dir, dist), EMPTY, src.offset(dir, dist).down()); + private MovementParkour(IBaritone baritone, BetterBlockPos src, int dist, EnumFacing dir, boolean ascend) { + super(baritone, src, src.offset(dir, dist).up(ascend ? 1 : 0), EMPTY, src.offset(dir, dist).down(ascend ? 0 : 1)); this.direction = dir; this.dist = dist; + this.ascend = ascend; } public static MovementParkour cost(CalculationContext context, BetterBlockPos src, EnumFacing direction) { MutableMoveResult res = new MutableMoveResult(); cost(context, src.x, src.y, src.z, direction, res); int dist = Math.abs(res.x - src.x) + Math.abs(res.z - src.z); - return new MovementParkour(context.getBaritone(), src, dist, direction); + return new MovementParkour(context.getBaritone(), src, dist, direction, res.y != src.y); } public static void cost(CalculationContext context, int x, int y, int z, EnumFacing dir, MutableMoveResult res) { @@ -103,19 +105,35 @@ public static void cost(CalculationContext context, int x, int y, int z, EnumFac } } for (int i = 2; i <= maxJump; i++) { - // TODO perhaps dest.up(3) doesn't need to be fullyPassable, just canWalkThrough, possibly? - for (int y2 = 0; y2 < 4; y2++) { - if (!MovementHelper.fullyPassable(context, x + xDiff * i, y + y2, z + zDiff * i)) { - return; + int destX = x + xDiff * i; + int destZ = z + zDiff * i; + if (!MovementHelper.fullyPassable(context, destX, y + 1, destZ)) { + return; + } + if (!MovementHelper.fullyPassable(context, destX, y + 2, destZ)) { + return; + } + if (!MovementHelper.fullyPassable(context, destX, y, destZ)) { + if (i <= 3 && context.allowParkourAscend && context.canSprint && MovementHelper.canWalkOn(context.bsi, destX, y, destZ) && checkOvershootSafety(context.bsi, destX + xDiff, y + 1, destZ + zDiff)) { + res.x = destX; + res.y = y + 1; + res.z = destZ; + res.cost = costFromJumpDistance(i) + context.jumpPenalty; } + return; } - IBlockState landingOn = context.bsi.get0(x + xDiff * i, y - 1, z + zDiff * i); + IBlockState landingOn = context.bsi.get0(destX, y - 1, destZ); // farmland needs to be canwalkon otherwise farm can never work at all, but we want to specifically disallow ending a jumy on farmland haha - if (landingOn.getBlock() != Blocks.FARMLAND && MovementHelper.canWalkOn(context.bsi, x + xDiff * i, y - 1, z + zDiff * i, landingOn)) { - res.x = x + xDiff * i; - res.y = y; - res.z = z + zDiff * i; - res.cost = costFromJumpDistance(i) + context.jumpPenalty; + if (landingOn.getBlock() != Blocks.FARMLAND && MovementHelper.canWalkOn(context.bsi, destX, y - 1, destZ, landingOn)) { + if (checkOvershootSafety(context.bsi, destX + xDiff, y, destZ + zDiff)) { + res.x = destX; + res.y = y; + res.z = destZ; + res.cost = costFromJumpDistance(i) + context.jumpPenalty; + } + return; + } + if (!MovementHelper.fullyPassable(context, destX, y + 3, destZ)) { return; } } @@ -136,6 +154,9 @@ public static void cost(CalculationContext context, int x, int y, int z, EnumFac if (!MovementHelper.isReplacable(destX, y - 1, destZ, toReplace, context.bsi)) { return; } + if (!checkOvershootSafety(context.bsi, destX + xDiff, y, destZ + zDiff)) { + return; + } for (int i = 0; i < 5; i++) { int againstX = destX + HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP[i].getXOffset(); int againstY = y - 1 + HORIZONTALS_BUT_ALSO_DOWN_____SO_EVERY_DIRECTION_EXCEPT_UP[i].getYOffset(); @@ -153,6 +174,11 @@ public static void cost(CalculationContext context, int x, int y, int z, EnumFac } } + private static boolean checkOvershootSafety(BlockStateInterface bsi, int x, int y, int z) { + // we're going to walk into these two blocks after the landing of the parkour anyway, so make sure they aren't avoidWalkingInto + return !MovementHelper.avoidWalkingInto(bsi.get0(x, y, z).getBlock()) && !MovementHelper.avoidWalkingInto(bsi.get0(x, y + 1, z).getBlock()); + } + private static double costFromJumpDistance(int dist) { switch (dist) { case 2: @@ -211,7 +237,7 @@ public MovementState updateState(MovementState state) { logDebug("sorry"); return state.setStatus(MovementStatus.UNREACHABLE); } - if (dist >= 4) { + if (dist >= 4 || ascend) { state.setInput(Input.SPRINT, true); } MovementHelper.moveTowards(ctx, state, dest); @@ -231,7 +257,7 @@ public MovementState updateState(MovementState state) { // go in the opposite order to check DOWN before all horizontals -- down is preferable because you don't have to look to the side while in midair, which could mess up the trajectory state.setInput(Input.CLICK_RIGHT, true); } - if (dist == 3) { // this is a 2 block gap, dest = src + direction * 3 + if (dist == 3 && !ascend) { // this is a 2 block gap, dest = src + direction * 3 double xDiff = (src.x + 0.5) - ctx.player().posX; double zDiff = (src.z + 0.5) - ctx.player().posZ; double distFromStart = Math.max(Math.abs(xDiff), Math.abs(zDiff)); From 9541a45451aefa87a4534bc2aa19a8de202bada0 Mon Sep 17 00:00:00 2001 From: Conner Date: Tue, 30 Jul 2019 21:37:50 -0700 Subject: [PATCH 13/29] Resolve comments --- .../baritone/pathing/movement/movements/MovementParkour.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index fc170e62e..40cf25653 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -56,7 +56,7 @@ public static MovementParkour cost(CalculationContext context, BetterBlockPos sr MutableMoveResult res = new MutableMoveResult(); cost(context, src.x, src.y, src.z, direction, res); int dist = Math.abs(res.x - src.x) + Math.abs(res.z - src.z); - return new MovementParkour(context.getBaritone(), src, dist, direction, res.y != src.y); + return new MovementParkour(context.getBaritone(), src, dist, direction, res.y > src.y); } public static void cost(CalculationContext context, int x, int y, int z, EnumFacing dir, MutableMoveResult res) { @@ -118,7 +118,7 @@ public static void cost(CalculationContext context, int x, int y, int z, EnumFac res.x = destX; res.y = y + 1; res.z = destZ; - res.cost = costFromJumpDistance(i) + context.jumpPenalty; + res.cost = i * SPRINT_ONE_BLOCK_COST + context.jumpPenalty; } return; } @@ -257,6 +257,7 @@ public MovementState updateState(MovementState state) { // go in the opposite order to check DOWN before all horizontals -- down is preferable because you don't have to look to the side while in midair, which could mess up the trajectory state.setInput(Input.CLICK_RIGHT, true); } + // prevent jumping too late by checking for ascend if (dist == 3 && !ascend) { // this is a 2 block gap, dest = src + direction * 3 double xDiff = (src.x + 0.5) - ctx.player().posX; double zDiff = (src.z + 0.5) - ctx.player().posZ; From 5f721b544e2b46682f10a143f38ccd79b39554b8 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 31 Jul 2019 20:47:46 -0700 Subject: [PATCH 14/29] smh conner, imagine getting the same block position 2x without caching --- .../baritone/pathing/movement/movements/MovementParkour.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 40cf25653..736e6ee19 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -113,8 +113,9 @@ public static void cost(CalculationContext context, int x, int y, int z, EnumFac if (!MovementHelper.fullyPassable(context, destX, y + 2, destZ)) { return; } - if (!MovementHelper.fullyPassable(context, destX, y, destZ)) { - if (i <= 3 && context.allowParkourAscend && context.canSprint && MovementHelper.canWalkOn(context.bsi, destX, y, destZ) && checkOvershootSafety(context.bsi, destX + xDiff, y + 1, destZ + zDiff)) { + IBlockState destInto = context.bsi.get0(destX, y, destZ); + if (!MovementHelper.fullyPassable(destInto)) { + if (i <= 3 && context.allowParkourAscend && context.canSprint && MovementHelper.canWalkOn(context.bsi, destX, y, destZ, destInto) && checkOvershootSafety(context.bsi, destX + xDiff, y + 1, destZ + zDiff)) { res.x = destX; res.y = y + 1; res.z = destZ; From 01c0e321b598f48dc3a90bc5130057d37abab55b Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 31 Jul 2019 20:58:45 -0700 Subject: [PATCH 15/29] what was i THINKING --- src/main/java/baritone/behavior/PathingBehavior.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index a5ffc5987..e061f757a 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -135,7 +135,6 @@ private void tickPath() { ) { // when it was *just* started, currentBest will be empty so we need to also check calcFrom since that's always present inProgress.cancel(); // cancellation doesn't dispatch any events - inProgress = null; // this is safe since we hold both locks } } } From 8bcbd0231e726d64be6724295c5d68492eec4cb4 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 31 Jul 2019 21:45:57 -0700 Subject: [PATCH 16/29] bye --- src/main/java/baritone/behavior/PathingBehavior.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index e061f757a..7a23222fc 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -360,12 +360,6 @@ public void forceCancel() { // exposed on public api because :sob: } } - /*public void secretCursedFunctionDoNotCall(IPath path) { - synchronized (pathPlanLock) { - current = new PathExecutor(this, path); - } - }*/ - public CalculationContext secretInternalGetCalculationContext() { return context; } From 19fe29ad1edba3033063e0884bca8a3ad99bb5e3 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 31 Jul 2019 22:17:44 -0700 Subject: [PATCH 17/29] i am stupid --- src/main/java/baritone/pathing/movement/MovementHelper.java | 2 +- .../baritone/pathing/movement/movements/MovementParkour.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 520baa81c..b7dd442dc 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -506,7 +506,7 @@ static PlaceResult attemptToPlaceABlock(MovementState state, IBaritone baritone, return PlaceResult.NO_OPTION; } double faceX = (placeAt.getX() + against1.getX() + 1.0D) * 0.5D; - double faceY = (placeAt.getY() + against1.getY() + 1.0D) * 0.5D; + double faceY = (placeAt.getY() + against1.getY() + 0.5D) * 0.5D; double faceZ = (placeAt.getZ() + against1.getZ() + 1.0D) * 0.5D; Rotation place = RotationUtils.calcRotationFromVec3d(ctx.playerHead(), new Vec3d(faceX, faceY, faceZ), ctx.playerRotations()); RayTraceResult res = RayTraceUtils.rayTraceTowards(ctx.player(), place, ctx.playerController().getBlockReachDistance()); diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 736e6ee19..8b33d68aa 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -198,7 +198,7 @@ private static double costFromJumpDistance(int dist) { public double calculateCost(CalculationContext context) { MutableMoveResult res = new MutableMoveResult(); cost(context, src.x, src.y, src.z, direction, res); - if (res.x != dest.x || res.z != dest.z) { + if (res.x != dest.x || res.y != dest.y || res.z != dest.z) { return COST_INF; } return res.cost; From 014d3b3a99ba306c8131f79438f466347fcfa7db Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 1 Aug 2019 23:47:12 -0700 Subject: [PATCH 18/29] goal can never be null --- src/main/java/baritone/behavior/PathingBehavior.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/behavior/PathingBehavior.java b/src/main/java/baritone/behavior/PathingBehavior.java index 7a23222fc..7219175ed 100644 --- a/src/main/java/baritone/behavior/PathingBehavior.java +++ b/src/main/java/baritone/behavior/PathingBehavior.java @@ -338,7 +338,7 @@ public void softCancelIfSafe() { } // just cancel the current path - public void secretInternalSegmentCancel() { + private void secretInternalSegmentCancel() { queuePathEvent(PathEvent.CANCELED); synchronized (pathPlanLock) { getInProgress().ifPresent(AbstractNodeCostSearch::cancel); @@ -488,7 +488,7 @@ private void findPathInNewThread(final BlockPos start, final boolean talkAboutIt } } if (talkAboutIt && current != null && current.getPath() != null) { - if (goal == null || goal.isInGoal(current.getPath().getDest())) { + if (goal.isInGoal(current.getPath().getDest())) { logDebug("Finished finding a path from " + start + " to " + goal + ". " + current.getPath().getNumNodesConsidered() + " nodes considered"); } else { logDebug("Found path segment from " + start + " towards " + goal + ". " + current.getPath().getNumNodesConsidered() + " nodes considered"); @@ -501,7 +501,7 @@ private void findPathInNewThread(final BlockPos start, final boolean talkAboutIt }); } - public static AbstractNodeCostSearch createPathfinder(BlockPos start, Goal goal, IPath previous, CalculationContext context) { + private static AbstractNodeCostSearch createPathfinder(BlockPos start, Goal goal, IPath previous, CalculationContext context) { Goal transformed = goal; if (Baritone.settings().simplifyUnloadedYCoord.value && goal instanceof IGoalRenderPos) { BlockPos pos = ((IGoalRenderPos) goal).getGoalPos(); From 081fae98c4f98c262ea68bd4a353d7033a9cb532 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 1 Aug 2019 23:47:32 -0700 Subject: [PATCH 19/29] 1 year later --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 552d5f80c..bdc405f1f 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ For 1.14.4, [click here](https://www.dropbox.com/s/rkml3hjokd3qv0m/1.14.4-Barito This project is an updated version of [MineBot](https://github.com/leijurv/MineBot/), the original version of the bot for Minecraft 1.8.9, rebuilt for 1.12.2 and 1.13.2. Baritone focuses on reliability and particularly performance (it's over [30x faster](https://github.com/cabaletta/baritone/pull/180#issuecomment-423822928) than MineBot at calculating paths). -Have committed at least once a day for the last 11 months =D 🦀 +Have committed at least once a day from Aug 1 2018 to Aug 1 2019. 1Leijurv3DWTrGAfmmiTphjhXLvQiHg7K2 From d402ba61cc425c25dcfe70c7c58d929218f258a9 Mon Sep 17 00:00:00 2001 From: Howard Stark Date: Thu, 8 Aug 2019 09:36:55 -1000 Subject: [PATCH 20/29] Disable lighting on path render --- src/main/java/baritone/utils/PathRenderer.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index b0924cc1d..b01572477 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -122,6 +122,7 @@ public static void render(RenderEvent event, PathingBehavior behavior) { public static void drawPath(IPath path, int startIndex, Entity player, float partialTicks, Color color, boolean fadeOut, int fadeStart0, int fadeEnd0) { GlStateManager.enableBlend(); + GlStateManager.disableLighting(); GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); GlStateManager.color(color.getColorComponents(null)[0], color.getColorComponents(null)[1], color.getColorComponents(null)[2], 0.4F); GlStateManager.glLineWidth(Baritone.settings().pathRenderLineWidthPixels.value); @@ -176,6 +177,7 @@ public static void drawPath(IPath path, int startIndex, Entity player, float par //GlStateManager.color(0.0f, 0.0f, 0.0f, 0.4f); GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); + GlStateManager.enableLighting(); GlStateManager.disableBlend(); } From 17a07ba85e043588c67f59065c6b767676e1ebc7 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 8 Aug 2019 09:56:06 -1000 Subject: [PATCH 21/29] better render --- src/api/java/baritone/api/utils/ExampleBaritoneControl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/utils/ExampleBaritoneControl.java b/src/api/java/baritone/api/utils/ExampleBaritoneControl.java index bfa6a6403..73f63e0c3 100644 --- a/src/api/java/baritone/api/utils/ExampleBaritoneControl.java +++ b/src/api/java/baritone/api/utils/ExampleBaritoneControl.java @@ -370,7 +370,8 @@ public boolean isInGoal(int x, int y, int z) { } if (msg.equals("render")) { BetterBlockPos pf = ctx.playerFeet(); - Minecraft.getMinecraft().renderGlobal.markBlockRangeForRenderUpdate(pf.x - 500, pf.y - 500, pf.z - 500, pf.x + 500, pf.y + 500, pf.z + 500); + int dist = (Minecraft.getMinecraft().gameSettings.renderDistanceChunks + 1) * 16; + Minecraft.getMinecraft().renderGlobal.markBlockRangeForRenderUpdate(pf.x - dist, pf.y - 256, pf.z - dist, pf.x + dist, pf.y + 256, pf.z + dist); logDirect("okay"); return true; } From ac6c413fb888cb53e6a357e11f00ade8362c7810 Mon Sep 17 00:00:00 2001 From: Friedolin2000 Date: Thu, 8 Aug 2019 22:45:18 +0200 Subject: [PATCH 22/29] dimensional coords extension --- .../api/utils/ExampleBaritoneControl.java | 42 +++++++++++++++---- 1 file changed, 35 insertions(+), 7 deletions(-) diff --git a/src/api/java/baritone/api/utils/ExampleBaritoneControl.java b/src/api/java/baritone/api/utils/ExampleBaritoneControl.java index bfa6a6403..d03c6fa41 100644 --- a/src/api/java/baritone/api/utils/ExampleBaritoneControl.java +++ b/src/api/java/baritone/api/utils/ExampleBaritoneControl.java @@ -44,11 +44,14 @@ import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.event.ClickEvent; +import net.minecraft.world.DimensionType; import net.minecraft.world.chunk.Chunk; import java.nio.file.Path; import java.util.*; +import static org.apache.commons.lang3.StringUtils.isNumeric; + public class ExampleBaritoneControl implements Helper, AbstractGameEventListener { private static final String COMMAND_PREFIX = "#"; @@ -260,7 +263,7 @@ public boolean runCommand(String msg0) { // you may think this can be private, b try { String[] coords = msg.substring("build".length()).trim().split(" "); file = coords[0] + ".schematic"; - origin = new BlockPos(parseOrDefault(coords[1], ctx.playerFeet().x), parseOrDefault(coords[2], ctx.playerFeet().y), parseOrDefault(coords[3], ctx.playerFeet().z)); + origin = new BlockPos(parseOrDefault(coords[1], ctx.playerFeet().x, 1), parseOrDefault(coords[2], ctx.playerFeet().y, 1), parseOrDefault(coords[3], ctx.playerFeet().z, 1)); } catch (Exception ex) { file = msg.substring(5).trim() + ".schematic"; origin = ctx.playerFeet(); @@ -672,8 +675,8 @@ public boolean isInGoal(int x, int y, int z) { return false; } - private int parseOrDefault(String str, int i) { - return str.equals("~") ? i : str.startsWith("~") ? Integer.parseInt(str.substring(1)) + i : Integer.parseInt(str); + private int parseOrDefault(String str, int i, double dimensionFactor) { + return str.equals("~") ? i : str.startsWith("~") ? (int) (Integer.parseInt(str.substring(1)) * dimensionFactor) + i : (int) (Integer.parseInt(str) * dimensionFactor); } private void log(List stacks) { @@ -688,18 +691,23 @@ private Goal parseGoal(String[] params) { Goal goal; try { BetterBlockPos playerFeet = ctx.playerFeet(); - switch (params.length) { + + int length = params.length - 1; // length has to be smaller when a dimension parameter is added + if (params.length < 1 || (isNumeric(params[params.length - 1]) || params[params.length - 1].startsWith("~"))) { + length = params.length; + } + switch (length) { case 0: goal = new GoalBlock(playerFeet); break; case 1: - goal = new GoalYLevel(parseOrDefault(params[0], playerFeet.y)); + goal = new GoalYLevel(parseOrDefault(params[0], playerFeet.y, 1)); break; case 2: - goal = new GoalXZ(parseOrDefault(params[0], playerFeet.x), parseOrDefault(params[1], playerFeet.z)); + goal = new GoalXZ(parseOrDefault(params[0], playerFeet.x, calculateDimensionFactor(params[params.length - 1])), parseOrDefault(params[1], playerFeet.z, calculateDimensionFactor(params[params.length - 1]))); break; case 3: - goal = new GoalBlock(new BlockPos(parseOrDefault(params[0], playerFeet.x), parseOrDefault(params[1], playerFeet.y), parseOrDefault(params[2], playerFeet.z))); + goal = new GoalBlock(new BlockPos(parseOrDefault(params[0], playerFeet.x, calculateDimensionFactor(params[params.length - 1])), parseOrDefault(params[1], playerFeet.y, 1), parseOrDefault(params[2], playerFeet.z, calculateDimensionFactor(params[params.length - 1])))); break; default: logDirect("unable to understand lol"); @@ -711,4 +719,24 @@ private Goal parseGoal(String[] params) { } return goal; } + + + + private double calculateDimensionFactor(String to) { + return Math.pow(8, ctx.world().provider.getDimensionType().getId() - getDimensionByName(to.toLowerCase()).getId()); + } + + private DimensionType getDimensionByName(String name) { + if ("the_end".contains(name)) { + return DimensionType.THE_END; + } + if ("the_overworld".contains(name) || "surface".contains(name)) { + return DimensionType.OVERWORLD; + } + if ("the_nether".contains(name) || "hell".contains(name)) { + return DimensionType.NETHER; + } + return ctx.world().provider.getDimensionType(); + } + } From 3d221dcda45b09e99e51a6b8b0e982930644fb3b Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 8 Aug 2019 18:04:49 -1000 Subject: [PATCH 23/29] antiquated and does more harm than good --- .../baritone/pathing/movement/movements/MovementParkour.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java index 8b33d68aa..8e660affd 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementParkour.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementParkour.java @@ -229,10 +229,6 @@ public MovementState updateState(MovementState state) { if (state.getStatus() != MovementStatus.RUNNING) { return state; } - if (ctx.player().isHandActive()) { - logDebug("Pausing parkour since hand is active"); - return state; - } if (ctx.playerFeet().y < src.y) { // we have fallen logDebug("sorry"); From 4c935fc44784b5020b7d23dfdea68c67f059d755 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 8 Aug 2019 18:09:25 -1000 Subject: [PATCH 24/29] epicer cached bedrock level pathing --- src/main/java/baritone/cache/CachedChunk.java | 118 ++++++++++-------- 1 file changed, 65 insertions(+), 53 deletions(-) diff --git a/src/main/java/baritone/cache/CachedChunk.java b/src/main/java/baritone/cache/CachedChunk.java index 249daa5b3..67ac69420 100644 --- a/src/main/java/baritone/cache/CachedChunk.java +++ b/src/main/java/baritone/cache/CachedChunk.java @@ -26,7 +26,10 @@ import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; -import java.util.*; +import java.util.ArrayList; +import java.util.BitSet; +import java.util.List; +import java.util.Map; /** * @author Brady @@ -35,57 +38,57 @@ public final class CachedChunk { public static final ImmutableSet BLOCKS_TO_KEEP_TRACK_OF = ImmutableSet.of( - Blocks.DIAMOND_BLOCK, - //Blocks.COAL_ORE, - Blocks.COAL_BLOCK, - //Blocks.IRON_ORE, - Blocks.IRON_BLOCK, - //Blocks.GOLD_ORE, - Blocks.GOLD_BLOCK, - Blocks.EMERALD_ORE, - Blocks.EMERALD_BLOCK, + Blocks.DIAMOND_BLOCK, + //Blocks.COAL_ORE, + Blocks.COAL_BLOCK, + //Blocks.IRON_ORE, + Blocks.IRON_BLOCK, + //Blocks.GOLD_ORE, + Blocks.GOLD_BLOCK, + Blocks.EMERALD_ORE, + Blocks.EMERALD_BLOCK, - Blocks.ENDER_CHEST, - Blocks.FURNACE, - Blocks.CHEST, - Blocks.TRAPPED_CHEST, - Blocks.END_PORTAL, - Blocks.END_PORTAL_FRAME, - Blocks.MOB_SPAWNER, - Blocks.BARRIER, - Blocks.OBSERVER, - Blocks.WHITE_SHULKER_BOX, - Blocks.ORANGE_SHULKER_BOX, - Blocks.MAGENTA_SHULKER_BOX, - Blocks.LIGHT_BLUE_SHULKER_BOX, - Blocks.YELLOW_SHULKER_BOX, - Blocks.LIME_SHULKER_BOX, - Blocks.PINK_SHULKER_BOX, - Blocks.GRAY_SHULKER_BOX, - Blocks.SILVER_SHULKER_BOX, - Blocks.CYAN_SHULKER_BOX, - Blocks.PURPLE_SHULKER_BOX, - Blocks.BLUE_SHULKER_BOX, - Blocks.BROWN_SHULKER_BOX, - Blocks.GREEN_SHULKER_BOX, - Blocks.RED_SHULKER_BOX, - Blocks.BLACK_SHULKER_BOX, - Blocks.PORTAL, - Blocks.HOPPER, - Blocks.BEACON, - Blocks.BREWING_STAND, - Blocks.SKULL, - Blocks.ENCHANTING_TABLE, - Blocks.ANVIL, - Blocks.LIT_FURNACE, - Blocks.BED, - Blocks.DRAGON_EGG, - Blocks.JUKEBOX, - Blocks.END_GATEWAY, - Blocks.WEB, - Blocks.NETHER_WART, - Blocks.LADDER, - Blocks.VINE + Blocks.ENDER_CHEST, + Blocks.FURNACE, + Blocks.CHEST, + Blocks.TRAPPED_CHEST, + Blocks.END_PORTAL, + Blocks.END_PORTAL_FRAME, + Blocks.MOB_SPAWNER, + Blocks.BARRIER, + Blocks.OBSERVER, + Blocks.WHITE_SHULKER_BOX, + Blocks.ORANGE_SHULKER_BOX, + Blocks.MAGENTA_SHULKER_BOX, + Blocks.LIGHT_BLUE_SHULKER_BOX, + Blocks.YELLOW_SHULKER_BOX, + Blocks.LIME_SHULKER_BOX, + Blocks.PINK_SHULKER_BOX, + Blocks.GRAY_SHULKER_BOX, + Blocks.SILVER_SHULKER_BOX, + Blocks.CYAN_SHULKER_BOX, + Blocks.PURPLE_SHULKER_BOX, + Blocks.BLUE_SHULKER_BOX, + Blocks.BROWN_SHULKER_BOX, + Blocks.GREEN_SHULKER_BOX, + Blocks.RED_SHULKER_BOX, + Blocks.BLACK_SHULKER_BOX, + Blocks.PORTAL, + Blocks.HOPPER, + Blocks.BEACON, + Blocks.BREWING_STAND, + Blocks.SKULL, + Blocks.ENCHANTING_TABLE, + Blocks.ANVIL, + Blocks.LIT_FURNACE, + Blocks.BED, + Blocks.DRAGON_EGG, + Blocks.JUKEBOX, + Blocks.END_GATEWAY, + Blocks.WEB, + Blocks.NETHER_WART, + Blocks.LADDER, + Blocks.VINE ); @@ -179,8 +182,17 @@ public final IBlockState getBlock(int x, int y, int z, int dimension) { } } - if (type == PathingBlockType.SOLID && y == 127 && dimension == -1) { - return Blocks.BEDROCK.getDefaultState(); + if (type == PathingBlockType.SOLID) { + if (y == 127 && dimension == -1) { + // nether roof is always unbreakable + return Blocks.BEDROCK.getDefaultState(); + } + if (y < 5 && dimension == 0) { + // solid blocks below 5 are commonly bedrock + // however, returning bedrock always would be a little yikes + // discourage paths that include breaking blocks below 5 a little more heavily just so that it takes paths breaking what's known to be stone (at 5 or above) instead of what could maybe be bedrock (below 5) + return Blocks.OBSIDIAN.getDefaultState(); + } } return ChunkPacker.pathingTypeToBlock(type, dimension); } From e1e6a08eb2fd15ac15c5de298240400b4f43901c Mon Sep 17 00:00:00 2001 From: Scribblefoxx <53978445+Scribblefoxx@users.noreply.github.com> Date: Sun, 11 Aug 2019 03:39:29 +1000 Subject: [PATCH 25/29] Update Settings.java --- src/api/java/baritone/api/Settings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 4ea5f8da1..7d575b0bc 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -186,7 +186,7 @@ public final class Settings { * Enables some more advanced vine features. They're honestly just gimmicks and won't ever be needed in real * pathing scenarios. And they can cause Baritone to get trapped indefinitely in a strange scenario. *

- * Never turn this on lol + * Almost never turn this on lol */ public final Setting allowVines = new Setting<>(false); From a98677dbdacc60bec126786de77d07bac7441bfd Mon Sep 17 00:00:00 2001 From: Brady Date: Thu, 15 Aug 2019 03:19:19 -0500 Subject: [PATCH 26/29] crucial performance optimization --- src/main/java/baritone/pathing/calc/AStarPathFinder.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/pathing/calc/AStarPathFinder.java index fc964d0f1..3e38ff41d 100644 --- a/src/main/java/baritone/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/pathing/calc/AStarPathFinder.java @@ -76,6 +76,7 @@ protected Optional calculate0(long primaryTimeout, long failureTimeout) { int timeCheckInterval = 1 << 6; int pathingMaxChunkBorderFetch = Baritone.settings().pathingMaxChunkBorderFetch.value; // grab all settings beforehand so that changing settings during pathing doesn't cause a crash or unpredictable behavior double minimumImprovement = Baritone.settings().minimumImprovementRepropagation.value ? MIN_IMPROVEMENT : 0; + Moves[] allMoves = Moves.values(); while (!openSet.isEmpty() && numEmptyChunk < pathingMaxChunkBorderFetch && !cancelRequested) { if ((numNodes & (timeCheckInterval - 1)) == 0) { // only call this once every 64 nodes (about half a millisecond) long now = System.currentTimeMillis(); // since nanoTime is slow on windows (takes many microseconds) @@ -95,7 +96,7 @@ protected Optional calculate0(long primaryTimeout, long failureTimeout) { logDebug("Took " + (System.currentTimeMillis() - startTime) + "ms, " + numMovementsConsidered + " movements considered"); return Optional.of(new Path(startNode, currentNode, numNodes, goal, calcContext)); } - for (Moves moves : Moves.values()) { + for (Moves moves : allMoves) { int newX = currentNode.x + moves.xOffset; int newZ = currentNode.z + moves.zOffset; if ((newX >> 4 != currentNode.x >> 4 || newZ >> 4 != currentNode.z >> 4) && !calcContext.isLoaded(newX, newZ)) { From 13caaf6fa7a3873e5b1a1423252516c5fafbd9ef Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 15 Aug 2019 19:27:46 -0700 Subject: [PATCH 27/29] ok fine optifine --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bdc405f1f..ab2355a81 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Baritone is the pathfinding system used in [Impact](https://impactdevelopment.gi The easiest way to install Baritone is to install [Impact](https://impactdevelopment.github.io/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the forge jar from [releases](https://github.com/cabaletta/baritone/releases). Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. -For 1.14.4, [click here](https://www.dropbox.com/s/rkml3hjokd3qv0m/1.14.4-Baritone.zip?dl=1). +For 1.14.4, [click here](https://www.dropbox.com/s/rkml3hjokd3qv0m/1.14.4-Baritone.zip?dl=1). Or [with optifine](https://github.com/cabaletta/baritone/issues/797). This project is an updated version of [MineBot](https://github.com/leijurv/MineBot/), the original version of the bot for Minecraft 1.8.9, rebuilt for 1.12.2 and 1.13.2. Baritone focuses on reliability and particularly performance (it's over [30x faster](https://github.com/cabaletta/baritone/pull/180#issuecomment-423822928) than MineBot at calculating paths). From 011b7427e29a7f9f4568138d1c6e293e83e94627 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 15 Aug 2019 23:03:16 -0700 Subject: [PATCH 28/29] fine lmao --- README.md | 2 +- SETUP.md | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ab2355a81..6a62c32d5 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ A Minecraft pathfinder bot. Baritone is the pathfinding system used in [Impact](https://impactdevelopment.github.io/) since 4.4. There's a [showcase video](https://www.youtube.com/watch?v=yI8hgW_m6dQ) made by @Adovin#3153 on Baritone's integration into Impact. [Here's](https://www.youtube.com/watch?v=StquF69-_wI) a video I made showing off what it can do. -The easiest way to install Baritone is to install [Impact](https://impactdevelopment.github.io/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the forge jar from [releases](https://github.com/cabaletta/baritone/releases). Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. +The easiest way to install Baritone is to install [Impact](https://impactdevelopment.github.io/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the v1.2.* forge api jar from [releases](https://github.com/cabaletta/baritone/releases). Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. For 1.14.4, [click here](https://www.dropbox.com/s/rkml3hjokd3qv0m/1.14.4-Baritone.zip?dl=1). Or [with optifine](https://github.com/cabaletta/baritone/issues/797). diff --git a/SETUP.md b/SETUP.md index 3492beaa9..909da5a8f 100644 --- a/SETUP.md +++ b/SETUP.md @@ -11,6 +11,8 @@ These releases are not always completely up to date with latest features, and ar Link to the releases page: [Releases](https://github.com/cabaletta/baritone/releases) +v1.2.* is for 1.12.2, v1.3.* is for 1.13.2 + Any official release will be GPG signed by leijurv (44A3EA646EADAC6A) and ZeroMemes (73A788379A197567). Please verify that the hash of the file you download is in `checksums.txt` and that `checksums_signed.asc` is a valid signature by those two public keys of `checksums.txt`. The build is fully deterministic and reproducible, and you can verify Travis did it properly by running `docker build --no-cache -t cabaletta/baritone .` yourself and comparing the shasum. This works identically on Travis, Mac, and Linux (if you have docker on Windows, I'd be grateful if you could let me know if it works there too). From 9046eb500b2a8a3cdc447e05cebc2a6c83a9d8e7 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 16 Aug 2019 21:16:41 -0700 Subject: [PATCH 29/29] crucial performance optimization --- src/main/java/baritone/pathing/calc/Path.java | 28 +++++-------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/src/main/java/baritone/pathing/calc/Path.java b/src/main/java/baritone/pathing/calc/Path.java index 76cd83960..f7bfbaa24 100644 --- a/src/main/java/baritone/pathing/calc/Path.java +++ b/src/main/java/baritone/pathing/calc/Path.java @@ -72,28 +72,9 @@ class Path extends PathBase { this.start = new BetterBlockPos(start.x, start.y, start.z); this.end = new BetterBlockPos(end.x, end.y, end.z); this.numNodes = numNodes; - this.path = new ArrayList<>(); this.movements = new ArrayList<>(); - this.nodes = new ArrayList<>(); this.goal = goal; this.context = context; - assemblePath(end); - } - - @Override - public Goal getGoal() { - return goal; - } - - /** - * Assembles this path given the end node. - * - * @param end The end node - */ - private void assemblePath(PathNode end) { - if (!path.isEmpty() || !movements.isEmpty()) { - throw new IllegalStateException(); - } PathNode current = end; LinkedList tempPath = new LinkedList<>(); LinkedList tempNodes = new LinkedList<>(); @@ -107,8 +88,13 @@ private void assemblePath(PathNode end) { // Can't directly convert from the PathNode pseudo linked list to an array because we don't know how long it is // inserting into a LinkedList keeps track of length, then when we addall (which calls .toArray) it's able // to performantly do that conversion since it knows the length. - path.addAll(tempPath); - nodes.addAll(tempNodes); + this.path = new ArrayList<>(tempPath); + this.nodes = new ArrayList<>(tempNodes); + } + + @Override + public Goal getGoal() { + return goal; } private boolean assembleMovements() {