From 21534d1c0bafb5d27dadb97ae1144a54e9a2d19f Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Thu, 18 Nov 2021 00:21:12 +0100 Subject: [PATCH 01/36] Fix chat error messages being obfuscated for block type arguments --- scripts/proguard.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/proguard.pro b/scripts/proguard.pro index 9adc5174c..6f797771f 100644 --- a/scripts/proguard.pro +++ b/scripts/proguard.pro @@ -22,6 +22,7 @@ -keep class baritone.api.IBaritoneProvider -keep class baritone.api.utils.MyChunkPos { *; } # even in standalone we need to keep this for gson reflect +-keepname class baritone.api.utils.BlockOptionalMeta # this name is exposed to the user, so we need to keep it in all builds # Keep any class or member annotated with @KeepName so we dont have to put everything in the script -keep,allowobfuscation @interface baritone.KeepName From 74ea803651c2e4d73c813ea38d2c790e26c209e0 Mon Sep 17 00:00:00 2001 From: scorbett123 <50634068+scorbett123@users.noreply.github.com> Date: Wed, 2 Feb 2022 20:33:47 +0000 Subject: [PATCH 02/36] Add world border checks to MovementHelper --- .../java/baritone/pathing/movement/CalculationContext.java | 1 - src/main/java/baritone/pathing/movement/MovementHelper.java | 6 ++++++ src/main/java/baritone/utils/BlockStateInterface.java | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/movement/CalculationContext.java b/src/main/java/baritone/pathing/movement/CalculationContext.java index 124e6f109..fca6bc990 100644 --- a/src/main/java/baritone/pathing/movement/CalculationContext.java +++ b/src/main/java/baritone/pathing/movement/CalculationContext.java @@ -143,7 +143,6 @@ public class CalculationContext { return COST_INF; } if (!worldBorder.canPlaceAt(x, z)) { - // TODO perhaps MovementHelper.canPlaceAgainst could also use this? return COST_INF; } return placeBlockCost; diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index f5f565e39..23c261446 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -49,6 +49,9 @@ import static baritone.pathing.movement.Movement.HORIZONTALS_BUT_ALSO_DOWN_____S public interface MovementHelper extends ActionCosts, Helper { static boolean avoidBreaking(BlockStateInterface bsi, int x, int y, int z, IBlockState state) { + if (!bsi.worldBorder.canPlaceAt(x, y)) { + return false; + } Block b = state.getBlock(); return Baritone.settings().blocksToDisallowBreaking.value.contains(b) || b == Blocks.ICE // ice becomes water, and water can mess up the path @@ -368,6 +371,9 @@ public interface MovementHelper extends ActionCosts, Helper { } static boolean canPlaceAgainst(BlockStateInterface bsi, int x, int y, int z, IBlockState state) { + if (!bsi.worldBorder.canPlaceAt(x, z)) { + return false; + } // can we look at the center of a side face of this block and likely be able to place? // (thats how this check is used) // therefore dont include weird things that we technically could place against (like carpet) but practically can't diff --git a/src/main/java/baritone/utils/BlockStateInterface.java b/src/main/java/baritone/utils/BlockStateInterface.java index 4f5f26899..f451c2f1d 100644 --- a/src/main/java/baritone/utils/BlockStateInterface.java +++ b/src/main/java/baritone/utils/BlockStateInterface.java @@ -22,6 +22,7 @@ import baritone.api.utils.IPlayerContext; import baritone.cache.CachedRegion; import baritone.cache.WorldData; import baritone.utils.accessor.IChunkProviderClient; +import baritone.utils.pathing.BetterWorldBorder; import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import net.minecraft.block.Block; @@ -46,6 +47,7 @@ public class BlockStateInterface { protected final IBlockAccess world; public final BlockPos.MutableBlockPos isPassableBlockPos; public final IBlockAccess access; + public final BetterWorldBorder worldBorder; private Chunk prev = null; private CachedRegion prevCached = null; @@ -64,6 +66,7 @@ public class BlockStateInterface { public BlockStateInterface(World world, WorldData worldData, boolean copyLoadedChunks) { this.world = world; + this.worldBorder = new BetterWorldBorder(world.getWorldBorder()); this.worldData = worldData; Long2ObjectMap worldLoaded = ((IChunkProviderClient) world.getChunkProvider()).loadedChunks(); if (copyLoadedChunks) { From 2d0f10c79fe4441d40bdefbc54a599037e543e5b Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 2 Feb 2022 15:53:09 -0800 Subject: [PATCH 03/36] link to branches --- README.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 86aab720b..eec452ba4 100644 --- a/README.md +++ b/README.md @@ -4,13 +4,13 @@

- Minecraft - Minecraft - Minecraft - Minecraft - Minecraft - Minecraft - Minecraft + Minecraft + Minecraft + Minecraft + Minecraft + Minecraft + Minecraft + Minecraft

