From 9f5d9bceaaa2fd7c761313a648ce1b8157080c23 Mon Sep 17 00:00:00 2001 From: ads123ads <33590926+ads123ads@users.noreply.github.com> Date: Tue, 15 Oct 2019 15:34:22 +0530 Subject: [PATCH 01/84] The grammar mistakes were corrected --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 90173889d..0891e127c 100644 --- a/README.md +++ b/README.md @@ -31,14 +31,14 @@ A Minecraft pathfinder bot. Baritone is the pathfinding system used in [Impact](https://impactclient.net/) 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://impactclient.net/), 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. +The easiest way to install Baritone is to install [Impact](https://impactclient.net/), 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). 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 from Aug 1 2018 to Aug 1 2019. +Have committed at least once a day from Aug 1, 2018, to Aug 1, 2019. 1Leijurv3DWTrGAfmmiTphjhXLvQiHg7K2 @@ -62,7 +62,7 @@ The API is heavily documented, you can find the Javadocs for the latest release Please note that usage of anything located outside of the ``baritone.api`` package is not supported by the API release jar. -Below is an example of basic usage for changing some settings, and then pathing to a X/Z goal. +Below is an example of basic usage for changing some settings, and then pathing to an X/Z goal. ``` BaritoneAPI.getSettings().allowSprint.value = true; @@ -75,7 +75,7 @@ BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAnd ## Can I use Baritone as a library in my custom utility client? -That's what it's for, sure! (As long as usage is in compliance with the LGPL 3.0 License) +That's what it's for, sure! (As long as usage complies with the LGPL 3.0 License) ## How is it so fast? From 0fba32853b61891ee9608bad4553c0dad9c6ec03 Mon Sep 17 00:00:00 2001 From: Conner Vercellino Date: Wed, 20 Nov 2019 12:26:37 -0800 Subject: [PATCH 02/84] Create .gitmessage --- .gitmessage | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .gitmessage diff --git a/.gitmessage b/.gitmessage new file mode 100644 index 000000000..259d0702f --- /dev/null +++ b/.gitmessage @@ -0,0 +1,31 @@ + (<ticket>) + +# πŸ“ Update README.md (WD-1234) +# βœ… Add unit test for inputs (WD-1234) + +# <emoji> can be: +# 🎨 :art: when improving structure of the code +# ⚑️ :zap: when improving performance +# πŸ”₯ :fire: when removing code or files +# ✨ :sparkles: when introducing new features +# 🚧 :construction: when work in progress +# πŸ”¨ :hammer: when refactoring code +# πŸ“ :memo: when writing docs +# πŸ’„ :lipstick: when updating the UI and style files +# πŸ“ˆ :chart_with_upwards_trend: when adding analytics or tracking code +# 🌐 :globe_with_meridians: when adding internationalization and localization +# ✏️ :pencil2: when fixing typos +# 🚚 :truck: when moving or renaming files +# βœ… :white_check_mark: when adding tests + +# πŸ‘Œ :ok_hand: when updating code due to code review changes +# πŸ› :bug: when fixing a bug +# πŸš‘ :ambulance: when doing a critical hotfix +# 🚨 :rotating_light: when removing linter warnings + +# πŸ”€ :twisted_rightwards_arrows: when merging branches +# ⬆️ :arrow_up: when upgrading dependencies +# ⬇️ :arrow_down: when downgrading dependencies +# πŸ”§ :wrench: when changing configuration files +# πŸ”– :bookmark: when releasing / version tagging +# πŸ’š :green_heart: when fixing the CI build From 4c79701d22633d9626eb9185ddbb904803099b5a Mon Sep 17 00:00:00 2001 From: aUniqueUser <ds458@pm.me> Date: Sat, 29 Feb 2020 11:28:18 -0500 Subject: [PATCH 03/84] Make desktop notifications more useful --- src/api/java/baritone/api/Settings.java | 27 ++++++++++++++++++- .../java/baritone/process/BuilderProcess.java | 4 +++ .../baritone/process/CustomGoalProcess.java | 4 +++ .../java/baritone/process/ExploreProcess.java | 7 +++++ .../java/baritone/process/FarmProcess.java | 4 +++ .../java/baritone/process/MineProcess.java | 4 +++ 6 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 1bbde3b2b..5fd6b64c5 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -1047,10 +1047,35 @@ public final class Settings { public final Setting<Boolean> renderSelectionCorners = new Setting<>(true); /** - * Desktop Notifications + * Desktop notifications */ public final Setting<Boolean> desktopNotifications = new Setting<>(false); + /** + * Desktop notification on path complete + */ + public final Setting<Boolean> notificationOnPathComplete = new Setting<>(true); + + /** + * Desktop notification on farm fail + */ + public final Setting<Boolean> notificationOnFarmFail = new Setting<>(true); + + /** + * Desktop notification on build finished + */ + public final Setting<Boolean> notificationOnBuildFinished = new Setting<>(true); + + /** + * Desktop notification on explore finished + */ + public final Setting<Boolean> notificationOnExploreFinished = new Setting<>(true); + + /** + * Desktop notification on mine fail + */ + public final Setting<Boolean> notificationOnMineFail = new Setting<>(true); + /** * A map of lowercase setting field names to their respective setting */ diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 5af434923..4d57a3478 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -39,6 +39,7 @@ import baritone.pathing.movement.Movement; import baritone.pathing.movement.MovementHelper; import baritone.utils.BaritoneProcessHelper; import baritone.utils.BlockStateInterface; +import baritone.utils.NotificationHelper; import baritone.utils.PathingCommandContext; import baritone.utils.schematic.MapArtSchematic; import baritone.utils.schematic.SchematicSystem; @@ -406,6 +407,9 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil numRepeats++; if (repeat.equals(new Vec3i(0, 0, 0)) || (max != -1 && numRepeats >= max)) { logDirect("Done building"); + if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnBuildFinished.value) { + NotificationHelper.notify("Done building", false); + } onLostControl(); return null; } diff --git a/src/main/java/baritone/process/CustomGoalProcess.java b/src/main/java/baritone/process/CustomGoalProcess.java index b45c7d6f9..f925bec79 100644 --- a/src/main/java/baritone/process/CustomGoalProcess.java +++ b/src/main/java/baritone/process/CustomGoalProcess.java @@ -23,6 +23,7 @@ import baritone.api.process.ICustomGoalProcess; import baritone.api.process.PathingCommand; import baritone.api.process.PathingCommandType; import baritone.utils.BaritoneProcessHelper; +import baritone.utils.NotificationHelper; /** * As set by ExampleBaritoneControl or something idk @@ -93,6 +94,9 @@ public final class CustomGoalProcess extends BaritoneProcessHelper implements IC if (Baritone.settings().disconnectOnArrival.value) { ctx.world().sendQuittingDisconnectingPacket(); } + if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnPathComplete.value) { + NotificationHelper.notify("Pathing complete", false); + } return new PathingCommand(this.goal, PathingCommandType.CANCEL_AND_SET_GOAL); } return new PathingCommand(this.goal, PathingCommandType.SET_GOAL_AND_PATH); diff --git a/src/main/java/baritone/process/ExploreProcess.java b/src/main/java/baritone/process/ExploreProcess.java index 220ae3b12..c42ece0e5 100644 --- a/src/main/java/baritone/process/ExploreProcess.java +++ b/src/main/java/baritone/process/ExploreProcess.java @@ -29,6 +29,7 @@ import baritone.api.process.PathingCommandType; import baritone.api.utils.MyChunkPos; import baritone.cache.CachedWorld; import baritone.utils.BaritoneProcessHelper; +import baritone.utils.NotificationHelper; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; @@ -83,12 +84,18 @@ public final class ExploreProcess extends BaritoneProcessHelper implements IExpl public PathingCommand onTick(boolean calcFailed, boolean isSafeToCancel) { if (calcFailed) { logDirect("Failed"); + if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnExploreFinished.value) { + NotificationHelper.notify("Exploration failed", true); + } onLostControl(); return null; } IChunkFilter filter = calcFilter(); if (!Baritone.settings().disableCompletionCheck.value && filter.countRemain() == 0) { logDirect("Explored all chunks"); + if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnExploreFinished.value) { + NotificationHelper.notify("Explored all chunks", false); + } onLostControl(); return null; } diff --git a/src/main/java/baritone/process/FarmProcess.java b/src/main/java/baritone/process/FarmProcess.java index a91fda60c..407157b37 100644 --- a/src/main/java/baritone/process/FarmProcess.java +++ b/src/main/java/baritone/process/FarmProcess.java @@ -31,6 +31,7 @@ import baritone.api.utils.input.Input; import baritone.cache.WorldScanner; import baritone.pathing.movement.MovementHelper; import baritone.utils.BaritoneProcessHelper; +import baritone.utils.NotificationHelper; import net.minecraft.block.*; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.Entity; @@ -257,6 +258,9 @@ public final class FarmProcess extends BaritoneProcessHelper implements IFarmPro if (calcFailed) { logDirect("Farm failed"); + if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnFarmFail.value) { + NotificationHelper.notify("Farm failed", true); + } onLostControl(); return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE); } diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index a76121b8d..b44709e3e 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -30,6 +30,7 @@ import baritone.pathing.movement.CalculationContext; import baritone.pathing.movement.MovementHelper; import baritone.utils.BaritoneProcessHelper; import baritone.utils.BlockStateInterface; +import baritone.utils.NotificationHelper; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; import net.minecraft.block.BlockFalling; @@ -221,6 +222,9 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro locs.addAll(dropped); if (locs.isEmpty()) { logDirect("No locations for " + filter + " known, cancelling"); + if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnMineFail.value) { + NotificationHelper.notify("No locations for " + filter + " known, cancelling", true); + } cancel(); return; } From 0434e1c5d3cb73364c5ce8fe93725f16c939ab00 Mon Sep 17 00:00:00 2001 From: aUniqueUser <ds458@pm.me> Date: Sat, 29 Feb 2020 12:24:06 -0500 Subject: [PATCH 04/84] Add more entries to MineProcess --- src/main/java/baritone/process/MineProcess.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index b44709e3e..6e8ba245b 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -89,10 +89,16 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro if (calcFailed) { if (!knownOreLocations.isEmpty() && Baritone.settings().blacklistClosestOnFailure.value) { logDirect("Unable to find any path to " + filter + ", blacklisting presumably unreachable closest instance..."); + if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnMineFail.value) { + NotificationHelper.notify("Unable to find any path to " + filter + ", blacklisting presumably unreachable closest instance...", true); + } knownOreLocations.stream().min(Comparator.comparingDouble(ctx.player()::getDistanceSq)).ifPresent(blacklist::add); knownOreLocations.removeIf(blacklist::contains); } else { logDirect("Unable to find any path to " + filter + ", canceling mine"); + if (Baritone.settings().desktopNotifications.value && Baritone.settings().notificationOnMineFail.value) { + NotificationHelper.notify("Unable to find any path to " + filter + ", canceling mine", true); + } cancel(); return null; } From c32652394ebc28dfad00bc0a92977fa915fbac4f Mon Sep 17 00:00:00 2001 From: Babbaj <babbaj45@gmail.com> Date: Sun, 12 Apr 2020 03:01:24 -0400 Subject: [PATCH 05/84] Annotation for proguard -keep --- scripts/proguard.pro | 7 +++++++ src/main/java/baritone/KeepName.java | 21 +++++++++++++++++++ .../command/defaults/FollowCommand.java | 3 +++ 3 files changed, 31 insertions(+) create mode 100644 src/main/java/baritone/KeepName.java diff --git a/scripts/proguard.pro b/scripts/proguard.pro index 52b843ddf..af920a590 100644 --- a/scripts/proguard.pro +++ b/scripts/proguard.pro @@ -23,6 +23,13 @@ -keep class baritone.api.utils.MyChunkPos { *; } # even in standalone we need to keep this for gson reflect +# Keep any class or member annotated with @KeepName so we dont have to put everything in the script +-keep,allowobfuscation @interface baritone.KeepName +-keep @baritone.KeepName class * +-keepclassmembers class * { + @baritone.KeepName *; +} + # setting names are reflected from field names, so keep field names -keepclassmembers class baritone.api.Settings { public <fields>; diff --git a/src/main/java/baritone/KeepName.java b/src/main/java/baritone/KeepName.java new file mode 100644 index 000000000..20f08e7b8 --- /dev/null +++ b/src/main/java/baritone/KeepName.java @@ -0,0 +1,21 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see <https://www.gnu.org/licenses/>. + */ + +package baritone; + +// Annotation for classes and class members that should not be renamed by proguard +public @interface KeepName { } diff --git a/src/main/java/baritone/command/defaults/FollowCommand.java b/src/main/java/baritone/command/defaults/FollowCommand.java index 755fc5350..c63470204 100644 --- a/src/main/java/baritone/command/defaults/FollowCommand.java +++ b/src/main/java/baritone/command/defaults/FollowCommand.java @@ -17,6 +17,7 @@ package baritone.command.defaults; +import baritone.KeepName; import baritone.api.IBaritone; import baritone.api.command.Command; import baritone.api.command.datatypes.EntityClassById; @@ -130,6 +131,7 @@ public class FollowCommand extends Command { ); } + @KeepName private enum FollowGroup { ENTITIES(EntityLiving.class::isInstance), PLAYERS(EntityPlayer.class::isInstance); /* , @@ -142,6 +144,7 @@ public class FollowCommand extends Command { } } + @KeepName private enum FollowList { ENTITY(EntityClassById.INSTANCE), PLAYER(NearbyPlayer.INSTANCE); From ff3234fcdd0dcb0ff6dce5a5989ea504830a5604 Mon Sep 17 00:00:00 2001 From: ByteZ1337 <cr33pycode@gmail.com> Date: Mon, 13 Apr 2020 20:39:56 +0200 Subject: [PATCH 06/84] Fixed Typo Fixed Typo in the Long Description of the Goto Command --- src/main/java/baritone/command/defaults/GotoCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/command/defaults/GotoCommand.java b/src/main/java/baritone/command/defaults/GotoCommand.java index 28e768296..a6fe4e22b 100644 --- a/src/main/java/baritone/command/defaults/GotoCommand.java +++ b/src/main/java/baritone/command/defaults/GotoCommand.java @@ -72,7 +72,7 @@ public class GotoCommand extends Command { @Override public List<String> getLongDesc() { return Arrays.asList( - "The got command tells Baritone to head towards a given goal or block.", + "The goto command tells Baritone to head towards a given goal or block.", "", "Wherever a coordinate is expected, you can use ~ just like in regular Minecraft commands. Or, you can just use regular numbers.", "", From c2624bbaafd88b7c02b07f8fc4d65c35637b9f1a Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Tue, 21 Apr 2020 13:32:47 -0700 Subject: [PATCH 07/84] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 75ce55135..5e19309d4 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ A Minecraft pathfinder bot. Baritone is the pathfinding system used in [Impact](https://impactclient.net/) since 4.4. There's a [showcase video](https://youtu.be/CZkLXWo4Fg4) made by @Adovin#0730 on Baritone which I recommend. [Here's](https://www.youtube.com/watch?v=StquF69-_wI) a (very old!) video I made showing off what it can do. -The easiest way to install Baritone is to install [Impact](https://impactclient.net/), 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. +The easiest way to install Baritone is to install [Impact](https://impactclient.net/), 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). For 1.12.2, click [here](https://github.com/cabaletta/baritone/releases/download/v1.2.14/baritone-api-forge-1.2.14.jar). Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see description. From 10677040e07c93e60ae7d07f8e01680fad6f0328 Mon Sep 17 00:00:00 2001 From: Dominika <bella.who.two@gmail.com> Date: Sun, 26 Apr 2020 15:22:24 -0400 Subject: [PATCH 08/84] Fix broken API Settings link in USAGE. Close #1040 --- USAGE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/USAGE.md b/USAGE.md index b22537406..d817c24cb 100644 --- a/USAGE.md +++ b/USAGE.md @@ -52,7 +52,7 @@ Some common examples: - `version` to get the version of Baritone you're running - `damn` daniel -For the rest of the commands, you can take a look at the code [here](https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/utils/ExampleBaritoneControl.java). +For the rest of the commands, you can take a look at the code [here](https://baritone.leijurv.com/baritone/api/Settings.html). All the settings and documentation are <a href="https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/Settings.java">here</a>. If you find HTML easier to read than Javadoc, you can look <a href="https://baritone.leijurv.com/baritone/api/Settings.html#field.detail">here</a>. From d0f594065d9fe86a4f1ecfca6e3314c8c506a59e Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Sun, 26 Apr 2020 13:22:55 -0700 Subject: [PATCH 09/84] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5e19309d4..21ae5cd7e 100644 --- a/README.md +++ b/README.md @@ -34,9 +34,9 @@ A Minecraft pathfinder bot. Baritone is the pathfinding system used in [Impact](https://impactclient.net/) since 4.4. There's a [showcase video](https://youtu.be/CZkLXWo4Fg4) made by @Adovin#0730 on Baritone which I recommend. [Here's](https://www.youtube.com/watch?v=StquF69-_wI) a (very old!) video I made showing off what it can do. -The easiest way to install Baritone is to install [Impact](https://impactclient.net/), 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). For 1.12.2, click [here](https://github.com/cabaletta/baritone/releases/download/v1.2.14/baritone-api-forge-1.2.14.jar). 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://impactclient.net/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the v1.2.* `api-forge` jar from [releases](https://github.com/cabaletta/baritone/releases). For 1.12.2, click [here](https://github.com/cabaletta/baritone/releases/download/v1.2.14/baritone-api-forge-1.2.14.jar). Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. -For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see description. +For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see description. If you need Forge 1.15.2, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.5.3), follow the instructions, and get the `api-forge` jar. 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 through 1.15.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 89ab78a329a86d980f1660e30f6d04d4426e5a1c Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Sun, 3 May 2020 18:51:21 -0700 Subject: [PATCH 10/84] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 21ae5cd7e..e0d5ee70d 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ A Minecraft pathfinder bot. Baritone is the pathfinding system used in [Impact](https://impactclient.net/) since 4.4. There's a [showcase video](https://youtu.be/CZkLXWo4Fg4) made by @Adovin#0730 on Baritone which I recommend. [Here's](https://www.youtube.com/watch?v=StquF69-_wI) a (very old!) video I made showing off what it can do. -The easiest way to install Baritone is to install [Impact](https://impactclient.net/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the v1.2.* `api-forge` jar from [releases](https://github.com/cabaletta/baritone/releases). For 1.12.2, click [here](https://github.com/cabaletta/baritone/releases/download/v1.2.14/baritone-api-forge-1.2.14.jar). 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://impactclient.net/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the v1.2.* `api-forge` jar from [releases](https://github.com/cabaletta/baritone/releases). **For 1.12.2 Forge, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.2.14/baritone-api-forge-1.2.14.jar)**. Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see description. If you need Forge 1.15.2, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.5.3), follow the instructions, and get the `api-forge` jar. From 806dc8f0171907c394e32b7c8a69c8cf052aeaa0 Mon Sep 17 00:00:00 2001 From: Babbaj <babbaj45@gmail.com> Date: Mon, 4 May 2020 01:15:18 -0400 Subject: [PATCH 11/84] This had to be done --- src/main/java/baritone/BaritoneProvider.java | 4 ++-- .../{BaritoneChatControl.java => ExampleBaritoneControl.java} | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) rename src/main/java/baritone/command/{BaritoneChatControl.java => ExampleBaritoneControl.java} (98%) diff --git a/src/main/java/baritone/BaritoneProvider.java b/src/main/java/baritone/BaritoneProvider.java index 84034ef33..6f64a8350 100644 --- a/src/main/java/baritone/BaritoneProvider.java +++ b/src/main/java/baritone/BaritoneProvider.java @@ -22,7 +22,7 @@ import baritone.api.IBaritoneProvider; import baritone.api.cache.IWorldScanner; import baritone.api.command.ICommandSystem; import baritone.api.schematic.ISchematicSystem; -import baritone.command.BaritoneChatControl; +import baritone.command.ExampleBaritoneControl; import baritone.cache.WorldScanner; import baritone.command.CommandSystem; import baritone.utils.schematic.SchematicSystem; @@ -44,7 +44,7 @@ public final class BaritoneProvider implements IBaritoneProvider { this.all = Collections.singletonList(this.primary); // Setup chat control, just for the primary instance - new BaritoneChatControl(this.primary); + new ExampleBaritoneControl(this.primary); } @Override diff --git a/src/main/java/baritone/command/BaritoneChatControl.java b/src/main/java/baritone/command/ExampleBaritoneControl.java similarity index 98% rename from src/main/java/baritone/command/BaritoneChatControl.java rename to src/main/java/baritone/command/ExampleBaritoneControl.java index 15f15abe6..53b34df0a 100644 --- a/src/main/java/baritone/command/BaritoneChatControl.java +++ b/src/main/java/baritone/command/ExampleBaritoneControl.java @@ -49,12 +49,12 @@ import java.util.stream.Stream; import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX; -public class BaritoneChatControl implements Helper, AbstractGameEventListener { +public class ExampleBaritoneControl implements Helper, AbstractGameEventListener { private static final Settings settings = BaritoneAPI.getSettings(); private final ICommandManager manager; - public BaritoneChatControl(IBaritone baritone) { + public ExampleBaritoneControl(IBaritone baritone) { this.manager = baritone.getCommandManager(); baritone.getGameEventHandler().registerEventListener(this); } From a76cf0fe9a1837ab3abbc8fe425a3be5b6cff220 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Sun, 17 May 2020 18:35:41 -0700 Subject: [PATCH 12/84] brady more like brainletdy --- src/main/java/baritone/command/defaults/BuildCommand.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/command/defaults/BuildCommand.java b/src/main/java/baritone/command/defaults/BuildCommand.java index 273c5bc3d..724582865 100644 --- a/src/main/java/baritone/command/defaults/BuildCommand.java +++ b/src/main/java/baritone/command/defaults/BuildCommand.java @@ -46,7 +46,7 @@ public class BuildCommand extends Command { public void execute(String label, IArgConsumer args) throws CommandException { File file = args.getDatatypePost(RelativeFile.INSTANCE, schematicsDir).getAbsoluteFile(); if (FilenameUtils.getExtension(file.getAbsolutePath()).isEmpty()) { - file = new File(file.getAbsolutePath() + "." + Baritone.settings().schematicFallbackExtension); + file = new File(file.getAbsolutePath() + "." + Baritone.settings().schematicFallbackExtension.value); } BetterBlockPos origin = ctx.playerFeet(); BetterBlockPos buildOrigin; From ca831bc734c5de76c458f89f311843df14b14e0f Mon Sep 17 00:00:00 2001 From: Dominika <sokolov.dominika@gmail.com> Date: Mon, 18 May 2020 13:47:57 -0400 Subject: [PATCH 13/84] Added blue badge to integrations badges --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e0d5ee70d..dbb1331c3 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ [![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.10%20/%20v1.3.5%20/%20v1.4.3-brightgreen.svg)](https://impactclient.net/) +[![KAMI Blue integration](https://img.shields.io/badge/KAMI%20Blue%20integration-v1.2.14--master-brightgreen)](https://github.com/kami-blue/client) [![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%20integration-v1.3.4%20/%20v1.4.1-green.svg)](https://gitlab.com/emc-mods-indrit/baritone_api) [![rootNET integration](https://img.shields.io/badge/rootNET%20integration-v1.2.11-green.svg)](https://rootnet.dev/) From 80c8294f5f956896ffc3f12cbf51e476d6859f8a Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Thu, 4 Jun 2020 11:32:20 -0700 Subject: [PATCH 14/84] maintain obscenely obvious pro impact bias in subconscious coloring --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dbb1331c3..0d36fdcc0 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ [![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.10%20/%20v1.3.5%20/%20v1.4.3-brightgreen.svg)](https://impactclient.net/) -[![KAMI Blue integration](https://img.shields.io/badge/KAMI%20Blue%20integration-v1.2.14--master-brightgreen)](https://github.com/kami-blue/client) +[![KAMI Blue integration](https://img.shields.io/badge/KAMI%20Blue%20integration-v1.2.14--master-green)](https://github.com/kami-blue/client) [![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%20integration-v1.3.4%20/%20v1.4.1-green.svg)](https://gitlab.com/emc-mods-indrit/baritone_api) [![rootNET integration](https://img.shields.io/badge/rootNET%20integration-v1.2.11-green.svg)](https://rootnet.dev/) From e42c19bfec7f4769f53421481cc6eae8810ce9b2 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Sat, 27 Jun 2020 22:25:47 -0700 Subject: [PATCH 15/84] thebes uwu --- src/api/java/baritone/api/Settings.java | 11 ++++++++++- src/main/java/baritone/process/BuilderProcess.java | 5 ++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 1bbde3b2b..283e4e0a6 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -30,8 +30,8 @@ import java.awt.*; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; -import java.util.*; import java.util.List; +import java.util.*; import java.util.function.Consumer; /** @@ -193,6 +193,15 @@ public final class Settings { ))); + /** + * A list of blocks to become air + * <p> + * If a schematic asks for a block on this list, only air will be accepted at that location (and nothing on buildIgnoreBlocks) + */ + public final Setting<List<Block>> okIfAir = new Setting<>(new ArrayList<>(Arrays.asList( + + ))); + /** * If this is true, the builder will treat all non-air blocks as correct. It will only place new blocks. */ diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 17a8f5f94..b8f77ce24 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -206,6 +206,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil continue; // irrelevant } IBlockState curr = bcc.bsi.get0(x, y, z); + Blocks.ICE; if (curr.getBlock() != Blocks.AIR && !(curr.getBlock() instanceof BlockLiquid) && !valid(curr, desired, false)) { BetterBlockPos pos = new BetterBlockPos(x, y, z); Optional<Rotation> rot = RotationUtils.reachable(ctx.player(), pos, ctx.playerController().getBlockReachDistance()); @@ -773,10 +774,12 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil if (desired == null) { return true; } - // TODO more complicated comparison logic I guess if (current.getBlock() instanceof BlockLiquid && Baritone.settings().okIfWater.value) { return true; } + if (current.getBlock() instanceof BlockAir && Baritone.settings().okIfAir.value.contains(desired.getBlock())) { + return true; + } if (desired.getBlock() instanceof BlockAir && Baritone.settings().buildIgnoreBlocks.value.contains(current.getBlock())) { return true; } From 82629090639ee9011126b9055b79bf420de4c35f Mon Sep 17 00:00:00 2001 From: kuthy <mariusdkm@gmail.com> Date: Fri, 3 Jul 2020 15:36:44 +0200 Subject: [PATCH 16/84] Fixing crash after clicking into the air --- src/main/java/baritone/utils/GuiClick.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/utils/GuiClick.java b/src/main/java/baritone/utils/GuiClick.java index 4f89100dc..2f77714cf 100644 --- a/src/main/java/baritone/utils/GuiClick.java +++ b/src/main/java/baritone/utils/GuiClick.java @@ -93,10 +93,16 @@ public class GuiClick extends GuiScreen { Helper.HELPER.logDirect(component); clickStart = null; } else { - BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalTwoBlocks(currentMouseOver)); + if(currentMouseOver != null)//Catch this, or else a click into void will result in a crash + BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver)); + else + Helper.HELPER.logDirect("Sorry, I can't go to nothing"); } } else if (mouseButton == 1) { - BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up())); + if(currentMouseOver != null) + BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up())); + else + Helper.HELPER.logDirect("Sorry, I can't go to nothing"); } clickStart = null; } From 0055a059f71be48d68d6ad92aaad1712dee3be7a Mon Sep 17 00:00:00 2001 From: kuthy <mariusdkm@gmail.com> Date: Fri, 3 Jul 2020 16:52:03 +0200 Subject: [PATCH 17/84] Formated Code --- src/main/java/baritone/utils/GuiClick.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/utils/GuiClick.java b/src/main/java/baritone/utils/GuiClick.java index 2f77714cf..00be0635a 100644 --- a/src/main/java/baritone/utils/GuiClick.java +++ b/src/main/java/baritone/utils/GuiClick.java @@ -20,7 +20,6 @@ package baritone.utils; import baritone.Baritone; import baritone.api.BaritoneAPI; import baritone.api.pathing.goals.GoalBlock; -import baritone.api.pathing.goals.GoalTwoBlocks; import baritone.api.utils.BetterBlockPos; import baritone.api.utils.Helper; import net.minecraft.client.gui.GuiScreen; @@ -43,8 +42,8 @@ import java.nio.FloatBuffer; import java.nio.IntBuffer; import java.util.Collections; -import static org.lwjgl.opengl.GL11.*; import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX; +import static org.lwjgl.opengl.GL11.*; public class GuiClick extends GuiScreen { @@ -93,13 +92,13 @@ public class GuiClick extends GuiScreen { Helper.HELPER.logDirect(component); clickStart = null; } else { - if(currentMouseOver != null)//Catch this, or else a click into void will result in a crash + if (currentMouseOver != null)//Catch this, or else a click into void will result in a crash BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver)); else Helper.HELPER.logDirect("Sorry, I can't go to nothing"); } } else if (mouseButton == 1) { - if(currentMouseOver != null) + if (currentMouseOver != null) BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up())); else Helper.HELPER.logDirect("Sorry, I can't go to nothing"); From eafca1e1fe46d277fc573760b68ce5beae315ef2 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Mon, 6 Jul 2020 17:07:59 -0700 Subject: [PATCH 18/84] yourkit --- README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0d36fdcc0..16641d617 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,16 @@ That's what it's for, sure! (As long as usage is in compliance with the LGPL 3.0 Magic. (Hours of [leijurv](https://github.com/leijurv/) enduring excruciating pain) +### Additional Special Thanks To: + +![YourKit-Logo](https://www.yourkit.com/images/yklogo.png) + +YourKit supports open source projects with innovative and intelligent tools for monitoring and profiling Java and .NET applications. + +YourKit is the creator of the [YourKit Java Profiler](https://www.yourkit.com/java/profiler/), [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/), and [YourKit YouMonitor](https://www.yourkit.com/youmonitor/). + +We thank them for granting Baritone an OSS license so that we can make our software the best it can be. + ## Why is it called Baritone? -It's named for FitMC's deep sultry voice. +It's named for FitMC's deep sultry voice. From f02476ff3aaf722f2dd76e5c94d0fce27b8e0760 Mon Sep 17 00:00:00 2001 From: CorruptedSeal <68251040+CorruptedSeal@users.noreply.github.com> Date: Wed, 15 Jul 2020 01:18:01 -0600 Subject: [PATCH 19/84] Update ProguardTask.java --- .../baritone/gradle/task/ProguardTask.java | 105 +++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java b/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java index 30ffddfbc..dbeca172b 100644 --- a/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java +++ b/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java @@ -21,13 +21,21 @@ import baritone.gradle.util.Determinizer; import baritone.gradle.util.MappingType; import baritone.gradle.util.ReobfWrapper; import org.apache.commons.io.IOUtils; +import org.gradle.api.JavaVersion; import org.gradle.api.NamedDomainObjectContainer; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Dependency; +import org.gradle.api.internal.file.IdentityFileResolver; import org.gradle.api.internal.plugins.DefaultConvention; import org.gradle.api.tasks.Input; import org.gradle.api.tasks.TaskAction; +import org.gradle.api.tasks.TaskCollection; +import org.gradle.api.tasks.compile.ForkOptions; +import org.gradle.api.tasks.compile.JavaCompile; import org.gradle.internal.Pair; +import org.gradle.internal.jvm.Jvm; +import org.gradle.internal.jvm.inspection.DefaultJvmVersionDetector; +import org.gradle.process.internal.DefaultExecActionFactory; import java.io.*; import java.lang.reflect.Field; @@ -101,6 +109,101 @@ public class ProguardTask extends BaritoneGradleTask { } } + private String getJavaBinPathForProguard() { + String path; + try { + path = findJavaPathByGradleConfig(); + if (path != null) return path; + } + catch (Exception ex) { + System.err.println("Unable to find java by javaCompile options"); + ex.printStackTrace(); + } + + try { + path = findJavaByJavaHome(); + if (path != null) return path; + } + catch(Exception ex) { + System.err.println("Unable to find java by JAVA_HOME"); + ex.printStackTrace(); + } + + + path = findJavaByGradleCurrentRuntime(); + if (path != null) return path; + + throw new RuntimeException("Unable to find java to determine ProGuard libraryjars. Please specify forkOptions.executable in javaCompile," + + " JAVA_HOME environment variable, or make sure to run Gradle with the correct JDK (a v1.8 only)"); + } + + private String findJavaByGradleCurrentRuntime() { + String path = Jvm.current().getJavaExecutable().getAbsolutePath(); + + if (this.validateJavaVersion(path)) { + System.out.println("Using Gradle's runtime Java for ProGuard"); + return path; + } + return null; + } + + private String findJavaByJavaHome() { + final String javaHomeEnv = System.getenv("JAVA_HOME"); + if (javaHomeEnv != null) { + + String path = Jvm.forHome(new File(javaHomeEnv)).getJavaExecutable().getAbsolutePath(); + if (this.validateJavaVersion(path)) { + System.out.println("Detected Java path by JAVA_HOME"); + return path; + } + } + return null; + } + + private String findJavaPathByGradleConfig() { + final TaskCollection<JavaCompile> javaCompiles = super.getProject().getTasks().withType(JavaCompile.class); + + final JavaCompile compileTask = javaCompiles.iterator().next(); + final ForkOptions forkOptions = compileTask.getOptions().getForkOptions(); + + if (forkOptions != null) { + String javacPath = forkOptions.getExecutable(); + if (javacPath != null) { + File javacFile = new File(javacPath); + if (javacFile.exists()) { + File[] maybeJava = javacFile.getParentFile().listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.equals("java"); + } + }); + + if (maybeJava != null && maybeJava.length > 0) { + String path = maybeJava[0].getAbsolutePath(); + if (this.validateJavaVersion(path)) { + System.out.println("Detected Java path by forkOptions"); + return path; + } + } + } + } + } + return null; + } + + private boolean validateJavaVersion(String java) { + final JavaVersion javaVersion = new DefaultJvmVersionDetector(new DefaultExecActionFactory(new IdentityFileResolver())).getJavaVersion(java); + + if (!javaVersion.getMajorVersion().equals("8")) { + System.out.println("Failed to validate Java version " + javaVersion.toString() + " [" + java + "] for ProGuard libraryjars"); + // throw new RuntimeException("Java version incorrect: " + javaVersion.getMajorVersion() + " for " + java); + return false; + } + + System.out.println("Validated Java version " + javaVersion.toString() + " [" + java + "] for ProGuard libraryjars"); + return true; + } + private void generateConfigs() throws Exception { Files.copy(getRelativeFile(PROGUARD_CONFIG_TEMPLATE), getTemporaryFile(PROGUARD_CONFIG_DEST), REPLACE_EXISTING); @@ -110,7 +213,7 @@ public class ProguardTask extends BaritoneGradleTask { template.add(1, "-outjars " + this.getTemporaryFile(PROGUARD_EXPORT_PATH)); // Acquire the RT jar using "java -verbose". This doesn't work on Java 9+ - Process p = new ProcessBuilder("java", "-verbose").start(); + Process p = new ProcessBuilder(this.getJavaBinPathForProguard(), "-verbose").start(); String out = IOUtils.toString(p.getInputStream(), "UTF-8").split("\n")[0].split("Opened ")[1].replace("]", ""); template.add(2, "-libraryjars '" + out + "'"); From d522f9dfa3e2b5c000e4ebf8e57a6a00607f45ea Mon Sep 17 00:00:00 2001 From: CorruptedSeal <68251040+CorruptedSeal@users.noreply.github.com> Date: Wed, 15 Jul 2020 01:34:19 -0600 Subject: [PATCH 20/84] Update ProguardTask.java --- buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java b/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java index dbeca172b..ead398b37 100644 --- a/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java +++ b/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java @@ -132,8 +132,8 @@ public class ProguardTask extends BaritoneGradleTask { path = findJavaByGradleCurrentRuntime(); if (path != null) return path; - - throw new RuntimeException("Unable to find java to determine ProGuard libraryjars. Please specify forkOptions.executable in javaCompile," + + + throw new Exception("Unable to find java to determine ProGuard libraryjars. Please specify forkOptions.executable in javaCompile," + " JAVA_HOME environment variable, or make sure to run Gradle with the correct JDK (a v1.8 only)"); } From 6603e8b11e0b5453433183f164b05bd3edb6cfae Mon Sep 17 00:00:00 2001 From: CorruptedSeal <68251040+CorruptedSeal@users.noreply.github.com> Date: Thu, 16 Jul 2020 03:45:23 -0600 Subject: [PATCH 21/84] Update ExecutionControlCommands.java --- .../baritone/command/defaults/ExecutionControlCommands.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/command/defaults/ExecutionControlCommands.java b/src/main/java/baritone/command/defaults/ExecutionControlCommands.java index 4a04b9e09..1b024c3b8 100644 --- a/src/main/java/baritone/command/defaults/ExecutionControlCommands.java +++ b/src/main/java/baritone/command/defaults/ExecutionControlCommands.java @@ -79,7 +79,7 @@ public class ExecutionControlCommands { } } ); - pauseCommand = new Command(baritone, "pause") { + pauseCommand = new Command(baritone, "pause", "p") { @Override public void execute(String label, IArgConsumer args) throws CommandException { args.requireMax(0); @@ -112,7 +112,7 @@ public class ExecutionControlCommands { ); } }; - resumeCommand = new Command(baritone, "resume") { + resumeCommand = new Command(baritone, "resume", "r") { @Override public void execute(String label, IArgConsumer args) throws CommandException { args.requireMax(0); @@ -171,7 +171,7 @@ public class ExecutionControlCommands { ); } }; - cancelCommand = new Command(baritone, "cancel", "stop") { + cancelCommand = new Command(baritone, "cancel", "c", "stop") { @Override public void execute(String label, IArgConsumer args) throws CommandException { args.requireMax(0); From cbb3483456c74e509b18e5ee98ea2369c65ee4b7 Mon Sep 17 00:00:00 2001 From: elongated muskrat <56513556+elonmusksama@users.noreply.github.com> Date: Thu, 16 Jul 2020 14:35:17 -0300 Subject: [PATCH 22/84] updated compatible versions to future badge updated the compatible versions to the future integrations badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 16641d617..83305b618 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ [![Aristois add-on integration](https://img.shields.io/badge/Aristois%20add--on%20integration-v1.3.4%20/%20v1.4.1-green.svg)](https://gitlab.com/emc-mods-indrit/baritone_api) [![rootNET integration](https://img.shields.io/badge/rootNET%20integration-v1.2.11-green.svg)](https://rootnet.dev/) [![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/) +[![Future integration](https://img.shields.io/badge/Future%20integration-v1.2.12%20%2F%20v1.3.6%20%2F%20v1.4.4-red)](https://futureclient.net/) [![forthebadge](https://forthebadge.com/images/badges/built-with-swag.svg)](http://forthebadge.com/) [![forthebadge](https://forthebadge.com/images/badges/mom-made-pizza-rolls.svg)](http://forthebadge.com/) From 2acf64a0d069e33eccb7e6d10840467809f8b843 Mon Sep 17 00:00:00 2001 From: John <43681932+John200410@users.noreply.github.com> Date: Mon, 20 Jul 2020 03:12:24 -0400 Subject: [PATCH 23/84] add rusherhack integration badge as of rusherhack v1.0 there is baritone API integration, similar to future's. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 83305b618..a095a2e5f 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ [![rootNET integration](https://img.shields.io/badge/rootNET%20integration-v1.2.11-green.svg)](https://rootnet.dev/) [![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-v1.2.12%20%2F%20v1.3.6%20%2F%20v1.4.4-red)](https://futureclient.net/) +[![RusherHack integration](https://img.shields.io/badge/RusherHack%20integration-v1.2.14-green)](https://rusherhack.org/) [![forthebadge](https://forthebadge.com/images/badges/built-with-swag.svg)](http://forthebadge.com/) [![forthebadge](https://forthebadge.com/images/badges/mom-made-pizza-rolls.svg)](http://forthebadge.com/) From 9e45998a656a2f203c874e831677b99d86028572 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Sun, 26 Jul 2020 13:21:51 -0700 Subject: [PATCH 24/84] brady shouldn't merge PRs that don't compile, thanks cdagaming --- buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java b/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java index ead398b37..01e561775 100644 --- a/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java +++ b/buildSrc/src/main/java/baritone/gradle/task/ProguardTask.java @@ -109,7 +109,7 @@ public class ProguardTask extends BaritoneGradleTask { } } - private String getJavaBinPathForProguard() { + private String getJavaBinPathForProguard() throws Exception { String path; try { path = findJavaPathByGradleConfig(); From c180eb9975257b8d18368b7de62c6e34b0fe4ea1 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Wed, 29 Jul 2020 12:52:19 -0700 Subject: [PATCH 25/84] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 83305b618..0f33c9d58 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,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.10%20/%20v1.3.5%20/%20v1.4.3-brightgreen.svg)](https://impactclient.net/) +[![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.2.14%20/%20v1.3.8%20/%20v1.4.6%20/%20v1.5.3-brightgreen.svg)](https://impactclient.net/) [![KAMI Blue integration](https://img.shields.io/badge/KAMI%20Blue%20integration-v1.2.14--master-green)](https://github.com/kami-blue/client) [![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%20integration-v1.3.4%20/%20v1.4.1-green.svg)](https://gitlab.com/emc-mods-indrit/baritone_api) From 7081cf7172d4b385dec5be95686089eeefc9ee44 Mon Sep 17 00:00:00 2001 From: orsondmc <orsondmc@gmail.com> Date: Thu, 6 Aug 2020 16:23:13 +1000 Subject: [PATCH 26/84] Introduce startAtLayer to start building at a specific layer in the schematic. To be used only with buildWithLayers true. --- src/api/java/baritone/api/Settings.java | 6 ++++++ src/main/java/baritone/process/BuilderProcess.java | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 1bbde3b2b..e3716751c 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -752,6 +752,12 @@ public final class Settings { */ public final Setting<Boolean> layerOrder = new Setting<>(false); + /** + * Start building the schematic at a specific layer. + * Can help on larger builds when schematic wants to break things its already built + */ + public final Setting<Integer> startAtLayer = new Setting<>(1); + /** * How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely */ diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 17a8f5f94..e25a30afa 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -97,7 +97,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil } this.origin = new Vec3i(x, y, z); this.paused = false; - this.layer = 0; + this.layer = Baritone.settings().startAtLayer.value; this.numRepeats = 0; this.observedCompleted = new LongOpenHashSet(); } @@ -743,7 +743,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil name = null; schematic = null; realSchematic = null; - layer = 0; + layer = Baritone.settings().startAtLayer.value; numRepeats = 0; paused = false; observedCompleted = null; From b187d860741c7e5b6cb6aab64a5b80dcdadec9a9 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Wed, 5 Aug 2020 23:31:32 -0700 Subject: [PATCH 27/84] fix orsond rock brain moment --- 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 e3716751c..3da1d21b7 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -756,7 +756,7 @@ public final class Settings { * Start building the schematic at a specific layer. * Can help on larger builds when schematic wants to break things its already built */ - public final Setting<Integer> startAtLayer = new Setting<>(1); + public final Setting<Integer> startAtLayer = new Setting<>(0); /** * How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely From 2ddc2c3660d591d42e39a935bb46c27e924ee22a Mon Sep 17 00:00:00 2001 From: RealIndrit <jia@twinflower.net> Date: Thu, 13 Aug 2020 22:36:34 +0200 Subject: [PATCH 28/84] Add auto tool settings because 2 lines of code lols --- src/api/java/baritone/api/Settings.java | 5 +++++ src/main/java/baritone/utils/ToolSet.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 3da1d21b7..c03b0b72e 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -61,6 +61,11 @@ public final class Settings { */ public final Setting<Boolean> allowInventory = new Setting<>(false); + /** + * Allow player to decide if to use auto tool or not + */ + public final Setting<Boolean> autoTool = new Setting<>(true); + /** * It doesn't actually take twenty ticks to place a block, this cost is so high * because we want to generally conserve blocks which might be limited. diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index b6446b30d..017843022 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -127,7 +127,7 @@ public class ToolSet { } } } - return best; + return Baritone.settings().autoTool.value? best : player.inventory.currentItem; } /** From 2b6fe188ed15a658141bd670c476b8ab5e84f874 Mon Sep 17 00:00:00 2001 From: RealIndrit <jia@twinflower.net> Date: Thu, 13 Aug 2020 22:47:40 +0200 Subject: [PATCH 29/84] Why calculate stuff that isnt needed... --- src/main/java/baritone/pathing/movement/MovementHelper.java | 4 +++- src/main/java/baritone/utils/ToolSet.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 1a3faf57b..7dae4ceac 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -432,7 +432,9 @@ public interface MovementHelper extends ActionCosts, Helper { * @param ts previously calculated ToolSet */ static void switchToBestToolFor(IPlayerContext ctx, IBlockState b, ToolSet ts, boolean preferSilkTouch) { - ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch); + if(Baritone.settings().autoTool.value){ + ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch); + } } static void moveTowards(IPlayerContext ctx, MovementState state, BlockPos pos) { diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index 017843022..b6446b30d 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -127,7 +127,7 @@ public class ToolSet { } } } - return Baritone.settings().autoTool.value? best : player.inventory.currentItem; + return best; } /** From 2ed3e10833bd08cdd4993af3387fa909a2aff742 Mon Sep 17 00:00:00 2001 From: RealIndrit <jia@twinflower.net> Date: Thu, 13 Aug 2020 23:20:30 +0200 Subject: [PATCH 30/84] And we try this again, because wtf?? --- src/main/java/baritone/pathing/movement/MovementHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 7dae4ceac..7ae57ae46 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -432,7 +432,7 @@ public interface MovementHelper extends ActionCosts, Helper { * @param ts previously calculated ToolSet */ static void switchToBestToolFor(IPlayerContext ctx, IBlockState b, ToolSet ts, boolean preferSilkTouch) { - if(Baritone.settings().autoTool.value){ + if (Baritone.settings().autoTool.value) { ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch); } } From f8872e1cd450cbf205974d6dc9db1e1c6b8d676e Mon Sep 17 00:00:00 2001 From: RealIndrit <jia@twinflower.net> Date: Fri, 14 Aug 2020 10:14:02 +0200 Subject: [PATCH 31/84] Everything can be traced back to getBestSlot(); --- src/main/java/baritone/pathing/movement/MovementHelper.java | 4 +--- src/main/java/baritone/utils/ToolSet.java | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 7ae57ae46..1a3faf57b 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -432,9 +432,7 @@ public interface MovementHelper extends ActionCosts, Helper { * @param ts previously calculated ToolSet */ static void switchToBestToolFor(IPlayerContext ctx, IBlockState b, ToolSet ts, boolean preferSilkTouch) { - if (Baritone.settings().autoTool.value) { - ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch); - } + ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch); } static void moveTowards(IPlayerContext ctx, MovementState state, BlockPos pos) { diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index b6446b30d..101a42947 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -18,6 +18,7 @@ package baritone.utils; import baritone.Baritone; +import baritone.command.argparser.DefaultArgParsers; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.entity.EntityPlayerSP; @@ -102,6 +103,11 @@ public class ToolSet { * @return An int containing the index in the tools array that worked best */ public int getBestSlot(Block b, boolean preferSilkTouch) { + // Make all depending calculation respect auto tool value without doing unecessary calculations... + if (Baritone.settings().autoTool.value) { + return player.inventory.currentItem; + } + int best = 0; double highestSpeed = Double.NEGATIVE_INFINITY; int lowestCost = Integer.MIN_VALUE; From 49db52673a1dfd60828ecbb6e6a01e330610dd34 Mon Sep 17 00:00:00 2001 From: RealIndrit <jia@twinflower.net> Date: Fri, 14 Aug 2020 10:25:51 +0200 Subject: [PATCH 32/84] Lol --- src/main/java/baritone/utils/ToolSet.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index 101a42947..c6161f071 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -18,7 +18,6 @@ package baritone.utils; import baritone.Baritone; -import baritone.command.argparser.DefaultArgParsers; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.entity.EntityPlayerSP; From e0ff16e2dd8366f9c7e94003a3de6dc997115d4b Mon Sep 17 00:00:00 2001 From: RealIndrit <jia@twinflower.net> Date: Fri, 14 Aug 2020 10:34:21 +0200 Subject: [PATCH 33/84] Nice brainfart --- src/main/java/baritone/utils/ToolSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index c6161f071..cd347d201 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -103,7 +103,7 @@ public class ToolSet { */ public int getBestSlot(Block b, boolean preferSilkTouch) { // Make all depending calculation respect auto tool value without doing unecessary calculations... - if (Baritone.settings().autoTool.value) { + if (!Baritone.settings().autoTool.value) { return player.inventory.currentItem; } From 19355cb4f252489356e91a37bfac877055247ae3 Mon Sep 17 00:00:00 2001 From: RealIndrit <jia@twinflower.net> Date: Fri, 14 Aug 2020 10:58:15 +0200 Subject: [PATCH 34/84] Added AutoToolMovement bypass setting for special usage cases, should not be used it not actually necessary --- src/api/java/baritone/api/Settings.java | 8 ++++++++ .../java/baritone/pathing/movement/MovementHelper.java | 4 +++- src/main/java/baritone/utils/ToolSet.java | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index c03b0b72e..5b0d58edc 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -66,6 +66,14 @@ public final class Settings { */ public final Setting<Boolean> autoTool = new Setting<>(true); + /** + * Should movement cost calculation ignore the cost of breaking blocks with current slot? + * Only use this if actually necessary, make sure to put this back to original state (false), or it + * will mess up pathing in some combinations with auto tool setting. (just fall back to original settings if any + * problems occurs) + */ + public final Setting<Boolean> ignoreAutoToolMovementCost = new Setting<>(false); + /** * It doesn't actually take twenty ticks to place a block, this cost is so high * because we want to generally conserve blocks which might be limited. diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 1a3faf57b..7ae57ae46 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -432,7 +432,9 @@ public interface MovementHelper extends ActionCosts, Helper { * @param ts previously calculated ToolSet */ static void switchToBestToolFor(IPlayerContext ctx, IBlockState b, ToolSet ts, boolean preferSilkTouch) { - ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch); + if (Baritone.settings().autoTool.value) { + ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch); + } } static void moveTowards(IPlayerContext ctx, MovementState state, BlockPos pos) { diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index cd347d201..2d8a1a2ae 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -103,7 +103,7 @@ public class ToolSet { */ public int getBestSlot(Block b, boolean preferSilkTouch) { // Make all depending calculation respect auto tool value without doing unecessary calculations... - if (!Baritone.settings().autoTool.value) { + if (!Baritone.settings().ignoreAutoToolMovementCost.value) { return player.inventory.currentItem; } From 94ac15a8fcc5fff7b08f1337a66c3ec3fd7158d7 Mon Sep 17 00:00:00 2001 From: RealIndrit <jia@twinflower.net> Date: Fri, 14 Aug 2020 17:06:41 +0200 Subject: [PATCH 35/84] KEK False != True :clown: --- src/main/java/baritone/utils/ToolSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index 2d8a1a2ae..e3eb56f57 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -103,7 +103,7 @@ public class ToolSet { */ public int getBestSlot(Block b, boolean preferSilkTouch) { // Make all depending calculation respect auto tool value without doing unecessary calculations... - if (!Baritone.settings().ignoreAutoToolMovementCost.value) { + if (Baritone.settings().ignoreAutoToolMovementCost.value) { return player.inventory.currentItem; } From 88e2fba447ed82abd23760dad1540010567c9300 Mon Sep 17 00:00:00 2001 From: RealIndrit <jia@twinflower.net> Date: Fri, 14 Aug 2020 17:11:31 +0200 Subject: [PATCH 36/84] Ok, Im actually retarded --- src/main/java/baritone/utils/ToolSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index e3eb56f57..2d8a1a2ae 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -103,7 +103,7 @@ public class ToolSet { */ public int getBestSlot(Block b, boolean preferSilkTouch) { // Make all depending calculation respect auto tool value without doing unecessary calculations... - if (Baritone.settings().ignoreAutoToolMovementCost.value) { + if (!Baritone.settings().ignoreAutoToolMovementCost.value) { return player.inventory.currentItem; } From ac55de63e9a8665770d0e80316793d28f2bf914a Mon Sep 17 00:00:00 2001 From: RealIndrit <jia@twinflower.net> Date: Fri, 14 Aug 2020 17:55:10 +0200 Subject: [PATCH 37/84] Maybe dont have ignore cost calculation override auto tool? --- src/api/java/baritone/api/Settings.java | 2 +- src/main/java/baritone/utils/ToolSet.java | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 5b0d58edc..0776d2b3f 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -69,7 +69,7 @@ public final class Settings { /** * Should movement cost calculation ignore the cost of breaking blocks with current slot? * Only use this if actually necessary, make sure to put this back to original state (false), or it - * will mess up pathing in some combinations with auto tool setting. (just fall back to original settings if any + * migth mess up pathing in some combinations with auto tool setting. (just fall back to original settings if any * problems occurs) */ public final Setting<Boolean> ignoreAutoToolMovementCost = new Setting<>(false); diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index 2d8a1a2ae..0f791cb73 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -101,9 +101,14 @@ public class ToolSet { * @param b the blockstate to be mined * @return An int containing the index in the tools array that worked best */ + public int getBestSlot(Block b, boolean preferSilkTouch) { + return getBestSlot(b, preferSilkTouch, false); + } + + public int getBestSlot(Block b, boolean preferSilkTouch, boolean pathingCalculation) { // Make all depending calculation respect auto tool value without doing unecessary calculations... - if (!Baritone.settings().ignoreAutoToolMovementCost.value) { + if (!Baritone.settings().ignoreAutoToolMovementCost.value && pathingCalculation) { return player.inventory.currentItem; } @@ -142,7 +147,7 @@ public class ToolSet { * @return A double containing the destruction ticks with the best tool */ private double getBestDestructionTime(Block b) { - ItemStack stack = player.inventory.getStackInSlot(getBestSlot(b, false)); + ItemStack stack = player.inventory.getStackInSlot(getBestSlot(b, false, true)); return calculateSpeedVsBlock(stack, b.getDefaultState()) * avoidanceMultiplier(b); } From 2eba22031a524215993da1f57a5bf7c5385e0a13 Mon Sep 17 00:00:00 2001 From: RealIndrit <jia@twinflower.net> Date: Fri, 14 Aug 2020 22:47:39 +0200 Subject: [PATCH 38/84] Maybe dont have ignore cost calculation override auto tool? --- src/api/java/baritone/api/Settings.java | 6 ++++-- src/main/java/baritone/utils/ToolSet.java | 9 +++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 0776d2b3f..15c9ba35e 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -67,9 +67,11 @@ public final class Settings { public final Setting<Boolean> autoTool = new Setting<>(true); /** - * Should movement cost calculation ignore the cost of breaking blocks with current slot? + * Should movement cost calculation ignore the cost of breaking blocks with current slot, and assume best possible + * item in the hotbar? + * * Only use this if actually necessary, make sure to put this back to original state (false), or it - * migth mess up pathing in some combinations with auto tool setting. (just fall back to original settings if any + * might mess up pathing in some combinations with auto tool setting. (just fall back to original settings if any * problems occurs) */ public final Setting<Boolean> ignoreAutoToolMovementCost = new Setting<>(false); diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index 0f791cb73..b903bdf38 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -96,7 +96,8 @@ public class ToolSet { } /** - * Calculate which tool on the hotbar is best for mining + * Calculate which tool on the hotbar is best for mining, depending on an override setting, + * related to auto tool movement cost, it will either return current selected slot, or the best slot. * * @param b the blockstate to be mined * @return An int containing the index in the tools array that worked best @@ -107,7 +108,11 @@ public class ToolSet { } public int getBestSlot(Block b, boolean preferSilkTouch, boolean pathingCalculation) { - // Make all depending calculation respect auto tool value without doing unecessary calculations... + + /* + If we actually want know what efficiency our held item has instead of the best one + possible, this lets us make pathing depending on the actual tool used (if auto tool is disabled) + */ if (!Baritone.settings().ignoreAutoToolMovementCost.value && pathingCalculation) { return player.inventory.currentItem; } From e6ba4ef309bf356dfd92e571bc9e55801c0c86b3 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Mon, 17 Aug 2020 15:00:57 -0700 Subject: [PATCH 39/84] we don't compile here --- 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 b45a7f3b3..ecb40a224 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -206,7 +206,6 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil continue; // irrelevant } IBlockState curr = bcc.bsi.get0(x, y, z); - Blocks.ICE; if (curr.getBlock() != Blocks.AIR && !(curr.getBlock() instanceof BlockLiquid) && !valid(curr, desired, false)) { BetterBlockPos pos = new BetterBlockPos(x, y, z); Optional<Rotation> rot = RotationUtils.reachable(ctx.player(), pos, ctx.playerController().getBlockReachDistance()); From 38d047dbd1de4fc48619a59f3b06da381ac311b4 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Mon, 17 Aug 2020 15:19:11 -0700 Subject: [PATCH 40/84] make the packer queue super cute and deduplicated --- src/main/java/baritone/cache/CachedWorld.java | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/main/java/baritone/cache/CachedWorld.java b/src/main/java/baritone/cache/CachedWorld.java index 23d7ca8c8..1d1132465 100644 --- a/src/main/java/baritone/cache/CachedWorld.java +++ b/src/main/java/baritone/cache/CachedWorld.java @@ -26,6 +26,7 @@ import baritone.api.utils.Helper; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.ChunkPos; import net.minecraft.world.chunk.Chunk; import java.io.IOException; @@ -33,6 +34,8 @@ import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.LinkedBlockingQueue; /** @@ -56,7 +59,17 @@ public final class CachedWorld implements ICachedWorld, Helper { */ private final String directory; - private final LinkedBlockingQueue<Chunk> toPack = new LinkedBlockingQueue<>(); + /** + * Queue of positions to pack. Refers to the toPackMap, in that every element of this queue will be a + * key in that map. + */ + private final LinkedBlockingQueue<ChunkPos> toPackQueue = new LinkedBlockingQueue<>(); + + /** + * All chunk positions pending packing. This map will be updated in-place if a new update to the chunk occurs + * while waiting in the queue for the packer thread to get to it. + */ + private final Map<ChunkPos, Chunk> toPackMap = new ConcurrentHashMap<>(); private final int dimension; @@ -89,10 +102,8 @@ public final class CachedWorld implements ICachedWorld, Helper { @Override public final void queueForPacking(Chunk chunk) { - try { - toPack.put(chunk); - } catch (InterruptedException e) { - e.printStackTrace(); + if (toPackMap.put(chunk.getPos(), chunk) == null) { + toPackQueue.add(chunk.getPos()); } } @@ -293,13 +304,9 @@ public final class CachedWorld implements ICachedWorld, Helper { public void run() { while (true) { - // TODO: Add CachedWorld unloading to remove the redundancy of having this - LinkedBlockingQueue<Chunk> queue = toPack; - if (queue == null) { - break; - } try { - Chunk chunk = queue.take(); + ChunkPos pos = toPackQueue.take(); + Chunk chunk = toPackMap.remove(pos); CachedChunk cached = ChunkPacker.pack(chunk); CachedWorld.this.updateCachedChunk(cached); //System.out.println("Processed chunk at " + chunk.x + "," + chunk.z); From f3561cab47693799c01b6a59ee9fbaf2b7c0842c Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Mon, 17 Aug 2020 15:54:42 -0700 Subject: [PATCH 41/84] SUPER cute code for repackOnAnyBlockChange --- src/api/java/baritone/api/Settings.java | 5 ++ .../mixins/MixinNetHandlerPlayClient.java | 67 +++++++++++++++++++ 2 files changed, 72 insertions(+) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 4e622dc2a..4b44d3e57 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -439,6 +439,11 @@ public final class Settings { */ public final Setting<Boolean> simplifyUnloadedYCoord = new Setting<>(true); + /** + * Whenever a block changes, repack the whole chunk that it's in + */ + public final Setting<Boolean> repackOnAnyBlockChange = new Setting<>(true); + /** * If a movement takes this many ticks more than its initial cost estimate, cancel it */ diff --git a/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java b/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java index 96e9cc29d..f1c1f7972 100644 --- a/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java +++ b/src/launch/java/baritone/launch/mixins/MixinNetHandlerPlayClient.java @@ -17,14 +17,19 @@ package baritone.launch.mixins; +import baritone.Baritone; import baritone.api.BaritoneAPI; import baritone.api.IBaritone; import baritone.api.event.events.ChunkEvent; import baritone.api.event.events.type.EventState; +import baritone.cache.CachedChunk; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.network.play.server.SPacketBlockChange; import net.minecraft.network.play.server.SPacketChunkData; import net.minecraft.network.play.server.SPacketCombatEvent; +import net.minecraft.network.play.server.SPacketMultiBlockChange; +import net.minecraft.util.math.ChunkPos; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -80,6 +85,68 @@ public class MixinNetHandlerPlayClient { } } + @Inject( + method = "handleBlockChange", + at = @At("RETURN") + ) + private void postHandleBlockChange(SPacketBlockChange packetIn, CallbackInfo ci) { + if (!Baritone.settings().repackOnAnyBlockChange.value) { + return; + } + if (!CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(packetIn.getBlockState().getBlock())) { + return; + } + for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) { + EntityPlayerSP player = ibaritone.getPlayerContext().player(); + if (player != null && player.connection == (NetHandlerPlayClient) (Object) this) { + ibaritone.getGameEventHandler().onChunkEvent( + new ChunkEvent( + EventState.POST, + ChunkEvent.Type.POPULATE_FULL, + packetIn.getBlockPosition().getX() >> 4, + packetIn.getBlockPosition().getZ() >> 4 + ) + ); + } + } + } + + @Inject( + method = "handleMultiBlockChange", + at = @At("RETURN") + ) + private void postHandleMultiBlockChange(SPacketMultiBlockChange packetIn, CallbackInfo ci) { + if (!Baritone.settings().repackOnAnyBlockChange.value) { + return; + } + if (packetIn.getChangedBlocks().length == 0) { + return; + } + https://docs.oracle.com/javase/specs/jls/se7/html/jls-14.html#jls-14.15 + { + for (SPacketMultiBlockChange.BlockUpdateData update : packetIn.getChangedBlocks()) { + if (CachedChunk.BLOCKS_TO_KEEP_TRACK_OF.contains(update.getBlockState().getBlock())) { + break https; + } + } + return; + } + ChunkPos pos = new ChunkPos(packetIn.getChangedBlocks()[0].getPos()); + for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) { + EntityPlayerSP player = ibaritone.getPlayerContext().player(); + if (player != null && player.connection == (NetHandlerPlayClient) (Object) this) { + ibaritone.getGameEventHandler().onChunkEvent( + new ChunkEvent( + EventState.POST, + ChunkEvent.Type.POPULATE_FULL, + pos.x, + pos.z + ) + ); + } + } + } + @Inject( method = "handleCombatEvent", at = @At( From 98516235574282d213f62107e261cc8a55f2e7f2 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Mon, 17 Aug 2020 16:03:04 -0700 Subject: [PATCH 42/84] anti-indrit-cringe --- src/api/java/baritone/api/Settings.java | 16 +++++++--------- .../pathing/movement/MovementHelper.java | 2 +- src/main/java/baritone/utils/ToolSet.java | 4 ++-- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index b48bf55fb..5dfcef6ae 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -62,19 +62,17 @@ public final class Settings { public final Setting<Boolean> allowInventory = new Setting<>(false); /** - * Allow player to decide if to use auto tool or not + * Disable baritone's auto-tool at runtime, but still assume that another mod will provide auto tool functionality + * <p> + * Specifically, path calculation will still assume that an auto tool wil run at execution time, even though + * Baritone itself will not do that. */ - public final Setting<Boolean> autoTool = new Setting<>(true); + public final Setting<Boolean> assumeExternalAutoTool = new Setting<>(false); /** - * Should movement cost calculation ignore the cost of breaking blocks with current slot, and assume best possible - * item in the hotbar? - * - * Only use this if actually necessary, make sure to put this back to original state (false), or it - * might mess up pathing in some combinations with auto tool setting. (just fall back to original settings if any - * problems occurs) + * If this setting is on, no auto tool will occur at all, not at calculation time nor execution time */ - public final Setting<Boolean> ignoreAutoToolMovementCost = new Setting<>(false); + public final Setting<Boolean> disableAutoTool = new Setting<>(false); /** * It doesn't actually take twenty ticks to place a block, this cost is so high diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 7ae57ae46..7165303c4 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -432,7 +432,7 @@ public interface MovementHelper extends ActionCosts, Helper { * @param ts previously calculated ToolSet */ static void switchToBestToolFor(IPlayerContext ctx, IBlockState b, ToolSet ts, boolean preferSilkTouch) { - if (Baritone.settings().autoTool.value) { + if (!Baritone.settings().disableAutoTool.value && !Baritone.settings().assumeExternalAutoTool.value) { ctx.player().inventory.currentItem = ts.getBestSlot(b.getBlock(), preferSilkTouch); } } diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index b903bdf38..aa8819cef 100644 --- a/src/main/java/baritone/utils/ToolSet.java +++ b/src/main/java/baritone/utils/ToolSet.java @@ -111,9 +111,9 @@ public class ToolSet { /* If we actually want know what efficiency our held item has instead of the best one - possible, this lets us make pathing depending on the actual tool used (if auto tool is disabled) + possible, this lets us make pathing depend on the actual tool to be used (if auto tool is disabled) */ - if (!Baritone.settings().ignoreAutoToolMovementCost.value && pathingCalculation) { + if (Baritone.settings().disableAutoTool.value && pathingCalculation) { return player.inventory.currentItem; } From 02e7886e77364a7249c1d310ee9f730dda96abbd Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Mon, 17 Aug 2020 16:15:56 -0700 Subject: [PATCH 43/84] properly set isSafeToCancel in MovementDiagonal, fixes #1788 --- .../pathing/movement/movements/MovementDiagonal.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java index 450144c0d..2631af840 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java @@ -56,6 +56,14 @@ public class MovementDiagonal extends Movement { super(baritone, start, end, new BetterBlockPos[]{dir1, dir1.up(), dir2, dir2.up(), end, end.up()}); } + @Override + protected boolean safeToCancel(MovementState state) { + return ctx.playerFeet().equals(src) || (( + MovementHelper.canWalkOn(ctx, new BlockPos(src.x, src.y - 1, dest.z)) + ) && + MovementHelper.canWalkOn(ctx, new BlockPos(dest.x, src.y - 1, src.z))); + } + @Override public double calculateCost(CalculationContext context) { MutableMoveResult result = new MutableMoveResult(); From 523f13c430404d2f2910f6ecd0dca7595d9e969f Mon Sep 17 00:00:00 2001 From: RealIndrit <32206640+RealIndrit@users.noreply.github.com> Date: Tue, 18 Aug 2020 12:36:10 +0200 Subject: [PATCH 44/84] =?UTF-8?q?=F0=9F=94=A5=20Get=20yeeted=20unused=20co?= =?UTF-8?q?de?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removed an unused function that can't be used anyways, because RayTraceUtils cant detect entity hit... --- src/api/java/baritone/api/utils/IPlayerContext.java | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/api/java/baritone/api/utils/IPlayerContext.java b/src/api/java/baritone/api/utils/IPlayerContext.java index 8ce3271b2..f746110e5 100644 --- a/src/api/java/baritone/api/utils/IPlayerContext.java +++ b/src/api/java/baritone/api/utils/IPlayerContext.java @@ -97,17 +97,4 @@ public interface IPlayerContext { default boolean isLookingAt(BlockPos pos) { return getSelectedBlock().equals(Optional.of(pos)); } - - /** - * Returns the entity that the crosshair is currently placed over. Updated once per tick. - * - * @return The entity - */ - default Optional<Entity> getSelectedEntity() { - RayTraceResult result = objectMouseOver(); - if (result != null && result.typeOfHit == RayTraceResult.Type.ENTITY) { - return Optional.of(result.entityHit); - } - return Optional.empty(); - } } From 7f9704592e1aa4765351d1c17637fef840867fa5 Mon Sep 17 00:00:00 2001 From: kuthy <mariusdkm@gmail.com> Date: Tue, 18 Aug 2020 15:40:12 +0200 Subject: [PATCH 45/84] Made catch function wide --- src/main/java/baritone/utils/GuiClick.java | 40 ++++++++++------------ 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/src/main/java/baritone/utils/GuiClick.java b/src/main/java/baritone/utils/GuiClick.java index 00be0635a..1716d74b6 100644 --- a/src/main/java/baritone/utils/GuiClick.java +++ b/src/main/java/baritone/utils/GuiClick.java @@ -78,30 +78,26 @@ public class GuiClick extends GuiScreen { @Override protected void mouseReleased(int mouseX, int mouseY, int mouseButton) { - if (mouseButton == 0) { - if (clickStart != null && !clickStart.equals(currentMouseOver)) { - BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections(); - BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver)); - ITextComponent component = new TextComponentString("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel"); - component.getStyle() - .setColor(TextFormatting.WHITE) - .setClickEvent(new ClickEvent( - ClickEvent.Action.RUN_COMMAND, - FORCE_COMMAND_PREFIX + "help sel" - )); - Helper.HELPER.logDirect(component); - clickStart = null; - } else { - if (currentMouseOver != null)//Catch this, or else a click into void will result in a crash + if (currentMouseOver != null) { //Catch this, or else a click into void will result in a crash + if (mouseButton == 0) { + if (clickStart != null && !clickStart.equals(currentMouseOver)) { + BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().removeAllSelections(); + BaritoneAPI.getProvider().getPrimaryBaritone().getSelectionManager().addSelection(BetterBlockPos.from(clickStart), BetterBlockPos.from(currentMouseOver)); + ITextComponent component = new TextComponentString("Selection made! For usage: " + Baritone.settings().prefix.value + "help sel"); + component.getStyle() + .setColor(TextFormatting.WHITE) + .setClickEvent(new ClickEvent( + ClickEvent.Action.RUN_COMMAND, + FORCE_COMMAND_PREFIX + "help sel" + )); + Helper.HELPER.logDirect(component); + clickStart = null; + } else { BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver)); - else - Helper.HELPER.logDirect("Sorry, I can't go to nothing"); - } - } else if (mouseButton == 1) { - if (currentMouseOver != null) + } + } else if (mouseButton == 1) { BaritoneAPI.getProvider().getPrimaryBaritone().getCustomGoalProcess().setGoalAndPath(new GoalBlock(currentMouseOver.up())); - else - Helper.HELPER.logDirect("Sorry, I can't go to nothing"); + } } clickStart = null; } From 5f686c1c12e1abfc071fa3bda028da7a9e527183 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Thu, 20 Aug 2020 22:40:16 +0200 Subject: [PATCH 46/84] improve isSafeToCancel in MovementDiagonal even more It did not return true early enough for backfill while cornering over air --- .../movement/movements/MovementDiagonal.java | 34 ++++++++++++++++--- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java index 2631af840..1ea0591ce 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java @@ -31,6 +31,7 @@ import baritone.utils.pathing.MutableMoveResult; import com.google.common.collect.ImmutableSet; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.init.Blocks; import net.minecraft.util.EnumFacing; import net.minecraft.util.math.BlockPos; @@ -58,11 +59,34 @@ public class MovementDiagonal extends Movement { @Override protected boolean safeToCancel(MovementState state) { - return ctx.playerFeet().equals(src) || (( - MovementHelper.canWalkOn(ctx, new BlockPos(src.x, src.y - 1, dest.z)) - ) && - MovementHelper.canWalkOn(ctx, new BlockPos(dest.x, src.y - 1, src.z))); - } + //too simple. backfill does not work after cornering with this + //return MovementHelper.canWalkOn(ctx, ctx.playerFeet().down()); + EntityPlayerSP player = ctx.player(); + double offset = 0.25; + double x = player.posX; + double y = player.posY - 1; + double z = player.posZ; + //standard + if (ctx.playerFeet().equals(src)){ + return true; + } + //both corners are walkable + if (MovementHelper.canWalkOn(ctx, new BlockPos(src.x, src.y - 1, dest.z)) + && MovementHelper.canWalkOn(ctx, new BlockPos(dest.x, src.y - 1, src.z))){ + return true; + } + //we are in a likely unwalkable corner, check for a supporting block + if (ctx.playerFeet().equals(new BetterBlockPos(src.x, src.y, dest.z)) + || ctx.playerFeet().equals(new BetterBlockPos(dest.x, src.y, src.z))){ + if (MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z + offset)) + || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z - offset)) + || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z + offset)) + || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z - offset))){ + return true; + } + } + return false; + } @Override public double calculateCost(CalculationContext context) { From b7d1ba1fa5187e096356c90c43c780b4481aa4d0 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Thu, 20 Aug 2020 23:11:55 +0200 Subject: [PATCH 47/84] Make Codacity happy --- .../pathing/movement/movements/MovementDiagonal.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java index 1ea0591ce..eaaef0a83 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java @@ -78,12 +78,11 @@ public class MovementDiagonal extends Movement { //we are in a likely unwalkable corner, check for a supporting block if (ctx.playerFeet().equals(new BetterBlockPos(src.x, src.y, dest.z)) || ctx.playerFeet().equals(new BetterBlockPos(dest.x, src.y, src.z))){ - if (MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z + offset)) + && (MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z + offset)) || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z - offset)) || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z + offset)) - || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z - offset))){ + || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z - offset))) return true; - } } return false; } From ea35a3478f8b87a10bd440f5638961fdd455d6c5 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Thu, 20 Aug 2020 23:16:59 +0200 Subject: [PATCH 48/84] Codacity again for the same and syntax dab --- .../baritone/pathing/movement/movements/MovementDiagonal.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java index eaaef0a83..3fc67e8f1 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java @@ -77,11 +77,11 @@ public class MovementDiagonal extends Movement { } //we are in a likely unwalkable corner, check for a supporting block if (ctx.playerFeet().equals(new BetterBlockPos(src.x, src.y, dest.z)) - || ctx.playerFeet().equals(new BetterBlockPos(dest.x, src.y, src.z))){ + || ctx.playerFeet().equals(new BetterBlockPos(dest.x, src.y, src.z))) && (MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z + offset)) || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z - offset)) || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z + offset)) - || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z - offset))) + || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z - offset))){ return true; } return false; From 3c691bb498395e941830b4eac381ef00abf281eb Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Thu, 20 Aug 2020 23:33:47 +0200 Subject: [PATCH 49/84] But now it's working --- .../baritone/pathing/movement/movements/MovementDiagonal.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java index 3fc67e8f1..2e026b877 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java @@ -76,12 +76,12 @@ public class MovementDiagonal extends Movement { return true; } //we are in a likely unwalkable corner, check for a supporting block - if (ctx.playerFeet().equals(new BetterBlockPos(src.x, src.y, dest.z)) + if ((ctx.playerFeet().equals(new BetterBlockPos(src.x, src.y, dest.z)) || ctx.playerFeet().equals(new BetterBlockPos(dest.x, src.y, src.z))) && (MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z + offset)) || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z - offset)) || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z + offset)) - || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z - offset))){ + || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z - offset)))){ return true; } return false; From ed91e2aa7bdb73ddd1d88385aa28b7b58af386d6 Mon Sep 17 00:00:00 2001 From: krzys-h <krzys_h@interia.pl> Date: Mon, 24 Aug 2020 22:19:28 +0200 Subject: [PATCH 50/84] Fix "#entity follow <name>" under Forge One of the Forge patches removes EntityList.REGISTRY and provides the getClass method as a replacement. The fix is based on a similar one I found in WorldDownloader Closes #1376 (and duplicates: #1777 and #1815) --- .../api/command/datatypes/EntityClassById.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/command/datatypes/EntityClassById.java b/src/api/java/baritone/api/command/datatypes/EntityClassById.java index aed7cdf41..becc649c1 100644 --- a/src/api/java/baritone/api/command/datatypes/EntityClassById.java +++ b/src/api/java/baritone/api/command/datatypes/EntityClassById.java @@ -32,7 +32,19 @@ public enum EntityClassById implements IDatatypeFor<Class<? extends Entity>> { public Class<? extends Entity> get(IDatatypeContext ctx) throws CommandException { ResourceLocation id = new ResourceLocation(ctx.getConsumer().getString()); Class<? extends Entity> entity; - if ((entity = EntityList.REGISTRY.getObject(id)) == null) { + try { + entity = EntityList.REGISTRY.getObject(id); + } catch(NoSuchFieldError e) { + // Forge removes EntityList.REGISTRY field and provides the getClass method as a replacement + // See https://github.com/MinecraftForge/MinecraftForge/blob/1.12.x/patches/minecraft/net/minecraft/entity/EntityList.java.patch + try { + entity = (Class<? extends Entity>) EntityList.class.getMethod("getClass", ResourceLocation.class).invoke(null, id); + } catch (Exception ex) { + throw new RuntimeException("EntityList.REGISTRY does not exist and failed to call the Forge-replacement method", ex); + } + } + + if (entity == null) { throw new IllegalArgumentException("no entity found by that id"); } return entity; From 9636e69a6b34778f9ee5c73bef961f9409bc2542 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Mon, 24 Aug 2020 23:06:19 +0200 Subject: [PATCH 51/84] slightly better condition --- .../pathing/movement/movements/MovementDiagonal.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java index 2e026b877..b5ea19a9c 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementDiagonal.java @@ -76,15 +76,14 @@ public class MovementDiagonal extends Movement { return true; } //we are in a likely unwalkable corner, check for a supporting block - if ((ctx.playerFeet().equals(new BetterBlockPos(src.x, src.y, dest.z)) - || ctx.playerFeet().equals(new BetterBlockPos(dest.x, src.y, src.z))) - && (MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z + offset)) + if (ctx.playerFeet().equals(new BetterBlockPos(src.x, src.y, dest.z)) + || ctx.playerFeet().equals(new BetterBlockPos(dest.x, src.y, src.z))){ + return (MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z + offset)) || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x + offset, y, z - offset)) || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z + offset)) - || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z - offset)))){ - return true; + || MovementHelper.canWalkOn(ctx, new BetterBlockPos(x - offset, y, z - offset))); } - return false; + return true; } @Override From d7088c8eea51d4abbdf39c07e7eae7e2702848ec Mon Sep 17 00:00:00 2001 From: scorbett123 <sam@corbettchocolates.com> Date: Mon, 31 Aug 2020 18:48:46 +0100 Subject: [PATCH 52/84] fix typo in java-doc x2 Signed-off-by: scorbett123 <sam@corbettchocolates.com> --- src/api/java/baritone/api/Settings.java | 2 +- src/api/java/baritone/api/process/IBaritoneProcess.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 6ef5e5d12..46e3fbf5c 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -64,7 +64,7 @@ public final class Settings { /** * Disable baritone's auto-tool at runtime, but still assume that another mod will provide auto tool functionality * <p> - * Specifically, path calculation will still assume that an auto tool wil run at execution time, even though + * Specifically, path calculation will still assume that an auto tool will run at execution time, even though * Baritone itself will not do that. */ public final Setting<Boolean> assumeExternalAutoTool = new Setting<>(false); diff --git a/src/api/java/baritone/api/process/IBaritoneProcess.java b/src/api/java/baritone/api/process/IBaritoneProcess.java index 726260d82..9c62d203d 100644 --- a/src/api/java/baritone/api/process/IBaritoneProcess.java +++ b/src/api/java/baritone/api/process/IBaritoneProcess.java @@ -75,7 +75,7 @@ public interface IBaritoneProcess { * to start eating this tick. {@code PauseForAutoEatProcess} should only actually right click once onTick is called with * {@code isSafeToCancel} true though. * - * @return Whethor or not if this control is temporary + * @return Whether or not if this control is temporary */ boolean isTemporary(); From bcbfca100fd3ae98c9fb3ae3a52c7a1748d8a05c Mon Sep 17 00:00:00 2001 From: scorbett123 <sam@corbettchocolates.com> Date: Fri, 4 Sep 2020 10:43:05 +0100 Subject: [PATCH 53/84] add mineOnlyExposedOres setting Signed-off-by: scorbett123 <sam@corbettchocolates.com> --- src/api/java/baritone/api/Settings.java | 5 +++++ src/main/java/baritone/process/MineProcess.java | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 6ef5e5d12..ba62a1e85 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -726,6 +726,11 @@ public final class Settings { */ public final Setting<Integer> maxCachedWorldScanCount = new Setting<>(10); + /** + * This will only allow baritone to mine exposed ores, can be used to stop ore obfuscators on servers that use them. + */ + public final Setting<Boolean> allowOnlyExposedOres = new Setting<>(false); + /** * When GetToBlock doesn't know any locations for the desired block, explore randomly instead of giving up. */ diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index 6e8ba245b..01d78b1ef 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -40,6 +40,7 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3i; import java.util.*; import java.util.stream.Collectors; @@ -409,6 +410,8 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro // remove any that are implausible to mine (encased in bedrock, or touching lava) .filter(pos -> MineProcess.plausibleToBreak(ctx, pos)) + .filter(pos -> isNextToAir(ctx, pos)) + .filter(pos -> !blacklist.contains(pos)) .sorted(Comparator.comparingDouble(ctx.getBaritone().getPlayerContext().player()::getDistanceSq)) @@ -420,6 +423,19 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro return locs; } + public static boolean isNextToAir(CalculationContext ctx, BlockPos pos) { + if (!Baritone.settings().allowOnlyExposedOres.value) { + return true; + } + return (ctx.bsi.get0(pos.down()).getBlock() == Blocks.AIR || + ctx.bsi.get0(pos.up()).getBlock() == Blocks.AIR + || ctx.bsi.get0(pos.north()).getBlock() == Blocks.AIR || + ctx.bsi.get0(pos.south()).getBlock() == Blocks.AIR || + ctx.bsi.get0(pos.east()).getBlock() == Blocks.AIR + || ctx.bsi.get0(pos.west()).getBlock() == Blocks.AIR); + } + + public static boolean plausibleToBreak(CalculationContext ctx, BlockPos pos) { if (MovementHelper.getMiningDurationTicks(ctx, pos.getX(), pos.getY(), pos.getZ(), ctx.bsi.get0(pos), true) >= COST_INF) { return false; From 063f698bd2736388e6e59f9821b9722b31fae681 Mon Sep 17 00:00:00 2001 From: scorbett123 <sam@corbettchocolates.com> Date: Fri, 4 Sep 2020 18:42:06 +0100 Subject: [PATCH 54/84] need to remove diagonals, however this does most of what you suggest. Signed-off-by: scorbett123 <sam@corbettchocolates.com> --- src/api/java/baritone/api/Settings.java | 7 ++ .../java/baritone/process/MineProcess.java | 97 +++++++++++++++++-- 2 files changed, 95 insertions(+), 9 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index ba62a1e85..3001ab574 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -731,6 +731,13 @@ public final class Settings { */ public final Setting<Boolean> allowOnlyExposedOres = new Setting<>(false); + /** + * When allowOnlyExposedOres is enabled this is the distance around to search. + * <p> + * I recommend keeping this value low as the amount of blocks that need to be scanned increases exponentially. + */ + public final Setting<Integer> allowOnlyExposedOresDistance = new Setting<>(1); + /** * When GetToBlock doesn't know any locations for the desired block, explore randomly instead of giving up. */ diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index 01d78b1ef..2bf44f06e 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -424,15 +424,8 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro } public static boolean isNextToAir(CalculationContext ctx, BlockPos pos) { - if (!Baritone.settings().allowOnlyExposedOres.value) { - return true; - } - return (ctx.bsi.get0(pos.down()).getBlock() == Blocks.AIR || - ctx.bsi.get0(pos.up()).getBlock() == Blocks.AIR - || ctx.bsi.get0(pos.north()).getBlock() == Blocks.AIR || - ctx.bsi.get0(pos.south()).getBlock() == Blocks.AIR || - ctx.bsi.get0(pos.east()).getBlock() == Blocks.AIR - || ctx.bsi.get0(pos.west()).getBlock() == Blocks.AIR); + //need to remove diagonals + return makeSphere(pos, Baritone.settings().allowOnlyExposedOresDistance.value, ctx); } @@ -468,4 +461,90 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro rescan(new ArrayList<>(), new CalculationContext(baritone)); } } + + public static boolean makeSphere(BlockPos pos, double radius, CalculationContext ctx) { + double radiusX = radius; + double radiusY = radius; + double radiusZ = radius; + radiusX += 0.5; + radiusY += 0.5; + radiusZ += 0.5; + + final double invRadiusX = 1 / radiusX; + final double invRadiusY = 1 / radiusY; + final double invRadiusZ = 1 / radiusZ; + + final int ceilRadiusX = (int) Math.ceil(radiusX); + final int ceilRadiusY = (int) Math.ceil(radiusY); + final int ceilRadiusZ = (int) Math.ceil(radiusZ); + + double nextXn = 0; + forX: + for (int x = 0; x <= ceilRadiusX; ++x) { + final double xn = nextXn; + nextXn = (x + 1) * invRadiusX; + double nextYn = 0; + forY: + for (int y = 0; y <= ceilRadiusY; ++y) { + final double yn = nextYn; + nextYn = (y + 1) * invRadiusY; + double nextZn = 0; + forZ: + for (int z = 0; z <= ceilRadiusZ; ++z) { + final double zn = nextZn; + nextZn = (z + 1) * invRadiusZ; + + double distanceSq = lengthSq(xn, yn, zn); + if (distanceSq > 1) { + if (z == 0) { + if (y == 0) { + break forX; + } + break forY; + } + break forZ; + } + + if (isTransparent(pos.add(x, y, z), ctx)) { + return true; + } + if (isTransparent(pos.add(-x, y, z), ctx)) { + return true; + } + if (isTransparent(pos.add(x, -y, z), ctx)) { + return true; + } + if (isTransparent(pos.add(x, y, -z), ctx)) { + return true; + } + if (isTransparent(pos.add(-x, -y, z), ctx)) { + return true; + } + if (isTransparent(pos.add(x, -y, -z), ctx)) { + return true; + } + if (isTransparent(pos.add(-x, y, -z), ctx)) { + return true; + } + if (isTransparent(pos.add(-x, -y, -z), ctx)) { + return true; + } + } + } + } + + return false; + } + + private static double lengthSq(double x, double y, double z) { + return (x * x) + (y * y) + (z * z); + } + + public static boolean isTransparent(BlockPos pos, CalculationContext ctx) { + IBlockState blockState = ctx.bsi.get0(pos); + return blockState.getBlock() == Blocks.AIR || + blockState.getBlock() == Blocks.FLOWING_LAVA || + blockState.getBlock() == Blocks.FLOWING_WATER || + blockState.getBlock() == Blocks.WATER; + } } From 547db3a6b4dbd624a7f9baf24f26e16624712db3 Mon Sep 17 00:00:00 2001 From: Sam Corbett <sam@corbettchocolates.com> Date: Sat, 5 Sep 2020 17:07:06 +0100 Subject: [PATCH 55/84] make the ability to turn it off. Signed-off-by: Sam Corbett <sam@corbettchocolates.com> --- src/api/java/baritone/api/Settings.java | 2 +- src/main/java/baritone/process/MineProcess.java | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 3001ab574..55b5ca888 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -734,7 +734,7 @@ public final class Settings { /** * When allowOnlyExposedOres is enabled this is the distance around to search. * <p> - * I recommend keeping this value low as the amount of blocks that need to be scanned increases exponentially. + * It is recommended to keep this value low, as it exponentially increases calculation times and also to keep the */ public final Setting<Integer> allowOnlyExposedOresDistance = new Setting<>(1); diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index 2bf44f06e..c733658b2 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -40,7 +40,7 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3i; +import net.minecraft.util.math.Vec3d; import java.util.*; import java.util.stream.Collectors; @@ -410,7 +410,12 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro // remove any that are implausible to mine (encased in bedrock, or touching lava) .filter(pos -> MineProcess.plausibleToBreak(ctx, pos)) - .filter(pos -> isNextToAir(ctx, pos)) + .filter(pos -> { + if (Baritone.settings().allowOnlyExposedOres.value) + return isNextToAir(ctx, pos); + else + return true; + }) .filter(pos -> !blacklist.contains(pos)) @@ -494,7 +499,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro final double zn = nextZn; nextZn = (z + 1) * invRadiusZ; - double distanceSq = lengthSq(xn, yn, zn); + double distanceSq = new Vec3d(xn, yn, zn).lengthSquared(); if (distanceSq > 1) { if (z == 0) { if (y == 0) { @@ -536,10 +541,6 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro return false; } - private static double lengthSq(double x, double y, double z) { - return (x * x) + (y * y) + (z * z); - } - public static boolean isTransparent(BlockPos pos, CalculationContext ctx) { IBlockState blockState = ctx.bsi.get0(pos); return blockState.getBlock() == Blocks.AIR || From 071243b99a7ea3ff7c64b1171cdbaecf0081ec94 Mon Sep 17 00:00:00 2001 From: Sam Corbett <sam@corbettchocolates.com> Date: Tue, 8 Sep 2020 17:39:03 +0100 Subject: [PATCH 56/84] move is transparent to movement helper and circle maker --- .../pathing/movement/MovementHelper.java | 7 ++ .../java/baritone/process/MineProcess.java | 96 +++---------------- 2 files changed, 19 insertions(+), 84 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index 7165303c4..df8218e86 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -562,4 +562,11 @@ public interface MovementHelper extends ActionCosts, Helper { enum PlaceResult { READY_TO_PLACE, ATTEMPTING, NO_OPTION; } + public static boolean isTransparent(Block b) { + + return b== Blocks.AIR || + b == Blocks.FLOWING_LAVA || + b == Blocks.FLOWING_WATER || + b == Blocks.WATER; + } } diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index c733658b2..2d51daf9e 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -429,8 +429,18 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro } public static boolean isNextToAir(CalculationContext ctx, BlockPos pos) { - //need to remove diagonals - return makeSphere(pos, Baritone.settings().allowOnlyExposedOresDistance.value, ctx); + int radius = Baritone.settings().allowOnlyExposedOresDistance.value; + for (int dx = -radius; dx <= radius; dx++) { + for (int dy = -radius; dy <= radius; dy++) { + for (int dz = -radius; dz <= radius; dz++) { + if (Math.abs(dx) + Math.abs(dy) + Math.abs(dz) <= radius + && MovementHelper.isTransparent(ctx.getBlock(pos.getX()+dx, pos.getY()+dy, pos.getZ()+dz))) { + return true; + } + } + } + } + return false; } @@ -466,86 +476,4 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro rescan(new ArrayList<>(), new CalculationContext(baritone)); } } - - public static boolean makeSphere(BlockPos pos, double radius, CalculationContext ctx) { - double radiusX = radius; - double radiusY = radius; - double radiusZ = radius; - radiusX += 0.5; - radiusY += 0.5; - radiusZ += 0.5; - - final double invRadiusX = 1 / radiusX; - final double invRadiusY = 1 / radiusY; - final double invRadiusZ = 1 / radiusZ; - - final int ceilRadiusX = (int) Math.ceil(radiusX); - final int ceilRadiusY = (int) Math.ceil(radiusY); - final int ceilRadiusZ = (int) Math.ceil(radiusZ); - - double nextXn = 0; - forX: - for (int x = 0; x <= ceilRadiusX; ++x) { - final double xn = nextXn; - nextXn = (x + 1) * invRadiusX; - double nextYn = 0; - forY: - for (int y = 0; y <= ceilRadiusY; ++y) { - final double yn = nextYn; - nextYn = (y + 1) * invRadiusY; - double nextZn = 0; - forZ: - for (int z = 0; z <= ceilRadiusZ; ++z) { - final double zn = nextZn; - nextZn = (z + 1) * invRadiusZ; - - double distanceSq = new Vec3d(xn, yn, zn).lengthSquared(); - if (distanceSq > 1) { - if (z == 0) { - if (y == 0) { - break forX; - } - break forY; - } - break forZ; - } - - if (isTransparent(pos.add(x, y, z), ctx)) { - return true; - } - if (isTransparent(pos.add(-x, y, z), ctx)) { - return true; - } - if (isTransparent(pos.add(x, -y, z), ctx)) { - return true; - } - if (isTransparent(pos.add(x, y, -z), ctx)) { - return true; - } - if (isTransparent(pos.add(-x, -y, z), ctx)) { - return true; - } - if (isTransparent(pos.add(x, -y, -z), ctx)) { - return true; - } - if (isTransparent(pos.add(-x, y, -z), ctx)) { - return true; - } - if (isTransparent(pos.add(-x, -y, -z), ctx)) { - return true; - } - } - } - } - - return false; - } - - public static boolean isTransparent(BlockPos pos, CalculationContext ctx) { - IBlockState blockState = ctx.bsi.get0(pos); - return blockState.getBlock() == Blocks.AIR || - blockState.getBlock() == Blocks.FLOWING_LAVA || - blockState.getBlock() == Blocks.FLOWING_WATER || - blockState.getBlock() == Blocks.WATER; - } } From 612510550f576d22d06582b302e88bc2037f4d32 Mon Sep 17 00:00:00 2001 From: Sam Corbett <sam@corbettchocolates.com> Date: Tue, 8 Sep 2020 19:00:41 +0100 Subject: [PATCH 57/84] fix javadoc. Signed-off-by: Sam Corbett <sam@corbettchocolates.com> --- 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 c5ba95bc2..9cabe083c 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -734,7 +734,7 @@ public final class Settings { /** * When allowOnlyExposedOres is enabled this is the distance around to search. * <p> - * It is recommended to keep this value low, as it exponentially increases calculation times and also to keep the + * It is recommended to keep this value low, as it dramatically increases calculation times. */ public final Setting<Integer> allowOnlyExposedOresDistance = new Setting<>(1); From 96b874c099cdd7fe830c861b9def97602a6aeeb7 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Fri, 11 Sep 2020 21:52:43 -0700 Subject: [PATCH 58/84] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 274dbe0f5..c321ce4a9 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ A Minecraft pathfinder bot. -Baritone is the pathfinding system used in [Impact](https://impactclient.net/) since 4.4. There's a [showcase video](https://youtu.be/CZkLXWo4Fg4) made by @Adovin#0730 on Baritone which I recommend. [Here's](https://www.youtube.com/watch?v=StquF69-_wI) a (very old!) video I made showing off what it can do. +Baritone is the pathfinding system used in [Impact](https://impactclient.net/) since 4.4. There's a [showcase video](https://youtu.be/CZkLXWo4Fg4) made by @Adovin#0730 on Baritone which I recommend. [Here's](https://www.youtube.com/watch?v=StquF69-_wI) a (very old!) video I made showing off what it can do. [Tutorial playlist](https://www.youtube.com/playlist?list=PLnwnJ1qsS7CoQl9Si-RTluuzCo_4Oulpa) The easiest way to install Baritone is to install [Impact](https://impactclient.net/), which comes with Baritone. The second easiest way (for 1.12.2 only) is to install the v1.2.* `api-forge` jar from [releases](https://github.com/cabaletta/baritone/releases). **For 1.12.2 Forge, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.2.14/baritone-api-forge-1.2.14.jar)**. Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. From 175df6ce7a68ccc1d606afc64b36123e7b1f2ba8 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Fri, 11 Sep 2020 21:54:20 -0700 Subject: [PATCH 59/84] Update USAGE.md --- USAGE.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/USAGE.md b/USAGE.md index d817c24cb..b58744284 100644 --- a/USAGE.md +++ b/USAGE.md @@ -24,6 +24,8 @@ Watch this [showcase video](https://youtu.be/CZkLXWo4Fg4)! # Commands +[Tutorial playlist](https://www.youtube.com/playlist?list=PLnwnJ1qsS7CoQl9Si-RTluuzCo_4Oulpa) + **All** of these commands may need a prefix before them, as above ^. `help` From 32ef30686bc1504ccf67c9cdb8308161c3f37b3a Mon Sep 17 00:00:00 2001 From: Babbaj <babbaj45@gmail.com> Date: Sun, 13 Sep 2020 18:21:22 -0400 Subject: [PATCH 60/84] Don't call onLostControl on processes that haven't been fully constructed --- src/main/java/baritone/Baritone.java | 16 ++++++++-------- .../baritone/utils/BaritoneProcessHelper.java | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index 360a17fd5..32302287b 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -104,14 +104,14 @@ public class Baritone implements IBaritone { this.pathingControlManager = new PathingControlManager(this); { - followProcess = new FollowProcess(this); - mineProcess = new MineProcess(this); - customGoalProcess = new CustomGoalProcess(this); // very high iq - getToBlockProcess = new GetToBlockProcess(this); - builderProcess = new BuilderProcess(this); - exploreProcess = new ExploreProcess(this); - backfillProcess = new BackfillProcess(this); - farmProcess = new FarmProcess(this); + this.getPathingControlManager().registerProcess(followProcess = new FollowProcess(this)); + this.getPathingControlManager().registerProcess(mineProcess = new MineProcess(this)); + this.getPathingControlManager().registerProcess(customGoalProcess = new CustomGoalProcess(this)); // very high iq + this.getPathingControlManager().registerProcess(getToBlockProcess = new GetToBlockProcess(this)); + this.getPathingControlManager().registerProcess(builderProcess = new BuilderProcess(this)); + this.getPathingControlManager().registerProcess(exploreProcess = new ExploreProcess(this)); + this.getPathingControlManager().registerProcess(backfillProcess = new BackfillProcess(this)); + this.getPathingControlManager().registerProcess(farmProcess = new FarmProcess(this)); } this.worldProvider = new WorldProvider(); diff --git a/src/main/java/baritone/utils/BaritoneProcessHelper.java b/src/main/java/baritone/utils/BaritoneProcessHelper.java index 6abec9493..e9ce12736 100644 --- a/src/main/java/baritone/utils/BaritoneProcessHelper.java +++ b/src/main/java/baritone/utils/BaritoneProcessHelper.java @@ -30,7 +30,6 @@ public abstract class BaritoneProcessHelper implements IBaritoneProcess, Helper public BaritoneProcessHelper(Baritone baritone) { this.baritone = baritone; this.ctx = baritone.getPlayerContext(); - baritone.getPathingControlManager().registerProcess(this); } @Override From 234fd3f75e0b3a61da9ae44b9efbf6f4be448893 Mon Sep 17 00:00:00 2001 From: Babbaj <babbaj45@gmail.com> Date: Sun, 13 Sep 2020 18:45:50 -0400 Subject: [PATCH 61/84] don't use getter --- src/main/java/baritone/Baritone.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index 32302287b..0ec5583f3 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -104,14 +104,14 @@ public class Baritone implements IBaritone { this.pathingControlManager = new PathingControlManager(this); { - this.getPathingControlManager().registerProcess(followProcess = new FollowProcess(this)); - this.getPathingControlManager().registerProcess(mineProcess = new MineProcess(this)); - this.getPathingControlManager().registerProcess(customGoalProcess = new CustomGoalProcess(this)); // very high iq - this.getPathingControlManager().registerProcess(getToBlockProcess = new GetToBlockProcess(this)); - this.getPathingControlManager().registerProcess(builderProcess = new BuilderProcess(this)); - this.getPathingControlManager().registerProcess(exploreProcess = new ExploreProcess(this)); - this.getPathingControlManager().registerProcess(backfillProcess = new BackfillProcess(this)); - this.getPathingControlManager().registerProcess(farmProcess = new FarmProcess(this)); + this.pathingControlManager.registerProcess(followProcess = new FollowProcess(this)); + this.pathingControlManager.registerProcess(mineProcess = new MineProcess(this)); + this.pathingControlManager.registerProcess(customGoalProcess = new CustomGoalProcess(this)); // very high iq + this.pathingControlManager.registerProcess(getToBlockProcess = new GetToBlockProcess(this)); + this.pathingControlManager.registerProcess(builderProcess = new BuilderProcess(this)); + this.pathingControlManager.registerProcess(exploreProcess = new ExploreProcess(this)); + this.pathingControlManager.registerProcess(backfillProcess = new BackfillProcess(this)); + this.pathingControlManager.registerProcess(farmProcess = new FarmProcess(this)); } this.worldProvider = new WorldProvider(); From 7e4d2c9b28c2c38cf8fdc4805cb7d89b3fb95ae6 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Tue, 15 Sep 2020 12:43:34 -0700 Subject: [PATCH 62/84] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c321ce4a9..803816090 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,6 @@ [![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%20integration-v1.3.4%20/%20v1.4.1-green.svg)](https://gitlab.com/emc-mods-indrit/baritone_api) [![rootNET integration](https://img.shields.io/badge/rootNET%20integration-v1.2.11-green.svg)](https://rootnet.dev/) -[![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-v1.2.12%20%2F%20v1.3.6%20%2F%20v1.4.4-red)](https://futureclient.net/) [![RusherHack integration](https://img.shields.io/badge/RusherHack%20integration-v1.2.14-green)](https://rusherhack.org/) [![forthebadge](https://forthebadge.com/images/badges/built-with-swag.svg)](http://forthebadge.com/) From 13ca691f5d1922571cfabaf6198b9b0f59500ade Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Wed, 16 Sep 2020 17:41:46 +0200 Subject: [PATCH 63/84] make `#wp goto` behave like `#goto` It now is a combined `#wp goal` and `#path` just like `#goto` is `#goal` and `#path` --- .../java/baritone/command/defaults/WaypointsCommand.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/command/defaults/WaypointsCommand.java b/src/main/java/baritone/command/defaults/WaypointsCommand.java index 62c74212c..fb15b0537 100644 --- a/src/main/java/baritone/command/defaults/WaypointsCommand.java +++ b/src/main/java/baritone/command/defaults/WaypointsCommand.java @@ -235,6 +235,10 @@ public class WaypointsCommand extends Command { Goal goal = new GoalBlock(waypoint.getLocation()); baritone.getCustomGoalProcess().setGoal(goal); logDirect(String.format("Goal: %s", goal)); + } else if (action == Action.GOTO) { + Goal goal = new GoalBlock(waypoint.getLocation()); + baritone.getCustomGoalProcess().setGoalAndPath(goal); + logDirect(String.format("Going to: %s", goal)); } } } @@ -302,7 +306,8 @@ public class WaypointsCommand extends Command { SAVE("save", "s"), INFO("info", "show", "i"), DELETE("delete", "d"), - GOAL("goal", "goto", "g"); + GOAL("goal", "g"), + GOTO("goto"); private final String[] names; Action(String... names) { From 508dacac639fd9bfc780b320bd1b60cef9107487 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Fri, 18 Sep 2020 22:41:33 +0200 Subject: [PATCH 64/84] directly start pathing after `#home` just like servers directly teleport you after `/home` without waiting for something like `/teleport` --- src/main/java/baritone/command/defaults/DefaultCommands.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/command/defaults/DefaultCommands.java b/src/main/java/baritone/command/defaults/DefaultCommands.java index 67555ed51..a08ff0ff0 100644 --- a/src/main/java/baritone/command/defaults/DefaultCommands.java +++ b/src/main/java/baritone/command/defaults/DefaultCommands.java @@ -63,7 +63,7 @@ public final class DefaultCommands { new ThisWayCommand(baritone), new WaypointsCommand(baritone), new CommandAlias(baritone, "sethome", "Sets your home waypoint", "waypoints save home"), - new CommandAlias(baritone, "home", "Set goal to your home waypoint", "waypoints goal home"), + new CommandAlias(baritone, "home", "Path to your home waypoint", "waypoints goto home"), new SelCommand(baritone) )); ExecutionControlCommands prc = new ExecutionControlCommands(baritone); From 8a572516fcd42158a16870214b560e1844423bb8 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Wed, 23 Sep 2020 22:54:41 +0200 Subject: [PATCH 65/84] Update description of WaypointsCommand --- src/main/java/baritone/command/defaults/WaypointsCommand.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/command/defaults/WaypointsCommand.java b/src/main/java/baritone/command/defaults/WaypointsCommand.java index fb15b0537..67aad3654 100644 --- a/src/main/java/baritone/command/defaults/WaypointsCommand.java +++ b/src/main/java/baritone/command/defaults/WaypointsCommand.java @@ -296,7 +296,8 @@ public class WaypointsCommand extends Command { "> wp <s/save> <tag> <name> <pos> - Save the waypoint with the specified name and position.", "> wp <i/info/show> <tag> - Show info on a waypoint by tag.", "> wp <d/delete> <tag> - Delete a waypoint by tag.", - "> wp <g/goal/goto> <tag> - Set a goal to a waypoint by tag." + "> wp <g/goal> <tag> - Set a goal to a waypoint by tag.", + "> wp <goto> <tag> - Set a goal to a waypoint by tag and start pathing." ); } From af29ed7146ab49ce2555c14da139eec3244b758f Mon Sep 17 00:00:00 2001 From: CDAGaming <cstack2011@yahoo.com> Date: Tue, 18 Aug 2020 15:02:43 -0500 Subject: [PATCH 66/84] =?UTF-8?q?=E2=9C=A8=20Added=20a=20top/surface=20com?= =?UTF-8?q?mand?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Superseeds PR #594 --- .../command/defaults/DefaultCommands.java | 1 + .../command/defaults/SurfaceCommand.java | 89 +++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 src/main/java/baritone/command/defaults/SurfaceCommand.java diff --git a/src/main/java/baritone/command/defaults/DefaultCommands.java b/src/main/java/baritone/command/defaults/DefaultCommands.java index a08ff0ff0..41c58b003 100644 --- a/src/main/java/baritone/command/defaults/DefaultCommands.java +++ b/src/main/java/baritone/command/defaults/DefaultCommands.java @@ -60,6 +60,7 @@ public final class DefaultCommands { new FindCommand(baritone), new MineCommand(baritone), new ClickCommand(baritone), + new SurfaceCommand(baritone), new ThisWayCommand(baritone), new WaypointsCommand(baritone), new CommandAlias(baritone, "sethome", "Sets your home waypoint", "waypoints save home"), diff --git a/src/main/java/baritone/command/defaults/SurfaceCommand.java b/src/main/java/baritone/command/defaults/SurfaceCommand.java new file mode 100644 index 000000000..842b8050c --- /dev/null +++ b/src/main/java/baritone/command/defaults/SurfaceCommand.java @@ -0,0 +1,89 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see <https://www.gnu.org/licenses/>. + */ + +package baritone.command.defaults; + +import baritone.api.IBaritone; +import baritone.api.command.Command; +import baritone.api.command.argument.IArgConsumer; +import baritone.api.command.exception.CommandException; +import baritone.api.pathing.goals.Goal; +import baritone.api.pathing.goals.GoalBlock; +import baritone.api.utils.BetterBlockPos; +import net.minecraft.block.BlockAir; + +import java.util.Arrays; +import java.util.List; +import java.util.stream.Stream; + +public class SurfaceCommand extends Command { + + protected SurfaceCommand(IBaritone baritone) { + super(baritone, "surface", "top"); + } + + @Override + public void execute(String label, IArgConsumer args) throws CommandException { + final BetterBlockPos playerPos = baritone.getPlayerContext().playerFeet(); + final int surfaceLevel = baritone.getPlayerContext().world().getSeaLevel(); + final int worldHeight = baritone.getPlayerContext().world().getActualHeight(); + + // Ensure this command will not run if you are above the surface level and the block above you is air + // As this would imply that your are already on the open surface + if (playerPos.getY() > surfaceLevel && mc.world.getBlockState(playerPos.up()).getBlock() instanceof BlockAir) { + logDirect("Already at surface"); + return; + } + + final int startingYPos = Math.max(playerPos.getY(), surfaceLevel); + + for (int currentIteratedY = startingYPos; currentIteratedY < worldHeight; currentIteratedY++) { + final BetterBlockPos newPos = new BetterBlockPos(playerPos.getX(), currentIteratedY, playerPos.getZ()); + + if (!(mc.world.getBlockState(newPos).getBlock() instanceof BlockAir) && newPos.getY() > playerPos.getY()) { + Goal goal = new GoalBlock(newPos.up()); + logDirect(String.format("Going to: %s", goal.toString())); + baritone.getCustomGoalProcess().setGoalAndPath(goal); + return; + } + } + logDirect("No higher location found"); + } + + @Override + public Stream<String> tabComplete(String label, IArgConsumer args) { + return Stream.empty(); + } + + @Override + public String getShortDesc() { + return "Used to get out of caves, mines, ..."; + } + + @Override + public List<String> getLongDesc() { + return Arrays.asList( + "The surface/top command tells Baritone to head towards the closest surface-like area.", + "", + "This can be the surface or the highest available air space, depending on circumstances.", + "", + "Usage:", + "> surface - Used to get out of caves, mines, ...", + "> top - Used to get out of caves, mines, ..." + ); + } +} From d6665f1cd57e8a8846edab137259fe5af9e2d684 Mon Sep 17 00:00:00 2001 From: CDAGaming <cstack2011@yahoo.com> Date: Tue, 18 Aug 2020 12:20:40 -0500 Subject: [PATCH 67/84] =?UTF-8?q?=E2=9C=A8=20Added=20Toast=20API=20Support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This adds in a logAsToast and toastTimer option, and is a minified form of Indrit's initial implementation previously used from fabritone --- src/api/java/baritone/api/Settings.java | 12 +++ src/api/java/baritone/api/utils/Helper.java | 97 ++++++++++++++++--- .../baritone/api/utils/gui/BaritoneToast.java | 86 ++++++++++++++++ 3 files changed, 183 insertions(+), 12 deletions(-) create mode 100644 src/api/java/baritone/api/utils/gui/BaritoneToast.java diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 46e3fbf5c..129c32796 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -529,6 +529,18 @@ public final class Settings { */ public final Setting<Boolean> backfill = new Setting<>(false); + /** + * Shows popup message in the upper right corner, similarly to when you make an advancement + */ + public final Setting<Boolean> logAsToast = new Setting<>(false); + + /** + * The time of how long the message in the pop-up will display + * <p> + * If below 1000L (1sec), it's better to disable this + */ + public final Setting<Long> toastTimer = new Setting<>(5000L); + /** * Print all the debug messages to chat */ diff --git a/src/api/java/baritone/api/utils/Helper.java b/src/api/java/baritone/api/utils/Helper.java index 3cda18343..1fe5b4214 100755 --- a/src/api/java/baritone/api/utils/Helper.java +++ b/src/api/java/baritone/api/utils/Helper.java @@ -18,6 +18,7 @@ package baritone.api.utils; import baritone.api.BaritoneAPI; +import baritone.api.utils.gui.BaritoneToast; import net.minecraft.client.Minecraft; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; @@ -63,6 +64,35 @@ public interface Helper { return prefix; } + /** + * Send a message to display as a toast popup + * + * @param title The title to display in the popup + * @param message The message to display in the popup + */ + default void logToast(ITextComponent title, ITextComponent message) { + BaritoneToast.addOrUpdate(mc.getToastGui(), title, message, BaritoneAPI.getSettings().toastTimer.value); + } + + /** + * Send a message to display as a toast popup + * + * @param title The title to display in the popup + * @param message The message to display in the popup + */ + default void logToast(String title, String message) { + logToast(new TextComponentString(title), new TextComponentString(message)); + } + + /** + * Send a message to display as a toast popup + * + * @param message The message to display in the popup + */ + default void logToast(String message) { + logToast(Helper.getPrefix(), new TextComponentString(message)); + } + /** * Send a message to chat only if chatDebug is on * @@ -74,7 +104,31 @@ public interface Helper { //System.out.println(message); return; } - logDirect(message); + // We won't log debug chat into toasts + // Because only a madman would want that extreme spam -_- + logDirect(message, false); + } + + /** + * Send components to chat with the [Baritone] prefix + * + * @param logAsToast Whether to log as a toast notification + * @param components The components to send + */ + default void logDirect(boolean logAsToast, ITextComponent... components) { + ITextComponent component = new TextComponentString(""); + if (!logAsToast) { + // If we are not logging as a Toast + // Append the prefix to the base component line + component.appendSibling(getPrefix()); + component.appendSibling(new TextComponentString(" ")); + } + Arrays.asList(components).forEach(component::appendSibling); + if (logAsToast) { + logToast(getPrefix(), component); + } else { + mc.addScheduledTask(() -> BaritoneAPI.getSettings().logger.value.accept(component)); + } } /** @@ -83,11 +137,23 @@ public interface Helper { * @param components The components to send */ default void logDirect(ITextComponent... components) { - ITextComponent component = new TextComponentString(""); - component.appendSibling(getPrefix()); - component.appendSibling(new TextComponentString(" ")); - Arrays.asList(components).forEach(component::appendSibling); - Minecraft.getMinecraft().addScheduledTask(() -> BaritoneAPI.getSettings().logger.value.accept(component)); + logDirect(BaritoneAPI.getSettings().logAsToast.value, components); + } + + /** + * Send a message to chat regardless of chatDebug (should only be used for critically important messages, or as a + * direct response to a chat command) + * + * @param message The message to display in chat + * @param color The color to print that message in + * @param logAsToast Whether to log as a toast notification + */ + default void logDirect(String message, TextFormatting color, boolean logAsToast) { + Stream.of(message.split("\n")).forEach(line -> { + ITextComponent component = new TextComponentString(line.replace("\t", " ")); + component.getStyle().setColor(color); + logDirect(logAsToast, component); + }); } /** @@ -98,11 +164,18 @@ public interface Helper { * @param color The color to print that message in */ default void logDirect(String message, TextFormatting color) { - Stream.of(message.split("\n")).forEach(line -> { - ITextComponent component = new TextComponentString(line.replace("\t", " ")); - component.getStyle().setColor(color); - logDirect(component); - }); + logDirect(message, color, BaritoneAPI.getSettings().logAsToast.value); + } + + /** + * Send a message to chat regardless of chatDebug (should only be used for critically important messages, or as a + * direct response to a chat command) + * + * @param message The message to display in chat + * @param logAsToast Whether to log as a toast notification + */ + default void logDirect(String message, boolean logAsToast) { + logDirect(message, TextFormatting.GRAY, logAsToast); } /** @@ -112,6 +185,6 @@ public interface Helper { * @param message The message to display in chat */ default void logDirect(String message) { - logDirect(message, TextFormatting.GRAY); + logDirect(message, BaritoneAPI.getSettings().logAsToast.value); } } diff --git a/src/api/java/baritone/api/utils/gui/BaritoneToast.java b/src/api/java/baritone/api/utils/gui/BaritoneToast.java new file mode 100644 index 000000000..fa3d77399 --- /dev/null +++ b/src/api/java/baritone/api/utils/gui/BaritoneToast.java @@ -0,0 +1,86 @@ +/* + * This file is part of Baritone. + * + * Baritone is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Baritone is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Baritone. If not, see <https://www.gnu.org/licenses/>. + */ + +package baritone.api.utils.gui; + +import net.minecraft.client.gui.toasts.GuiToast; +import net.minecraft.client.gui.toasts.IToast; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; + +public class BaritoneToast implements IToast +{ + private String title; + private String subtitle; + private long firstDrawTime; + private boolean newDisplay; + private long totalShowTime; + + public BaritoneToast(ITextComponent titleComponent, ITextComponent subtitleComponent, long totalShowTime) + { + this.title = titleComponent.getFormattedText(); + this.subtitle = subtitleComponent == null ? null : subtitleComponent.getFormattedText(); + this.totalShowTime = totalShowTime; + } + + public Visibility draw(GuiToast toastGui, long delta) + { + if (this.newDisplay) + { + this.firstDrawTime = delta; + this.newDisplay = false; + } + + toastGui.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("textures/gui/toasts.png")); + GlStateManager.color(1.0F, 1.0F, 1.0F, 255.0f); + toastGui.drawTexturedModalRect(0, 0, 0, 32, 160, 32); + + if (this.subtitle == null) + { + toastGui.getMinecraft().fontRenderer.drawString(this.title, 18, 12, -11534256); + } + else + { + toastGui.getMinecraft().fontRenderer.drawString(this.title, 18, 7, -11534256); + toastGui.getMinecraft().fontRenderer.drawString(this.subtitle, 18, 18, -16777216); + } + + return delta - this.firstDrawTime < totalShowTime ? Visibility.SHOW : Visibility.HIDE; + } + + public void setDisplayedText(ITextComponent titleComponent, ITextComponent subtitleComponent) + { + this.title = titleComponent.getFormattedText(); + this.subtitle = subtitleComponent == null ? null : subtitleComponent.getFormattedText(); + this.newDisplay = true; + } + + public static void addOrUpdate(GuiToast toast, ITextComponent title, ITextComponent subtitle, long totalShowTime) + { + BaritoneToast baritonetoast = toast.getToast(BaritoneToast.class, new Object()); + + if (baritonetoast == null) + { + toast.add(new BaritoneToast(title, subtitle, totalShowTime)); + } + else + { + baritonetoast.setDisplayedText(title, subtitle); + } + } +} From 918f009e8a02fcfa1edbf0cda360429da6f62083 Mon Sep 17 00:00:00 2001 From: CDAGaming <cstack2011@yahoo.com> Date: Mon, 12 Oct 2020 12:52:05 -0500 Subject: [PATCH 68/84] =?UTF-8?q?=F0=9F=90=9B=20Fix=20a=20Rendering=20Conf?= =?UTF-8?q?lict=20with=20some=20other=20Mods?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In testing within Fabritone, it was found that these two lines (Which were previously used for an unknown optifine workaround) are no longer needed, and had no known side effects as of writing. This can be backported as needed, but details are unknown how far this can go down Future me PS: This PR is a superseed of my last one, erased during repo refactors, so now it lives on master branch. Testing recommended and can be up-ported/down-ported as you wish. --- src/main/java/baritone/utils/IRenderer.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/baritone/utils/IRenderer.java b/src/main/java/baritone/utils/IRenderer.java index 0078f2276..e5a5ee907 100644 --- a/src/main/java/baritone/utils/IRenderer.java +++ b/src/main/java/baritone/utils/IRenderer.java @@ -45,7 +45,6 @@ public interface IRenderer { static void startLines(Color color, float alpha, float lineWidth, boolean ignoreDepth) { GlStateManager.enableBlend(); - GlStateManager.disableLighting(); GlStateManager.tryBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO); glColor(color, alpha); GlStateManager.glLineWidth(lineWidth); @@ -68,7 +67,6 @@ public interface IRenderer { GlStateManager.depthMask(true); GlStateManager.enableTexture2D(); - GlStateManager.enableLighting(); GlStateManager.disableBlend(); } From d2c625e1c9bf710c15007a31f5b32437026b8a6a Mon Sep 17 00:00:00 2001 From: CDAGaming <cstack2011@yahoo.com> Date: Wed, 14 Oct 2020 13:14:23 -0500 Subject: [PATCH 69/84] Apply Review Comments --- src/api/java/baritone/api/utils/Helper.java | 2 +- .../baritone/api/utils/gui/BaritoneToast.java | 32 ++++++------------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/src/api/java/baritone/api/utils/Helper.java b/src/api/java/baritone/api/utils/Helper.java index 1fe5b4214..324efbefe 100755 --- a/src/api/java/baritone/api/utils/Helper.java +++ b/src/api/java/baritone/api/utils/Helper.java @@ -71,7 +71,7 @@ public interface Helper { * @param message The message to display in the popup */ default void logToast(ITextComponent title, ITextComponent message) { - BaritoneToast.addOrUpdate(mc.getToastGui(), title, message, BaritoneAPI.getSettings().toastTimer.value); + mc.addScheduledTask(() -> BaritoneToast.addOrUpdate(mc.getToastGui(), title, message, BaritoneAPI.getSettings().toastTimer.value)); } /** diff --git a/src/api/java/baritone/api/utils/gui/BaritoneToast.java b/src/api/java/baritone/api/utils/gui/BaritoneToast.java index fa3d77399..82df67413 100644 --- a/src/api/java/baritone/api/utils/gui/BaritoneToast.java +++ b/src/api/java/baritone/api/utils/gui/BaritoneToast.java @@ -23,25 +23,21 @@ import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; -public class BaritoneToast implements IToast -{ +public class BaritoneToast implements IToast { private String title; private String subtitle; private long firstDrawTime; private boolean newDisplay; private long totalShowTime; - public BaritoneToast(ITextComponent titleComponent, ITextComponent subtitleComponent, long totalShowTime) - { + public BaritoneToast(ITextComponent titleComponent, ITextComponent subtitleComponent, long totalShowTime) { this.title = titleComponent.getFormattedText(); this.subtitle = subtitleComponent == null ? null : subtitleComponent.getFormattedText(); this.totalShowTime = totalShowTime; } - public Visibility draw(GuiToast toastGui, long delta) - { - if (this.newDisplay) - { + public Visibility draw(GuiToast toastGui, long delta) { + if (this.newDisplay) { this.firstDrawTime = delta; this.newDisplay = false; } @@ -50,12 +46,9 @@ public class BaritoneToast implements IToast GlStateManager.color(1.0F, 1.0F, 1.0F, 255.0f); toastGui.drawTexturedModalRect(0, 0, 0, 32, 160, 32); - if (this.subtitle == null) - { + if (this.subtitle == null) { toastGui.getMinecraft().fontRenderer.drawString(this.title, 18, 12, -11534256); - } - else - { + } else { toastGui.getMinecraft().fontRenderer.drawString(this.title, 18, 7, -11534256); toastGui.getMinecraft().fontRenderer.drawString(this.subtitle, 18, 18, -16777216); } @@ -63,23 +56,18 @@ public class BaritoneToast implements IToast return delta - this.firstDrawTime < totalShowTime ? Visibility.SHOW : Visibility.HIDE; } - public void setDisplayedText(ITextComponent titleComponent, ITextComponent subtitleComponent) - { + public void setDisplayedText(ITextComponent titleComponent, ITextComponent subtitleComponent) { this.title = titleComponent.getFormattedText(); this.subtitle = subtitleComponent == null ? null : subtitleComponent.getFormattedText(); this.newDisplay = true; } - public static void addOrUpdate(GuiToast toast, ITextComponent title, ITextComponent subtitle, long totalShowTime) - { + public static void addOrUpdate(GuiToast toast, ITextComponent title, ITextComponent subtitle, long totalShowTime) { BaritoneToast baritonetoast = toast.getToast(BaritoneToast.class, new Object()); - if (baritonetoast == null) - { + if (baritonetoast == null) { toast.add(new BaritoneToast(title, subtitle, totalShowTime)); - } - else - { + } else { baritonetoast.setDisplayedText(title, subtitle); } } From 39cfebeb344c321eae105b4dff8e460a7c9c2ace Mon Sep 17 00:00:00 2001 From: scorbett123 <sam@corbettchocolates.com> Date: Wed, 14 Oct 2020 19:56:09 +0100 Subject: [PATCH 70/84] fix formatting Signed-off-by: scorbett123 <sam@corbettchocolates.com> --- .../java/baritone/pathing/movement/MovementHelper.java | 4 ++-- src/main/java/baritone/process/MineProcess.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index df8218e86..8caa382bc 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -562,9 +562,9 @@ public interface MovementHelper extends ActionCosts, Helper { enum PlaceResult { READY_TO_PLACE, ATTEMPTING, NO_OPTION; } - public static boolean isTransparent(Block b) { + static boolean isTransparent(Block b) { - return b== Blocks.AIR || + return b == Blocks.AIR || b == Blocks.FLOWING_LAVA || b == Blocks.FLOWING_WATER || b == Blocks.WATER; diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index 2d51daf9e..b8474e2f3 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -40,7 +40,6 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.Vec3d; import java.util.*; import java.util.stream.Collectors; @@ -411,10 +410,11 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro .filter(pos -> MineProcess.plausibleToBreak(ctx, pos)) .filter(pos -> { - if (Baritone.settings().allowOnlyExposedOres.value) + if (Baritone.settings().allowOnlyExposedOres.value) { return isNextToAir(ctx, pos); - else + } else { return true; + } }) .filter(pos -> !blacklist.contains(pos)) @@ -434,7 +434,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro for (int dy = -radius; dy <= radius; dy++) { for (int dz = -radius; dz <= radius; dz++) { if (Math.abs(dx) + Math.abs(dy) + Math.abs(dz) <= radius - && MovementHelper.isTransparent(ctx.getBlock(pos.getX()+dx, pos.getY()+dy, pos.getZ()+dz))) { + && MovementHelper.isTransparent(ctx.getBlock(pos.getX() + dx, pos.getY() + dy, pos.getZ() + dz))) { return true; } } From bfb530e02b7ad72fb660f3b2df02b52e883fbdb4 Mon Sep 17 00:00:00 2001 From: Sam Corbett <sam@corbettchocolates.com> Date: Fri, 16 Oct 2020 17:02:02 +0100 Subject: [PATCH 71/84] add a minimum Y level. Signed-off-by: Sam Corbett <sam@corbettchocolates.com> --- src/api/java/baritone/api/Settings.java | 5 +++++ src/main/java/baritone/process/MineProcess.java | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 86cb75c13..96e4c5790 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -738,6 +738,11 @@ public final class Settings { */ public final Setting<Integer> maxCachedWorldScanCount = new Setting<>(10); + /** + * Sets the minimum y level whilst mining - set to 0 to turn off. + */ + public final Setting<Integer> minYLevelWhileMining = new Setting<>(0); + /** * This will only allow baritone to mine exposed ores, can be used to stop ore obfuscators on servers that use them. */ diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index b8474e2f3..5bce121d8 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -417,6 +417,8 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro } }) + .filter(pos -> pos.getY() > Baritone.settings().minYLevelWhileMining.value) + .filter(pos -> !blacklist.contains(pos)) .sorted(Comparator.comparingDouble(ctx.getBaritone().getPlayerContext().player()::getDistanceSq)) From 7032efcc05fe2280f57208129af4d37cef9ec68c Mon Sep 17 00:00:00 2001 From: GameCenterJerry <61768561+GameCenterJerry@users.noreply.github.com> Date: Thu, 22 Oct 2020 13:09:56 +1100 Subject: [PATCH 72/84] added jdk 8 instructions for macOS added necessary commands and download links --- SETUP.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/SETUP.md b/SETUP.md index ff16acbb9..ad1f3316f 100644 --- a/SETUP.md +++ b/SETUP.md @@ -49,6 +49,27 @@ On Mac OSX and Linux, use `./gradlew` instead of `gradlew`. If you have errors with a package missing please make sure you have setup your environment, and are using Oracle JDK 8. +To check which java you are using do +`java -version` in a command prompt or terminal. +If you are using Oracle JDK 8+ it will not work because the Java distributions above JDK 8 using may not have the needed javax classes. + +Oracle JDK 8 download: https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html +#### macOS guide +In order to get JDK 8, run the following command: +`% /usr/libexec/java_home -V` +If you see something like + +`% 1.8.0_202, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home` + +in the list then you've got JDK 8 installed. +In order to get JDK 8 running in the **current terminal window** you will have to run this command: + +`% export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)` + +You will have to compile the file in the same terminal window. + +#### Windows 10 guide (currently working on it) + Setting up the Environment: ``` From 07704b3ec7876cbf2704f44f65d9c4cac2699b71 Mon Sep 17 00:00:00 2001 From: GameCenterJerry <61768561+GameCenterJerry@users.noreply.github.com> Date: Thu, 22 Oct 2020 13:14:53 +1100 Subject: [PATCH 73/84] Update SETUP.md --- SETUP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SETUP.md b/SETUP.md index ad1f3316f..b23798a39 100644 --- a/SETUP.md +++ b/SETUP.md @@ -53,7 +53,7 @@ To check which java you are using do `java -version` in a command prompt or terminal. If you are using Oracle JDK 8+ it will not work because the Java distributions above JDK 8 using may not have the needed javax classes. -Oracle JDK 8 download: https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html +Open JDK 8 download: https://openjdk.java.net/install/ #### macOS guide In order to get JDK 8, run the following command: `% /usr/libexec/java_home -V` From cafb810a1f54cb30e7ca0e097824cf21bee7a23d Mon Sep 17 00:00:00 2001 From: GameCenterJerry <61768561+GameCenterJerry@users.noreply.github.com> Date: Thu, 22 Oct 2020 13:28:18 +1100 Subject: [PATCH 74/84] Update SETUP.md --- SETUP.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/SETUP.md b/SETUP.md index b23798a39..5e41432b1 100644 --- a/SETUP.md +++ b/SETUP.md @@ -51,23 +51,24 @@ If you have errors with a package missing please make sure you have setup your e To check which java you are using do `java -version` in a command prompt or terminal. -If you are using Oracle JDK 8+ it will not work because the Java distributions above JDK 8 using may not have the needed javax classes. +If you are using OpenJDK 8+ it will not work because the Java distributions above JDK 8 using may not have the needed javax classes. Open JDK 8 download: https://openjdk.java.net/install/ #### macOS guide -In order to get JDK 8, run the following command: +In order to get JDK 8, Try running the following command: `% /usr/libexec/java_home -V` +If it doesn't work try this guide: https://stackoverflow.com/questions/46513639/how-to-downgrade-java-from-9-to-8-on-a-macos-eclipse-is-not-running-with-java-9 + If you see something like -`% 1.8.0_202, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home` +`% 1.8.0_VERSION, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_VERSION.jdk/Contents/Home` in the list then you've got JDK 8 installed. In order to get JDK 8 running in the **current terminal window** you will have to run this command: `% export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)` -You will have to compile the file in the same terminal window. - +To add OpenJDK 8 to your PATH try this guide: http://www.sajeconsultants.com/how-to-set-java_home-on-mac-os-x/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-set-java_home-on-mac-os-x. If you're using bash change the .bachrc and if you're using zsh change the .zshrc #### Windows 10 guide (currently working on it) Setting up the Environment: From 0bfd0bca0cd26e11dd45871480be9ead42a9ca01 Mon Sep 17 00:00:00 2001 From: GameCenterJerry <61768561+GameCenterJerry@users.noreply.github.com> Date: Thu, 22 Oct 2020 13:47:50 +1100 Subject: [PATCH 75/84] Update SETUP.md --- SETUP.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SETUP.md b/SETUP.md index 5e41432b1..c09ad3682 100644 --- a/SETUP.md +++ b/SETUP.md @@ -68,7 +68,7 @@ In order to get JDK 8 running in the **current terminal window** you will have t `% export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)` -To add OpenJDK 8 to your PATH try this guide: http://www.sajeconsultants.com/how-to-set-java_home-on-mac-os-x/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-set-java_home-on-mac-os-x. If you're using bash change the .bachrc and if you're using zsh change the .zshrc +To add OpenJDK 8 to your PATH add the export line to the end of your `.zshrc / .bashrc` if you want it to apply to each new terminal. If you're using bash change the .bachrc and if you're using zsh change the .zshrc #### Windows 10 guide (currently working on it) Setting up the Environment: From 14b75973b03735338d0644d07568423e5748feb8 Mon Sep 17 00:00:00 2001 From: GameCenterJerry <61768561+GameCenterJerry@users.noreply.github.com> Date: Thu, 22 Oct 2020 15:02:17 +1100 Subject: [PATCH 76/84] Update SETUP.md --- SETUP.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SETUP.md b/SETUP.md index c09ad3682..9d581aeed 100644 --- a/SETUP.md +++ b/SETUP.md @@ -51,7 +51,7 @@ If you have errors with a package missing please make sure you have setup your e To check which java you are using do `java -version` in a command prompt or terminal. -If you are using OpenJDK 8+ it will not work because the Java distributions above JDK 8 using may not have the needed javax classes. +If you are using anything above OpenJDK 8, it might not work because the Java distributions above JDK 8 using may not have the needed javax classes. Open JDK 8 download: https://openjdk.java.net/install/ #### macOS guide @@ -69,7 +69,6 @@ In order to get JDK 8 running in the **current terminal window** you will have t `% export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)` To add OpenJDK 8 to your PATH add the export line to the end of your `.zshrc / .bashrc` if you want it to apply to each new terminal. If you're using bash change the .bachrc and if you're using zsh change the .zshrc -#### Windows 10 guide (currently working on it) Setting up the Environment: From 9ca95e8e14ff76dd704b1cd138a61bbd7d0f8c98 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Wed, 28 Oct 2020 01:19:20 +0100 Subject: [PATCH 77/84] don't make non-forge jars valid mods (fixes #2124) --- build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.gradle b/build.gradle index a91926ddb..0f9805469 100755 --- a/build.gradle +++ b/build.gradle @@ -117,6 +117,12 @@ javadoc { jar { from sourceSets.launch.output, sourceSets.api.output + + if (!getProject().hasProperty("baritone.forge_build")) { + exclude "**/BaritoneForgeModXD.class" + exclude "**/mods.toml" + } + preserveFileTimestamps = false reproducibleFileOrder = true From 320a5d64a3347a45b7b20055c16224506337331d Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Fri, 30 Oct 2020 22:39:30 -0700 Subject: [PATCH 78/84] well i guess technically there could be an ore at bedrock level lmao --- src/main/java/baritone/process/MineProcess.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index 5bce121d8..ea35fd566 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -417,7 +417,7 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro } }) - .filter(pos -> pos.getY() > Baritone.settings().minYLevelWhileMining.value) + .filter(pos -> pos.getY() >= Baritone.settings().minYLevelWhileMining.value) .filter(pos -> !blacklist.contains(pos)) From c491d679252887e2d5153a6acfc3751c28419a8d Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Wed, 11 Nov 2020 17:53:11 -0800 Subject: [PATCH 79/84] add setting to just skip layers that the builder fails to construct --- src/api/java/baritone/api/Settings.java | 5 +++++ src/main/java/baritone/process/BuilderProcess.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 96e4c5790..69b7e5527 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -814,6 +814,11 @@ public final class Settings { */ public final Setting<Integer> startAtLayer = new Setting<>(0); + /** + * If a layer is unable to be constructed, just skip it. + */ + public final Setting<Boolean> skipFailedLayers = new Setting<>(false); + /** * How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely */ diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index e0dbe4c7c..00d3831ce 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -484,6 +484,11 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil if (goal == null) { goal = assemble(bcc, approxPlaceable); // we're far away, so assume that we have our whole inventory to recalculate placeable properly if (goal == null) { + if (Baritone.settings().skipFailedLayers.value && Baritone.settings().buildInLayers.value && layer < realSchematic.heightY()) { + logDirect("Skipping layer that I cannot construct! Layer #" + layer); + layer++; + return onTick(calcFailed, isSafeToCancel); + } logDirect("Unable to do it. Pausing. resume to resume, cancel to cancel"); paused = true; return new PathingCommand(null, PathingCommandType.REQUEST_PAUSE); From a99206b6c206f9cc4a62b31cec0977fc273d2902 Mon Sep 17 00:00:00 2001 From: unrootexe <37210633+unrootexe@users.noreply.github.com> Date: Mon, 16 Nov 2020 17:18:32 +0000 Subject: [PATCH 80/84] Update rootNET's supported version rootNET supports the latest version of Baritone, this change reflects that --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 803816090..f95d37cca 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ [![KAMI Blue integration](https://img.shields.io/badge/KAMI%20Blue%20integration-v1.2.14--master-green)](https://github.com/kami-blue/client) [![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%20integration-v1.3.4%20/%20v1.4.1-green.svg)](https://gitlab.com/emc-mods-indrit/baritone_api) -[![rootNET integration](https://img.shields.io/badge/rootNET%20integration-v1.2.11-green.svg)](https://rootnet.dev/) +[![rootNET integration](https://img.shields.io/badge/rootNET%20integration-v1.2.14-green.svg)](https://rootnet.dev/) [![Future integration](https://img.shields.io/badge/Future%20integration-v1.2.12%20%2F%20v1.3.6%20%2F%20v1.4.4-red)](https://futureclient.net/) [![RusherHack integration](https://img.shields.io/badge/RusherHack%20integration-v1.2.14-green)](https://rusherhack.org/) [![forthebadge](https://forthebadge.com/images/badges/built-with-swag.svg)](http://forthebadge.com/) From 16cfcb36a3cf7ce4063740498cf45efcd6f1c463 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Sun, 29 Nov 2020 20:04:44 -0800 Subject: [PATCH 81/84] Update USAGE.md --- USAGE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/USAGE.md b/USAGE.md index b58744284..813746d75 100644 --- a/USAGE.md +++ b/USAGE.md @@ -41,7 +41,7 @@ Some common examples: - `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 iron_ore` to mine diamond ore or iron 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.) An amount of blocks can also be specified, for example, `mine diamond_ore 64`. -- `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. +- `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 select an area (`#help sel` to see what you can do with that selection). - `follow player playerName` to follow a player. `follow players` to follow any players in range (combine with Kill Aura for a fun time). `follow entities` to follow any entities. `follow entity pig` to follow entities of a specific type. - `wp` for waypoints. A "tag" is like "home" (created automatically on right clicking a bed) or "death" (created automatically on death) or "user" (has to be created manually). So you might want `#wp save user coolbiome`, then to set the goal `#wp goal coolbiome` then `#path` to path to it. For death, `#wp goal death` will list waypoints under the "death" tag (remember stuff is clickable!) - `build` to build a schematic. `build blah.schematic` will load `schematics/blah.schematic` and build it with the origin being your player feet. `build blah.schematic 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). From dc70d810c96af5554992a31ecea4e029ae146986 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Thu, 24 Dec 2020 21:33:11 -0800 Subject: [PATCH 82/84] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f95d37cca..5ef290188 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,8 @@ The easiest way to install Baritone is to install [Impact](https://impactclient. For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see description. If you need Forge 1.15.2, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.5.3), follow the instructions, and get the `api-forge` jar. +For 1.16.4, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see description. If you need Forge 1.14.4, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.6.2) and get the `api-forge` jar. + 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 through 1.15.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 b6265036d4fb8a251d16ee93937da9e81bec4d95 Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Thu, 24 Dec 2020 21:33:29 -0800 Subject: [PATCH 83/84] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5ef290188..29e9e5fa3 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ The easiest way to install Baritone is to install [Impact](https://impactclient. For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see description. If you need Forge 1.15.2, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.5.3), follow the instructions, and get the `api-forge` jar. -For 1.16.4, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see description. If you need Forge 1.14.4, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.6.2) and get the `api-forge` jar. +For 1.16.4, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see description. If you need Forge 1.16.4, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.6.2) and get the `api-forge` jar. 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 through 1.15.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 72cf9392b16884005ffc2d83c68dacc39832723c Mon Sep 17 00:00:00 2001 From: Leijurv <leijurv@gmail.com> Date: Thu, 24 Dec 2020 21:34:02 -0800 Subject: [PATCH 84/84] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 29e9e5fa3..f709a3d81 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ [![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/) [![Minecraft](https://img.shields.io/badge/MC-1.15.2-brightgreen.svg)](https://github.com/cabaletta/baritone/tree/1.15.2/) +[![Minecraft](https://img.shields.io/badge/MC-1.16.4-brightgreen.svg)](https://github.com/cabaletta/baritone/tree/1.16.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/) @@ -42,7 +43,7 @@ For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see de For 1.16.4, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see description. If you need Forge 1.16.4, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.6.2) and get the `api-forge` jar. 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 through 1.15.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). +the original version of the bot for Minecraft 1.8.9, rebuilt for 1.12.2 through 1.16.4. 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 from Aug 1, 2018, to Aug 1, 2019.