From 25de3324920fa375dad903f9386eabe496d291a6 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 2 Feb 2022 15:53:43 -0800 Subject: [PATCH 04/36] mfw this also needs to be in master --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 84a7e4319..d4c25ad90 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ baritone_Client.launch # Copyright Files !/.idea/copyright/Baritone.xml !/.idea/copyright/profiles_settings.xml + +.vscode/launch.json + From e0a53144db0889eb9d279ce248b7a279600ccc8c Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 2 Feb 2022 16:10:14 -0800 Subject: [PATCH 05/36] bump most recent jars --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eec452ba4..381e3f126 100644 --- a/README.md +++ b/README.md @@ -58,9 +58,9 @@ For 1.15.2, [click here](https://www.youtube.com/watch?v=j1qKtCZFURM) and see de For 1.16.5, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see description. If you need Forge or Fabric 1.16.5, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.6.3) and get the `api-forge` or `api-fabric` jar. **For 1.16.5 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.6.3/baritone-api-fabric-1.6.3.jar)**. -If you need Forge or Fabric 1.17.1, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.7.1) and get the `api-forge` or `api-fabric` jar. **For 1.17.1 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.7.1/baritone-api-fabric-1.7.1.jar)**. +If you need Forge or Fabric 1.17.1, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.7.2) and get the `api-forge` or `api-fabric` jar. **For 1.17.1 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.7.2/baritone-api-fabric-1.7.2.jar)**. -If you need Forge or Fabric 1.18.1, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.8.1) and get the `api-forge` or `api-fabric` jar. **For 1.18.1 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.8.1/baritone-api-fabric-1.8.1.jar)**. +If you need Forge or Fabric 1.18.1, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.8.2) and get the `api-forge` or `api-fabric` jar. **For 1.18.1 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.8.2/baritone-api-fabric-1.8.2.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 onwards. 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 9b70ace1807baef93782bc34cfb37ab01359e091 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Wed, 2 Feb 2022 22:04:15 -0700 Subject: [PATCH 06/36] fix getting stuck on cauldrons (fixes #3099) --- src/main/java/baritone/pathing/movement/MovementHelper.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/baritone/pathing/movement/MovementHelper.java b/src/main/java/baritone/pathing/movement/MovementHelper.java index f5f565e39..48ebd3c28 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -134,7 +134,9 @@ public interface MovementHelper extends ActionCosts, Helper { } return block == Blocks.WATER || block == Blocks.FLOWING_WATER; } - + if (block instanceof BlockCauldron) { + return false; + } return block.isPassable(bsi.access, bsi.isPassableBlockPos.setPos(x, y, z)); } From 49357790f1e48186949b82f97d27b842e5ffd3e9 Mon Sep 17 00:00:00 2001 From: scorbett123 <50634068+scorbett123@users.noreply.github.com> Date: Thu, 3 Feb 2022 08:06:01 +0000 Subject: [PATCH 07/36] fix world border checks Signed-off-by: scorbett123 <50634068+scorbett123@users.noreply.github.com> --- 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 23c261446..2990b7f20 100644 --- a/src/main/java/baritone/pathing/movement/MovementHelper.java +++ b/src/main/java/baritone/pathing/movement/MovementHelper.java @@ -50,7 +50,7 @@ public interface MovementHelper extends ActionCosts, Helper { static boolean avoidBreaking(BlockStateInterface bsi, int x, int y, int z, IBlockState state) { if (!bsi.worldBorder.canPlaceAt(x, y)) { - return false; + return true; } Block b = state.getBlock(); return Baritone.settings().blocksToDisallowBreaking.value.contains(b) From 7052fe62250c48bf4021857ceb8b44066887dc58 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 7 Feb 2022 22:03:31 -0800 Subject: [PATCH 08/36] put this on its own line --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 381e3f126..b125edf6e 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,9 @@ A Minecraft pathfinder bot. [**Baritone Discord Server**](http://discord.gg/s6fRBAUpmr) -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) +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.15/baritone-api-forge-1.2.15.jar)**. Otherwise, see [Installation & setup](SETUP.md). Once Baritone is installed, look [here](USAGE.md) for instructions on how to use it. From 0ade37f14f8af914c50046a5d681f1ffff3635c0 Mon Sep 17 00:00:00 2001 From: ehylo <1487662ehylo@gmail.com> Date: Tue, 8 Feb 2022 21:13:51 -0800 Subject: [PATCH 09/36] Update Setup and Usage guides Also fix 2 settings that just don't have a description for some reason, and add some information to the find command because that also for some reason did not have anything there. The descriptions I put may not be detailed enough so please let me know if things should change --- README.md | 2 +- SETUP.md | 21 ++++++++++++------- USAGE.md | 16 ++++++++++---- src/api/java/baritone/api/Settings.java | 6 ++++++ .../command/defaults/FindCommand.java | 4 ++-- 5 files changed, 35 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index b125edf6e..7222e4d89 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ jar. Below is an example of basic usage for changing some settings, and then pathing to an X/Z goal. -``` +```java BaritoneAPI.getSettings().allowSprint.value = true; BaritoneAPI.getSettings().primaryTimeoutMS.value = 2000L; diff --git a/SETUP.md b/SETUP.md index 7a43faa62..57866b192 100644 --- a/SETUP.md +++ b/SETUP.md @@ -11,7 +11,7 @@ These releases are not always completely up to date with latest features, and ar Link to the releases page: [Releases](https://github.com/cabaletta/baritone/releases) -v1.2.* is for 1.12.2, v1.3.* is for 1.13.2, v1.4.* is for 1.14.4, v1.5.* is for 1.15.2, v1.6.* is for 1.16.2 or 1.16.4 or 1.16.5 (LOL) +v1.2.* is for 1.12.2, v1.3.* is for 1.13.2, v1.4.* is for 1.14.4, v1.5.* is for 1.15.2, v1.6.* is for 1.16.5, v1.7.* is for 1.17.1, v1.8.* is for 1.18.1 Any official release will be GPG signed by leijurv (44A3EA646EADAC6A). Please verify that the hash of the file you download is in `checksums.txt` and that `checksums_signed.asc` is a valid signature by that public keys of `checksums.txt`. @@ -22,15 +22,16 @@ The build is fully deterministic and reproducible, and you can verify Travis did Building Baritone will result in 5 artifacts created in the ``dist`` directory. These are the same as the artifacts created in the [releases](https://github.com/cabaletta/baritone/releases). -**The Forge release can simply be added as a Forge mod.** +**The Forge and Fabric releases can simply be added as a Forge/Fabric mods.** If another one of your Forge mods has a Baritone integration, you want `baritone-api-forge-VERSION.jar`. Otherwise, you want `baritone-standalone-forge-VERSION.jar` - **API**: Only the non-api packages are obfuscated. This should be used in environments where other mods would like to use Baritone's features. -- **Forge API**: Same as API, but packaged for Forge. This should be used where another mod has a Baritone integration. +- **Forge/Fabric API**: Same as API, but packaged for Forge/Fabric. This should be used where another mod has a Baritone integration. - **Standalone**: Everything is obfuscated. This should be used in environments where there are no other mods present that would like to use Baritone's features. -- **Forge Standalone**: Same as Standalone, but packaged for Forge. This should be used when Baritone is your only Forge mod, or none of your other Forge mods integrate with Baritone. +- **Forge/Fabric Standalone**: Same as Standalone, but packaged for Forge/Fabric. This should be used when Baritone is your only Forge/Fabric mod, or none of your other Forge/Fabric mods integrate with Baritone. - **Unoptimized**: Nothing is obfuscated. This shouldn't be used ever in production. +- **Forge/Fabric Unoptimized**: Same as Unoptimized, but packaged for Forge/Fabric. ## Build it yourself - Clone or download Baritone @@ -42,13 +43,13 @@ If another one of your Forge mods has a Baritone integration, you want `baritone ## Command Line 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. +If you have errors with a package missing please make sure you have setup your environment, and are using Oracle JDK 8 for 1.12.2-1.16.5, JDK 16 for 1.17.1, and JDK 17 for 1.18.1. To check which java you are using do `java -version` in a command prompt or terminal. -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. +If you are using anything above OpenJDK 8 for 1.12.2-1.16.5, 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/ +Open JDK download: https://openjdk.java.net/install/ #### macOS guide In order to get JDK 8, Try running the following command: `% /usr/libexec/java_home -V` @@ -84,6 +85,12 @@ For minecraft 1.15.2+, run the following instead to include the Forge jars: $ gradlew build -Pbaritone.forge_build ``` +Do this instead for Fabric jars: + +``` +$ gradlew build -Pbaritone.fabric_build +``` + Running Baritone: ``` diff --git a/USAGE.md b/USAGE.md index f896ad012..46241e3fe 100644 --- a/USAGE.md +++ b/USAGE.md @@ -32,13 +32,13 @@ Watch this [showcase video](https://youtu.be/CZkLXWo4Fg4)! To toggle a boolean setting, just say its name in chat (for example saying `allowBreak` toggles whether Baritone will consider breaking blocks). For a numeric setting, say its name then the new value (like `primaryTimeoutMS 250`). It's case insensitive. To reset a setting to its default value, say `acceptableThrowawayItems reset`. To reset all settings, say `reset`. To see all settings that have been modified from their default values, say `modified`. -Some common examples: +Commands in Baritone: - `thisway 1000` then `path` to go in the direction you're facing for a thousand blocks - `goal x y z` or `goal x z` or `goal y`, then `path` to set a goal to a certain coordinate then path to it - `goto x y z` or `goto x z` or `goto y` to go to a certain coordinate (in a single step, starts going immediately) - `goal` to set the goal to your player's feet - `goal clear` to clear the goal -- `cancel` or `stop` to stop everything +- `cancel` or `stop` to stop everything, `forcecancel` is also an option - `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 64 diamond_ore`. - `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). @@ -51,11 +51,19 @@ Some common examples: - `axis` to go to an axis or diagonal axis at y=120 (`axisHeight` is a configurable setting, defaults to 120). - `explore x z` to explore the world from the origin of x,z. Leave out x and z to default to player feet. This will continually path towards the closest chunk to the origin that it's never seen before. `explorefilter filter.json` with optional invert can be used to load in a list of chunks to load. - `invert` to invert the current goal and path. This gets as far away from it as possible, instead of as close as possible. For example, do `goal` then `invert` to run as far as possible from where you're standing at the start. +- `come` tells Baritone to head towards your camera, useful when freecam doesn't move your player position. +- `blacklist` will stop baritone from going to the closest block so it won't attempt to get to it. +- `eta` to get information about the estimated time until the next segment and the goal, be aware that the ETA to your goal is really unprecise. +- `proc` to view miscellaneous information about the process currently controlling Baritone. +- `repack` to re-cache the chunks around you. +- `gc` to call `System.gc()` which may free up some memory. +- `render` to fix glitched chunk rendering without having to reload all of them. +- `reloadall` to reload Baritone's world cache or `saveall` to save Baritone's world cache. +- `find` to search through Baritone's cache and attempt to find the location of the block. +- `surface` or `top` to tell Baritone to head towards the closest surface-like area, this can be the surface or highest available air space. - `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://baritone.leijurv.com/baritone/api/Settings.html). - All the settings and documentation are here. If you find HTML easier to read than Javadoc, you can look here. There are about a hundred settings, but here are some fun / interesting / important ones that you might want to look at changing in normal usage of Baritone. The documentation for each can be found at the above links. diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index c3ea4225a..b0eda7489 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -385,6 +385,9 @@ public final class Settings { */ public final Setting mobSpawnerAvoidanceCoefficient = new Setting<>(2.0); + /** + * Distance to avoid mob spawners. + */ public final Setting mobSpawnerAvoidanceRadius = new Setting<>(16); /** @@ -394,6 +397,9 @@ public final class Settings { */ public final Setting mobAvoidanceCoefficient = new Setting<>(1.5); + /** + * Distance to avoid mobs. + */ public final Setting mobAvoidanceRadius = new Setting<>(8); /** diff --git a/src/main/java/baritone/command/defaults/FindCommand.java b/src/main/java/baritone/command/defaults/FindCommand.java index 22e6815be..65eb9b5c3 100644 --- a/src/main/java/baritone/command/defaults/FindCommand.java +++ b/src/main/java/baritone/command/defaults/FindCommand.java @@ -71,10 +71,10 @@ public class FindCommand extends Command { @Override public List getLongDesc() { return Arrays.asList( - "", + "The find command searches through Baritone's cache and attempts to find the location of the block.", "", "Usage:", - "> " + "> find - Find positions of a certain block" ); } } From dc6c87b58de8fad7dd86fe3951fd207833083000 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Mon, 7 Mar 2022 15:50:42 -0700 Subject: [PATCH 10/36] fix modded toolmaterials --- .../baritone/launch/mixins/MixinItemTool.java | 35 +++++++++++++++++++ src/launch/resources/mixins.baritone.json | 1 + src/main/java/baritone/utils/ToolSet.java | 8 +++-- .../baritone/utils/accessor/IItemTool.java | 24 +++++++++++++ 4 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 src/launch/java/baritone/launch/mixins/MixinItemTool.java create mode 100644 src/main/java/baritone/utils/accessor/IItemTool.java diff --git a/src/launch/java/baritone/launch/mixins/MixinItemTool.java b/src/launch/java/baritone/launch/mixins/MixinItemTool.java new file mode 100644 index 000000000..4f5d025bf --- /dev/null +++ b/src/launch/java/baritone/launch/mixins/MixinItemTool.java @@ -0,0 +1,35 @@ +/* + * 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 . + */ + +package baritone.launch.mixins; + +import baritone.utils.accessor.IItemTool; +import net.minecraft.item.Item; +import net.minecraft.item.ItemTool; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; + +@Mixin(ItemTool.class) +public class MixinItemTool implements IItemTool { + @Shadow protected Item.ToolMaterial toolMaterial; + + @Override + public int getHarvestLevel() { + return toolMaterial.getHarvestLevel(); + } + +} diff --git a/src/launch/resources/mixins.baritone.json b/src/launch/resources/mixins.baritone.json index eb31a2e76..fdcd14b92 100644 --- a/src/launch/resources/mixins.baritone.json +++ b/src/launch/resources/mixins.baritone.json @@ -21,6 +21,7 @@ "MixinEntityRenderer", "MixinGuiScreen", "MixinItemStack", + "MixinItemTool", "MixinMinecraft", "MixinNetHandlerPlayClient", "MixinNetworkManager", diff --git a/src/main/java/baritone/utils/ToolSet.java b/src/main/java/baritone/utils/ToolSet.java index 4d17b4ea1..0ad4665d6 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.utils.accessor.IItemTool; import net.minecraft.block.Block; import net.minecraft.block.state.IBlockState; import net.minecraft.client.entity.EntityPlayerSP; @@ -78,15 +79,16 @@ public class ToolSet { /** * Evaluate the material cost of a possible tool. The priority matches the - * listed order in the Item.ToolMaterial enum. + * harvest level order; there is a chance for multiple at the same with modded tools + * but in that case we don't really care. * * @param itemStack a possibly empty ItemStack - * @return values range from -1 to 4 + * @return values from 0 up */ private int getMaterialCost(ItemStack itemStack) { if (itemStack.getItem() instanceof ItemTool) { ItemTool tool = (ItemTool) itemStack.getItem(); - return ToolMaterial.valueOf(tool.getToolMaterialName()).ordinal(); + return ((IItemTool) tool).getHarvestLevel(); } else { return -1; } diff --git a/src/main/java/baritone/utils/accessor/IItemTool.java b/src/main/java/baritone/utils/accessor/IItemTool.java new file mode 100644 index 000000000..990cb672b --- /dev/null +++ b/src/main/java/baritone/utils/accessor/IItemTool.java @@ -0,0 +1,24 @@ +/* + * 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 . + */ + +package baritone.utils.accessor; + +public interface IItemTool { + + int getHarvestLevel(); + +} From 8aba97b577f49992894ec4a933be4587a7b00aa5 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 8 Mar 2022 15:00:14 -0800 Subject: [PATCH 11/36] update for 1.8.3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7222e4d89..e2acc7d83 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ For 1.16.5, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see de If you need Forge or Fabric 1.17.1, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.7.2) and get the `api-forge` or `api-fabric` jar. **For 1.17.1 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.7.2/baritone-api-fabric-1.7.2.jar)**. -If you need Forge or Fabric 1.18.1, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.8.2) and get the `api-forge` or `api-fabric` jar. **For 1.18.1 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.8.2/baritone-api-fabric-1.8.2.jar)**. +If you need Forge or Fabric 1.18.2, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.8.3) and get the `api-forge` or `api-fabric` jar. **For 1.18.2 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.8.3/baritone-api-fabric-1.8.3.jar)**. **For 1.18.2 Forge, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.8.3/baritone-api-forge-1.8.3.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 onwards. 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 10430f8142374153f5f443b140b191f92874f5ce Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 8 Mar 2022 15:01:48 -0800 Subject: [PATCH 12/36] bump to 1.18.2 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e2acc7d83..2687c2291 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Minecraft Minecraft Minecraft - Minecraft + Minecraft

From 25d418e96bf854d597d68dbdc00b64f827f4ffa3 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 8 Mar 2022 15:04:34 -0800 Subject: [PATCH 13/36] 1.15 is deprecated --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index 2687c2291..75c04553d 100644 --- a/README.md +++ b/README.md @@ -56,8 +56,6 @@ Baritone is the pathfinding system used in [Impact](https://impactclient.net/) s 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.15/baritone-api-forge-1.2.15.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. - For 1.16.5, [click here](https://www.youtube.com/watch?v=_4eVJ9Qz2J8) and see description. If you need Forge or Fabric 1.16.5, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.6.3) and get the `api-forge` or `api-fabric` jar. **For 1.16.5 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.6.3/baritone-api-fabric-1.6.3.jar)**. If you need Forge or Fabric 1.17.1, look [here](https://github.com/cabaletta/baritone/releases/tag/v1.7.2) and get the `api-forge` or `api-fabric` jar. **For 1.17.1 Fabric, just click [here](https://github.com/cabaletta/baritone/releases/download/v1.7.2/baritone-api-fabric-1.7.2.jar)**. From 02711a73ed6db6ee22c4943efc77cc7222ed30ed Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 8 Mar 2022 15:14:00 -0800 Subject: [PATCH 14/36] fix codacy --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 75c04553d..c50caf56a 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Build Status Release License - Codacy Badge + Codacy Badge Code of Conduct Known Vulnerabilities Contributions welcome From e58220e2c4b33278991e063cf7d2d4e192ed19a3 Mon Sep 17 00:00:00 2001 From: wagyourtail Date: Tue, 8 Mar 2022 19:45:05 -0700 Subject: [PATCH 15/36] fix inner class attribute being stripped --- scripts/proguard.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/proguard.pro b/scripts/proguard.pro index eea6fc23d..517494f46 100644 --- a/scripts/proguard.pro +++ b/scripts/proguard.pro @@ -1,5 +1,6 @@ -keepattributes Signature -keepattributes *Annotation* +-keepattributes InnerClasses -optimizationpasses 5 -verbose From 511941c7146135f28bde29dbe48f8459cd5efccb Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Tue, 15 Mar 2022 18:39:19 -0700 Subject: [PATCH 16/36] reimplement death and bed waypoints --- src/api/java/baritone/api/Settings.java | 11 +++ src/main/java/baritone/Baritone.java | 2 + .../baritone/behavior/WaypointBehavior.java | 92 +++++++++++++++++++ 3 files changed, 105 insertions(+) create mode 100644 src/main/java/baritone/behavior/WaypointBehavior.java diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index b0eda7489..0637f859c 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -550,6 +550,17 @@ public final class Settings { */ public final Setting slowPathTimeoutMS = new Setting<>(40000L); + + /** + * allows baritone to save bed waypoints when interacting with beds + */ + public final Setting doBedWaypoints = new Setting<>(true); + + /** + * allows baritone to save death waypoints + */ + public final Setting doDeathWaypoints = new Setting<>(true); + /** * The big one. Download all chunks in simplified 2-bit format and save them for better very-long-distance pathing. */ diff --git a/src/main/java/baritone/Baritone.java b/src/main/java/baritone/Baritone.java index 82451514f..71c2c455a 100755 --- a/src/main/java/baritone/Baritone.java +++ b/src/main/java/baritone/Baritone.java @@ -69,6 +69,7 @@ public class Baritone implements IBaritone { private PathingBehavior pathingBehavior; private LookBehavior lookBehavior; private InventoryBehavior inventoryBehavior; + private WaypointBehavior waypointBehavior; private InputOverrideHandler inputOverrideHandler; private FollowProcess followProcess; @@ -101,6 +102,7 @@ public class Baritone implements IBaritone { lookBehavior = new LookBehavior(this); inventoryBehavior = new InventoryBehavior(this); inputOverrideHandler = new InputOverrideHandler(this); + waypointBehavior = new WaypointBehavior(this); } this.pathingControlManager = new PathingControlManager(this); diff --git a/src/main/java/baritone/behavior/WaypointBehavior.java b/src/main/java/baritone/behavior/WaypointBehavior.java new file mode 100644 index 000000000..b21e080e7 --- /dev/null +++ b/src/main/java/baritone/behavior/WaypointBehavior.java @@ -0,0 +1,92 @@ +/* + * 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 . + */ + +package baritone.behavior; + +import baritone.Baritone; +import baritone.api.cache.IWaypoint; +import baritone.api.cache.Waypoint; +import baritone.api.event.events.BlockInteractEvent; +import baritone.api.utils.BetterBlockPos; +import baritone.api.utils.Helper; +import baritone.utils.BlockStateInterface; +import net.minecraft.block.BlockBed; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.event.ClickEvent; +import net.minecraft.util.text.event.HoverEvent; + +import java.util.Set; + +import static baritone.api.command.IBaritoneChatControl.FORCE_COMMAND_PREFIX; + +public class WaypointBehavior extends Behavior { + + + public WaypointBehavior(Baritone baritone) { + super(baritone); + } + + @Override + public void onBlockInteract(BlockInteractEvent event) { + if (!Baritone.settings().doBedWaypoints.value) + return; + if (event.getType() == BlockInteractEvent.Type.USE) { + BetterBlockPos pos = BetterBlockPos.from(event.getPos()); + IBlockState state = BlockStateInterface.get(ctx, pos); + if (state.getBlock() instanceof BlockBed) { + if (state.getValue(BlockBed.PART) == BlockBed.EnumPartType.FOOT) { + pos = pos.offset(state.getValue(BlockBed.FACING)); + } + Set waypoints = baritone.getWorldProvider().getCurrentWorld().getWaypoints().getByTag(IWaypoint.Tag.BED); + boolean exists = waypoints.stream().map(IWaypoint::getLocation).filter(pos::equals).findFirst().isPresent(); + if (!exists) { + baritone.getWorldProvider().getCurrentWorld().getWaypoints().addWaypoint(new Waypoint("bed", Waypoint.Tag.BED, pos)); + } + } + } + } + + @Override + public void onPlayerDeath() { + if (!Baritone.settings().doDeathWaypoints.value) + return; + Waypoint deathWaypoint = new Waypoint("death", Waypoint.Tag.DEATH, ctx.playerFeet()); + baritone.getWorldProvider().getCurrentWorld().getWaypoints().addWaypoint(deathWaypoint); + ITextComponent component = new TextComponentString("Death position saved."); + component.getStyle() + .setColor(TextFormatting.WHITE) + .setHoverEvent(new HoverEvent( + HoverEvent.Action.SHOW_TEXT, + new TextComponentString("Click to goto death") + )) + .setClickEvent(new ClickEvent( + ClickEvent.Action.RUN_COMMAND, + String.format( + "%s%s goto %s @ %d", + FORCE_COMMAND_PREFIX, + "wp", + deathWaypoint.getTag().getName(), + deathWaypoint.getCreationTimestamp() + ) + )); + Helper.HELPER.logDirect(component); + } + +} From e036f5360c49819c3fa4c83649bff5a8ad5dc542 Mon Sep 17 00:00:00 2001 From: scorbett123 <50634068+scorbett123@users.noreply.github.com> Date: Wed, 16 Mar 2022 20:12:56 +0000 Subject: [PATCH 17/36] If context.player() returns none we don't want to use its position for pruning. --- src/main/java/baritone/cache/CachedWorld.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/cache/CachedWorld.java b/src/main/java/baritone/cache/CachedWorld.java index 1d1132465..6b3959fe3 100644 --- a/src/main/java/baritone/cache/CachedWorld.java +++ b/src/main/java/baritone/cache/CachedWorld.java @@ -209,7 +209,7 @@ public final class CachedWorld implements ICachedWorld, Helper { private BlockPos guessPosition() { for (IBaritone ibaritone : BaritoneAPI.getProvider().getAllBaritones()) { IWorldData data = ibaritone.getWorldProvider().getCurrentWorld(); - if (data != null && data.getCachedWorld() == this) { + if (data != null && data.getCachedWorld() == this && ibaritone.getPlayerContext().player() != null) { return ibaritone.getPlayerContext().playerFeet(); } } From 6aadd00e72af1b55a750eb47566a0ef4418497ba Mon Sep 17 00:00:00 2001 From: PhlegethonAcheron <53194290+PhlegethonAcheron@users.noreply.github.com> Date: Sun, 20 Mar 2022 15:41:25 -0400 Subject: [PATCH 18/36] Added usage syntax to the documentation for buildValidSubstitutes and buildSubstitutes --- src/api/java/baritone/api/Settings.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 0637f859c..99ffcea20 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -234,6 +234,8 @@ public final class Settings { * A mapping of blocks to blocks treated as correct in their position *

* If a schematic asks for a block on this mapping, all blocks on the mapped list will be accepted at that location as well + *

+ * Syntax same as buildSubstitutes */ public final Setting>> buildValidSubstitutes = new Setting<>(new HashMap<>()); @@ -241,6 +243,15 @@ public final class Settings { * A mapping of blocks to blocks to be built instead *

* If a schematic asks for a block on this mapping, Baritone will place the first placeable block in the mapped list + *

+ * Usage Syntax: + *

+     *      sourceblockA->blockToSubstituteA1,blockToSubstituteA2,...blockToSubstituteAN,sourceBlockB->blockToSubstituteB1,blockToSubstituteB2,...blockToSubstituteBN,...sourceBlockX->blockToSubstituteX1,blockToSubstituteX2...blockToSubstituteXN
+     * 
+ * Example: + *
+     *     stone->cobblestone,andesite,oak_planks->birch_planks,acacia_planks,glass
+     * 
*/ public final Setting>> buildSubstitutes = new Setting<>(new HashMap<>()); From 4e6b6d97ce785341f6471520cd4f91b545386f38 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Thu, 24 Mar 2022 17:33:33 -0700 Subject: [PATCH 19/36] add forceAllowBreak setting --- src/api/java/baritone/api/Settings.java | 5 +++++ .../baritone/pathing/movement/CalculationContext.java | 9 ++++++++- src/main/java/baritone/process/BuilderProcess.java | 7 ++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 0637f859c..f8dc196cc 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -49,6 +49,11 @@ public final class Settings { */ public final Setting allowBreak = new Setting<>(true); + /** + * Blocks that baritone will be allowed to break even with allowBreak set to false + */ + public final Setting> forceAllowBreak = new Setting<>(new ArrayList<>()); + /** * Allow Baritone to sprint */ diff --git a/src/main/java/baritone/pathing/movement/CalculationContext.java b/src/main/java/baritone/pathing/movement/CalculationContext.java index fca6bc990..02e5557b7 100644 --- a/src/main/java/baritone/pathing/movement/CalculationContext.java +++ b/src/main/java/baritone/pathing/movement/CalculationContext.java @@ -34,6 +34,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; +import java.util.ArrayList; +import java.util.List; + import static baritone.api.pathing.movement.ActionCosts.COST_INF; /** @@ -55,6 +58,7 @@ public class CalculationContext { public final boolean canSprint; protected final double placeBlockCost; // protected because you should call the function instead public final boolean allowBreak; + public final List forceAllowBreak; public final boolean allowParkour; public final boolean allowParkourPlace; public final boolean allowJumpAt256; @@ -89,6 +93,7 @@ public class CalculationContext { this.canSprint = Baritone.settings().allowSprint.value && player.getFoodStats().getFoodLevel() > 6; this.placeBlockCost = Baritone.settings().blockPlacementPenalty.value; this.allowBreak = Baritone.settings().allowBreak.value; + this.forceAllowBreak = new ArrayList<>(Baritone.settings().forceAllowBreak.value); this.allowParkour = Baritone.settings().allowParkour.value; this.allowParkourPlace = Baritone.settings().allowParkourPlace.value; this.allowJumpAt256 = Baritone.settings().allowJumpAt256.value; @@ -150,7 +155,9 @@ public class CalculationContext { public double breakCostMultiplierAt(int x, int y, int z, IBlockState current) { if (!allowBreak) { - return COST_INF; + if (!forceAllowBreak.contains(current.getBlock())) { + return COST_INF; + } } if (isPossiblyProtected(x, y, z)) { return COST_INF; diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 604dbb2bc..3d98a710e 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -947,7 +947,12 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil @Override public double breakCostMultiplierAt(int x, int y, int z, IBlockState current) { - if (!allowBreak || isPossiblyProtected(x, y, z)) { + if (!allowBreak) { + if (!forceAllowBreak.contains(current.getBlock())) { + return COST_INF; + } + } + if (isPossiblyProtected(x, y, z)) { return COST_INF; } IBlockState sch = getSchematic(x, y, z, current); From bf450b7d68ac1dba9703cfc36809a2f475dcf105 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Thu, 24 Mar 2022 17:34:31 -0700 Subject: [PATCH 20/36] rename to allowBreakAnyway --- src/api/java/baritone/api/Settings.java | 2 +- .../java/baritone/pathing/movement/CalculationContext.java | 6 +++--- src/main/java/baritone/process/BuilderProcess.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index f8dc196cc..c883413b3 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -52,7 +52,7 @@ public final class Settings { /** * Blocks that baritone will be allowed to break even with allowBreak set to false */ - public final Setting> forceAllowBreak = new Setting<>(new ArrayList<>()); + public final Setting> allowBreakAnyway = new Setting<>(new ArrayList<>()); /** * Allow Baritone to sprint diff --git a/src/main/java/baritone/pathing/movement/CalculationContext.java b/src/main/java/baritone/pathing/movement/CalculationContext.java index 02e5557b7..7a67acffe 100644 --- a/src/main/java/baritone/pathing/movement/CalculationContext.java +++ b/src/main/java/baritone/pathing/movement/CalculationContext.java @@ -58,7 +58,7 @@ public class CalculationContext { public final boolean canSprint; protected final double placeBlockCost; // protected because you should call the function instead public final boolean allowBreak; - public final List forceAllowBreak; + public final List allowBreakAnyway; public final boolean allowParkour; public final boolean allowParkourPlace; public final boolean allowJumpAt256; @@ -93,7 +93,7 @@ public class CalculationContext { this.canSprint = Baritone.settings().allowSprint.value && player.getFoodStats().getFoodLevel() > 6; this.placeBlockCost = Baritone.settings().blockPlacementPenalty.value; this.allowBreak = Baritone.settings().allowBreak.value; - this.forceAllowBreak = new ArrayList<>(Baritone.settings().forceAllowBreak.value); + this.allowBreakAnyway = new ArrayList<>(Baritone.settings().allowBreakAnyway.value); this.allowParkour = Baritone.settings().allowParkour.value; this.allowParkourPlace = Baritone.settings().allowParkourPlace.value; this.allowJumpAt256 = Baritone.settings().allowJumpAt256.value; @@ -155,7 +155,7 @@ public class CalculationContext { public double breakCostMultiplierAt(int x, int y, int z, IBlockState current) { if (!allowBreak) { - if (!forceAllowBreak.contains(current.getBlock())) { + if (!allowBreakAnyway.contains(current.getBlock())) { return COST_INF; } } diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 3d98a710e..751900df6 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -948,7 +948,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil @Override public double breakCostMultiplierAt(int x, int y, int z, IBlockState current) { if (!allowBreak) { - if (!forceAllowBreak.contains(current.getBlock())) { + if (!allowBreakAnyway.contains(current.getBlock())) { return COST_INF; } } From 2953e2c522b9c37d59d1407f79a5ee7b581f5676 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Thu, 24 Mar 2022 18:16:19 -0700 Subject: [PATCH 21/36] make codacy happy --- .../java/baritone/pathing/movement/CalculationContext.java | 6 ++---- src/main/java/baritone/process/BuilderProcess.java | 7 +------ 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/src/main/java/baritone/pathing/movement/CalculationContext.java b/src/main/java/baritone/pathing/movement/CalculationContext.java index 7a67acffe..d5d6c93c8 100644 --- a/src/main/java/baritone/pathing/movement/CalculationContext.java +++ b/src/main/java/baritone/pathing/movement/CalculationContext.java @@ -154,10 +154,8 @@ public class CalculationContext { } public double breakCostMultiplierAt(int x, int y, int z, IBlockState current) { - if (!allowBreak) { - if (!allowBreakAnyway.contains(current.getBlock())) { - return COST_INF; - } + if (!allowBreak && !allowBreakAnyway.contains(current.getBlock())) { + return COST_INF; } if (isPossiblyProtected(x, y, z)) { return COST_INF; diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 751900df6..e3ff4fbd9 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -947,12 +947,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil @Override public double breakCostMultiplierAt(int x, int y, int z, IBlockState current) { - if (!allowBreak) { - if (!allowBreakAnyway.contains(current.getBlock())) { - return COST_INF; - } - } - if (isPossiblyProtected(x, y, z)) { + if ((!allowBreak && !allowBreakAnyway.contains(current.getBlock())) || isPossiblyProtected(x, y, z)) { return COST_INF; } IBlockState sch = getSchematic(x, y, z, current); From 65974e15ba5efc0ea8d7a5b2388b5ca77dfd3a5a Mon Sep 17 00:00:00 2001 From: scorbett123 <50634068+scorbett123@users.noreply.github.com> Date: Mon, 11 Apr 2022 18:36:48 +0100 Subject: [PATCH 22/36] Improve output to user in eta command --- .../baritone/command/defaults/ETACommand.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/baritone/command/defaults/ETACommand.java b/src/main/java/baritone/command/defaults/ETACommand.java index 3c16bd113..6905610f6 100644 --- a/src/main/java/baritone/command/defaults/ETACommand.java +++ b/src/main/java/baritone/command/defaults/ETACommand.java @@ -28,6 +28,7 @@ import baritone.api.command.argument.IArgConsumer; import java.util.Arrays; import java.util.List; +import java.util.Optional; import java.util.stream.Stream; public class ETACommand extends Command { @@ -45,12 +46,22 @@ public class ETACommand extends Command { throw new CommandInvalidStateException("No process in control"); } IPathingBehavior pathingBehavior = baritone.getPathingBehavior(); - logDirect(String.format( - "Next segment: %.2f\n" + - "Goal: %.2f", - pathingBehavior.ticksRemainingInSegment().orElse(-1.0), - pathingBehavior.estimatedTicksToGoal().orElse(-1.0) - )); + + Optional ticksRemainingInSegment = pathingBehavior.ticksRemainingInSegment(); + Optional ticksRemainingInGoal = pathingBehavior.estimatedTicksToGoal(); + + if (ticksRemainingInGoal.isPresent() && ticksRemainingInSegment.isPresent()) { + logDirect(String.format( + "Next segment: %.1fs (%.0f ticks)\n" + + "Goal: %.1fs (%.0f ticks)", + ticksRemainingInSegment.get() / 20, // we just assume tps is 20, it isn't worth the effort that is needed to calculate it exactly + ticksRemainingInSegment.get(), + ticksRemainingInGoal.get() / 20, + ticksRemainingInGoal.get() + )); + } else { + logDirect("Not currently pathing"); + } } @Override From 2cf973809a2fc277c8a8507565131d49e3e11e6b Mon Sep 17 00:00:00 2001 From: scorbett123 <50634068+scorbett123@users.noreply.github.com> Date: Tue, 12 Apr 2022 12:15:42 +0100 Subject: [PATCH 23/36] eta command should default to NaN not just not showing the eta as suggested by ZacSharp --- .../baritone/command/defaults/ETACommand.java | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/baritone/command/defaults/ETACommand.java b/src/main/java/baritone/command/defaults/ETACommand.java index 6905610f6..47b6ae9fa 100644 --- a/src/main/java/baritone/command/defaults/ETACommand.java +++ b/src/main/java/baritone/command/defaults/ETACommand.java @@ -47,21 +47,17 @@ public class ETACommand extends Command { } IPathingBehavior pathingBehavior = baritone.getPathingBehavior(); - Optional ticksRemainingInSegment = pathingBehavior.ticksRemainingInSegment(); - Optional ticksRemainingInGoal = pathingBehavior.estimatedTicksToGoal(); + double ticksRemainingInSegment = pathingBehavior.ticksRemainingInSegment().orElse(Double.NaN); + double ticksRemainingInGoal = pathingBehavior.estimatedTicksToGoal().orElse(Double.NaN); - if (ticksRemainingInGoal.isPresent() && ticksRemainingInSegment.isPresent()) { - logDirect(String.format( - "Next segment: %.1fs (%.0f ticks)\n" + - "Goal: %.1fs (%.0f ticks)", - ticksRemainingInSegment.get() / 20, // we just assume tps is 20, it isn't worth the effort that is needed to calculate it exactly - ticksRemainingInSegment.get(), - ticksRemainingInGoal.get() / 20, - ticksRemainingInGoal.get() - )); - } else { - logDirect("Not currently pathing"); - } + logDirect(String.format( + "Next segment: %.1fs (%.0f ticks)\n" + + "Goal: %.1fs (%.0f ticks)", + ticksRemainingInSegment / 20, // we just assume tps is 20, it isn't worth the effort that is needed to calculate it exactly + ticksRemainingInSegment, + ticksRemainingInGoal / 20, + ticksRemainingInGoal + )); } @Override From ad40a9225e18559e1ec71571f14040f914df8853 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Tue, 3 May 2022 23:25:01 +0200 Subject: [PATCH 24/36] Fix leaking incorrect positions It was only cleared when the previous one was canceled, not when it was directly replaced by the next one. --- src/main/java/baritone/process/BuilderProcess.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index e3ff4fbd9..1766af623 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -108,6 +108,7 @@ public final class BuilderProcess extends BaritoneProcessHelper implements IBuil this.layer = Baritone.settings().startAtLayer.value; this.numRepeats = 0; this.observedCompleted = new LongOpenHashSet(); + this.incorrectPositions = null; } public void resume() { From 221eba11dd1d41d523e2e2b9603bf4a75055f148 Mon Sep 17 00:00:00 2001 From: ZacSharp <68165024+ZacSharp@users.noreply.github.com> Date: Fri, 20 May 2022 01:31:09 +0200 Subject: [PATCH 25/36] Deal with others replacing the chat gui --- 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 e488a9199..897182898 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -1124,7 +1124,7 @@ public final class Settings { * via {@link Consumer#andThen(Consumer)} or it can completely be overriden via setting * {@link Setting#value}; */ - public final Setting> logger = new Setting<>(Minecraft.getMinecraft().ingameGUI.getChatGUI()::printChatMessage); + public final Setting> logger = new Setting<>(msg -> Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(msg)); /** * The function that is called when Baritone will send a desktop notification. This function can be added to From b0266cd14bf1c4bdb808046c2f752b416d7dfdba Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Wed, 1 Jun 2022 15:49:41 -0600 Subject: [PATCH 26/36] do beta versioning on gh action builds --- .github/workflows/gradle_build.yml | 16 +++++++++++++++- build.gradle | 2 +- gradle.properties | 18 ++++++++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 gradle.properties diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 34e93bff2..53081763a 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -19,7 +19,21 @@ jobs: with: java-version: '8' distribution: 'adopt' - + + - uses: actions/github-script@v2 + id: fname + name: apply beta versioning + with: + result-encoding: string + script: | + const fs = require("fs"); + let file = fs.readFileSync("./gradle.properties"); + file = file.toString().split("\n").map(e => e.trim().startsWith("mod_version") ? `${e}-beta-${process.env.GITHUB_SHA.substring(0, 7)}` : e).join("\n"); + fs.writeFileSync("./gradle.properties", file); + const mod_version = file.toString().split("\n").filter(e => e.trim().startsWith("mod_version"))[0].split("=")[1].trim(); + const archives_base_name = file.toString().split("\n").filter(e => e.trim().startsWith("archives_base_name"))[0].split("=")[1].trim(); + return `${archives_base_name}-${mod_version}`; + - name: Grant execute permission for gradlew run: chmod +x gradlew diff --git a/build.gradle b/build.gradle index b922fc900..ad9c3335b 100755 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ */ group 'baritone' -version '1.2.15' +version project.mod_version buildscript { repositories { diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..ca675d85d --- /dev/null +++ b/gradle.properties @@ -0,0 +1,18 @@ +# +# 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 . +# + +mod_version = 1.2.15 \ No newline at end of file From 0df45a89bec8486cbb6886c98b00d9e3ecb933c1 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Wed, 1 Jun 2022 15:51:25 -0600 Subject: [PATCH 27/36] don't do the other stuff --- .github/workflows/gradle_build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 53081763a..4c1075f82 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -21,7 +21,6 @@ jobs: distribution: 'adopt' - uses: actions/github-script@v2 - id: fname name: apply beta versioning with: result-encoding: string @@ -30,9 +29,6 @@ jobs: let file = fs.readFileSync("./gradle.properties"); file = file.toString().split("\n").map(e => e.trim().startsWith("mod_version") ? `${e}-beta-${process.env.GITHUB_SHA.substring(0, 7)}` : e).join("\n"); fs.writeFileSync("./gradle.properties", file); - const mod_version = file.toString().split("\n").filter(e => e.trim().startsWith("mod_version"))[0].split("=")[1].trim(); - const archives_base_name = file.toString().split("\n").filter(e => e.trim().startsWith("archives_base_name"))[0].split("=")[1].trim(); - return `${archives_base_name}-${mod_version}`; - name: Grant execute permission for gradlew run: chmod +x gradlew From 3d95f0ad6596edb3a645617dee9ec2e912f4ba31 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Wed, 1 Jun 2022 16:16:41 -0600 Subject: [PATCH 28/36] auto-increment version number as well --- .github/workflows/gradle_build.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 4c1075f82..5837c65dd 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -27,7 +27,14 @@ jobs: script: | const fs = require("fs"); let file = fs.readFileSync("./gradle.properties"); - file = file.toString().split("\n").map(e => e.trim().startsWith("mod_version") ? `${e}-beta-${process.env.GITHUB_SHA.substring(0, 7)}` : e).join("\n"); + file = file.toString().split("\n").map(e => { + if (!e.trim().startsWith("mod_version")) return e; + let vers = e.split("."); + let n = parseInt(vers[vers.length]) + 1; + vers = vers.slice(0, vers.length - 1); + vers.push(n); + return `${vers.join(".")}-beta-${process.env.GITHUB_SHA.substring(0, 7)}`; + }).join("\n"); fs.writeFileSync("./gradle.properties", file); - name: Grant execute permission for gradlew From 1b3139c99aff4f2e2852ab34c512c39c855ab2df Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Wed, 1 Jun 2022 16:21:21 -0600 Subject: [PATCH 29/36] oops --- .github/workflows/gradle_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 5837c65dd..e74a9251d 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -30,7 +30,7 @@ jobs: file = file.toString().split("\n").map(e => { if (!e.trim().startsWith("mod_version")) return e; let vers = e.split("."); - let n = parseInt(vers[vers.length]) + 1; + let n = parseInt(vers[vers.length-1].trim()) + 1; vers = vers.slice(0, vers.length - 1); vers.push(n); return `${vers.join(".")}-beta-${process.env.GITHUB_SHA.substring(0, 7)}`; From caa88c5b60e29930eb44d734b1626f8126e4d703 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Wed, 1 Jun 2022 16:28:53 -0600 Subject: [PATCH 30/36] DONT on tags --- .github/workflows/gradle_build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index e74a9251d..98c6f5fee 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -29,6 +29,7 @@ jobs: let file = fs.readFileSync("./gradle.properties"); file = file.toString().split("\n").map(e => { if (!e.trim().startsWith("mod_version")) return e; + if (process.env.GITHUB_REF.includes("tags")) return e; let vers = e.split("."); let n = parseInt(vers[vers.length-1].trim()) + 1; vers = vers.slice(0, vers.length - 1); From 4dba5a4399f6691fdf5401b88492a0b0c2d15610 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Fri, 3 Jun 2022 14:09:37 -0600 Subject: [PATCH 31/36] use `git describe` instead --- .github/workflows/gradle_build.yml | 20 +------------------- gradle.properties | 2 +- 2 files changed, 2 insertions(+), 20 deletions(-) diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 98c6f5fee..0af2ebbc1 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -20,29 +20,11 @@ jobs: java-version: '8' distribution: 'adopt' - - uses: actions/github-script@v2 - name: apply beta versioning - with: - result-encoding: string - script: | - const fs = require("fs"); - let file = fs.readFileSync("./gradle.properties"); - file = file.toString().split("\n").map(e => { - if (!e.trim().startsWith("mod_version")) return e; - if (process.env.GITHUB_REF.includes("tags")) return e; - let vers = e.split("."); - let n = parseInt(vers[vers.length-1].trim()) + 1; - vers = vers.slice(0, vers.length - 1); - vers.push(n); - return `${vers.join(".")}-beta-${process.env.GITHUB_SHA.substring(0, 7)}`; - }).join("\n"); - fs.writeFileSync("./gradle.properties", file); - - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew build + run: ./gradlew build -Pmod_version=$(git describe --always --tags | cut -c2-) - name: Archive Artifacts uses: actions/upload-artifact@v2 diff --git a/gradle.properties b/gradle.properties index ca675d85d..dfce2934c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,4 @@ # along with Baritone. If not, see . # -mod_version = 1.2.15 \ No newline at end of file +mod_version = 1.2.15-local_build \ No newline at end of file From ffbe683e86811215cd4c10636a58f970786ced04 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Fri, 3 Jun 2022 14:24:17 -0600 Subject: [PATCH 32/36] versioning with normal build --- .github/workflows/gradle_build.yml | 4 ++-- build.gradle | 8 +++++++- gradle.properties | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 0af2ebbc1..9c28df452 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -24,8 +24,8 @@ jobs: run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew build -Pmod_version=$(git describe --always --tags | cut -c2-) - + run: ./gradlew build + - name: Archive Artifacts uses: actions/upload-artifact@v2 with: diff --git a/build.gradle b/build.gradle index ad9c3335b..29657d789 100755 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,13 @@ */ group 'baritone' -version project.mod_version + +def vers = 'git describe --always --tags --dirty'.execute().text.trim(); +if (!vers.startsWith("v")) { + version project.hasProperty("mod_version") + "+" + "local_build"; +} else { + version vers.substring(1) +} buildscript { repositories { diff --git a/gradle.properties b/gradle.properties index dfce2934c..ca675d85d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,4 @@ # along with Baritone. If not, see . # -mod_version = 1.2.15-local_build \ No newline at end of file +mod_version = 1.2.15 \ No newline at end of file From 1caa99fee3baa915e55c9503920b1c689efb517d Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Fri, 3 Jun 2022 14:26:27 -0600 Subject: [PATCH 33/36] oops --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 29657d789..3fc738c9e 100755 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ group 'baritone' def vers = 'git describe --always --tags --dirty'.execute().text.trim(); if (!vers.startsWith("v")) { - version project.hasProperty("mod_version") + "+" + "local_build"; + version project.mod_version + "+" + "local_build"; } else { version vers.substring(1) } From ed381d6b33879e68d775d1e724f7321f1307ace3 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Fri, 3 Jun 2022 14:29:51 -0600 Subject: [PATCH 34/36] fix CI not having access to git when run via gradle --- .github/workflows/gradle_build.yml | 2 +- build.gradle | 2 +- gradle.properties | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 9c28df452..70498991a 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -24,7 +24,7 @@ jobs: run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew build + run: ./gradlew build -Pmod_version=$(git describe --always --tags | cut -c2-) - name: Archive Artifacts uses: actions/upload-artifact@v2 diff --git a/build.gradle b/build.gradle index 3fc738c9e..5c0fbf146 100755 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ group 'baritone' def vers = 'git describe --always --tags --dirty'.execute().text.trim(); if (!vers.startsWith("v")) { - version project.mod_version + "+" + "local_build"; + version project.mod_version; } else { version vers.substring(1) } diff --git a/gradle.properties b/gradle.properties index ca675d85d..9242d089a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,4 +15,4 @@ # along with Baritone. If not, see . # -mod_version = 1.2.15 \ No newline at end of file +mod_version = 1.2.15-local \ No newline at end of file From f699be7973357b2c994fce47b145848435d8e69e Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Fri, 3 Jun 2022 14:42:23 -0600 Subject: [PATCH 35/36] so umm, it's not using right version number in CI... --- .github/workflows/gradle_build.yml | 2 +- build.gradle | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 70498991a..de19c7a99 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -24,7 +24,7 @@ jobs: run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew build -Pmod_version=$(git describe --always --tags | cut -c2-) + run: ./gradlew build -Pmod_version="$(git describe --always --tags | cut -c2-)" - name: Archive Artifacts uses: actions/upload-artifact@v2 diff --git a/build.gradle b/build.gradle index 5c0fbf146..8cda353f4 100755 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,8 @@ group 'baritone' def vers = 'git describe --always --tags --dirty'.execute().text.trim(); if (!vers.startsWith("v")) { - version project.mod_version; + println "git doesn't appear to be installed!" + version project.mod_version } else { version vers.substring(1) } From 2b4da2a46c165b09238ea9491918af3e66400e41 Mon Sep 17 00:00:00 2001 From: Wagyourtail Date: Fri, 3 Jun 2022 14:46:39 -0600 Subject: [PATCH 36/36] deep checkout so we actually get tag names in CI --- .github/workflows/gradle_build.yml | 5 ++++- build.gradle | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index de19c7a99..8a8ac2cb4 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -13,7 +13,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Set up JDK 8 uses: actions/setup-java@v2 with: diff --git a/build.gradle b/build.gradle index 8cda353f4..0013796c9 100755 --- a/build.gradle +++ b/build.gradle @@ -20,6 +20,7 @@ group 'baritone' def vers = 'git describe --always --tags --dirty'.execute().text.trim(); if (!vers.startsWith("v")) { println "git doesn't appear to be installed!" + println "using version number: " + project.mod_version version project.mod_version } else { version vers.substring(1)