diff --git a/README.md b/README.md index 19ec0e87..043aed08 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ ![Lines of Code](https://tokei.rs/b1/github/cabaletta/baritone?category=code) [![GitHub contributors](https://img.shields.io/github/contributors/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/graphs/contributors/) [![GitHub commits](https://img.shields.io/github/commits-since/cabaletta/baritone/v1.0.0.svg)](https://github.com/cabaletta/baritone/commit/) -[![Impact integration](https://img.shields.io/badge/Impact%20integration-v1.2.8%20/%20v1.3.4%20/%20v1.4.1-brightgreen.svg)](https://impactclient.net/) +[![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/) [![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) [![WWE integration](https://img.shields.io/badge/WWE%20%22integration%22-master%3F-green.svg)](https://wweclient.com/) diff --git a/USAGE.md b/USAGE.md index 25fef11e..0f911efa 100644 --- a/USAGE.md +++ b/USAGE.md @@ -8,11 +8,23 @@ Baritone commands can also by default be typed in the chatbox. However if you ma To disable direct chat control (with no prefix), turn off the `chatControl` setting. To disable chat control with the `#` prefix, turn off the `prefixControl` setting. In Impact, `.b` cannot be disabled. Be careful that you don't leave yourself with all control methods disabled (if you do, reset your settings by deleting the file `minecraft/baritone/settings.txt` and relaunching). +# For Baritone 1.2.10+, 1.3.5+, 1.4.2+ + +Lots of the commands have changed, BUT `#help` is improved vastly (its clickable! commands have tab completion! oh my!). + +Try `#help` I promise it won't just send you back here =) + +"wtf where is cleararea" -> look at `#help sel` + +"wtf where is goto death, goto waypoint" -> look at `#help wp` (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` (remember stuff is clickable!). + +just look at `#help` lmao + # Commands **All** of these commands may need a prefix before them, as above ^. -`help` for (rudimentary) help. You can see what it says [here](https://github.com/cabaletta/baritone/blob/master/src/api/java/baritone/api/utils/ExampleBaritoneControl.java#L47). +`help` 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`. @@ -38,12 +50,6 @@ Some common examples: - `version` to get the version of Baritone you're running - `damn` daniel - -New commands: -- `sel` to manage selections -- some others - - 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). All the settings and documentation are here. If you find HTML easier to read than Javadoc, you can look here. diff --git a/build.gradle b/build.gradle index d0ba4720..117f1d63 100755 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ */ group 'baritone' -version '1.2.9' +version '1.2.10' buildscript { repositories { diff --git a/src/api/java/baritone/api/IBaritoneProvider.java b/src/api/java/baritone/api/IBaritoneProvider.java index 24122c12..dcb7fb1d 100644 --- a/src/api/java/baritone/api/IBaritoneProvider.java +++ b/src/api/java/baritone/api/IBaritoneProvider.java @@ -19,8 +19,9 @@ package baritone.api; import baritone.api.bot.IUserManager; import baritone.api.cache.IWorldScanner; -import baritone.api.command.Command; +import baritone.api.command.ICommand; import baritone.api.command.ICommandSystem; +import baritone.api.schematic.ISchematicSystem; import net.minecraft.client.entity.EntityPlayerSP; import java.util.List; @@ -83,9 +84,14 @@ public interface IBaritoneProvider { /** * Returns the {@link ICommandSystem} instance. This is not bound to a specific {@link IBaritone} - * instance because {@link ICommandSystem} itself controls global behavior for {@link Command}s. + * instance because {@link ICommandSystem} itself controls global behavior for {@link ICommand}s. * * @return The {@link ICommandSystem} instance. */ ICommandSystem getCommandSystem(); + + /** + * @return The {@link ISchematicSystem} instance. + */ + ISchematicSystem getSchematicSystem(); } diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 776d8e61..69bcabcb 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -184,6 +184,20 @@ public final class Settings { Blocks.WALL_SIGN ))); + /** + * A list of blocks to be treated as if they're air. + *

+ * If a schematic asks for air at a certain position, and that position currently contains a block on this list, it will be treated as correct. + */ + public final Setting> buildIgnoreBlocks = 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. + */ + public final Setting buildIgnoreExisting = new Setting<>(false); + /** * If this setting is true, Baritone will never break a block that is adjacent to an unsupported falling block. *

@@ -234,7 +248,7 @@ public final class Settings { /** * If we overshoot a traverse and end up one block beyond the destination, mark it as successful anyway. *

- * This helps with speed at >=20m/s + * This helps with speed exceeding 20m/s */ public final Setting overshootTraverse = new Setting<>(true); @@ -248,6 +262,11 @@ public final class Settings { */ public final Setting rightClickSpeed = new Setting<>(4); + /** + * Block reach distance + */ + public final Setting blockReachDistance = new Setting<>(4.5f); + /** * How many degrees to randomize the pitch and yaw every tick. Set to 0 to disable */ @@ -738,6 +757,11 @@ public final class Settings { */ public final Setting buildRepeat = new Setting<>(new Vec3i(0, 0, 0)); + /** + * How many times to buildrepeat. -1 for infinite. + */ + public final Setting buildRepeatCount = new Setting<>(-1); + /** * Allow standing above a block while mining it, in BuilderProcess *

@@ -787,6 +811,12 @@ public final class Settings { */ public final Setting schematicOrientationZ = new Setting<>(false); + /** + * The fallback used by the build command when no extension is specified. This may be useful if schematics of a + * particular format are used often, and the user does not wish to have to specify the extension with every usage. + */ + public final Setting schematicFallbackExtension = new Setting<>("schematic"); + /** * Distance to scan every tick for updates. Expanding this beyond player reach distance (i.e. setting it to 6 or above) * is only necessary in very large schematics where rescanning the whole thing is costly. diff --git a/src/api/java/baritone/api/cache/ICachedWorld.java b/src/api/java/baritone/api/cache/ICachedWorld.java index 837ae076..e681ce51 100644 --- a/src/api/java/baritone/api/cache/ICachedWorld.java +++ b/src/api/java/baritone/api/cache/ICachedWorld.java @@ -81,6 +81,4 @@ public interface ICachedWorld { * in a new thread by default. */ void save(); - - } diff --git a/src/api/java/baritone/api/cache/IWorldScanner.java b/src/api/java/baritone/api/cache/IWorldScanner.java index 325d4bd0..224f64c7 100644 --- a/src/api/java/baritone/api/cache/IWorldScanner.java +++ b/src/api/java/baritone/api/cache/IWorldScanner.java @@ -77,10 +77,20 @@ public interface IWorldScanner { } /** - * Repacks 40 chunks around the player. + * Overload of {@link #repack(IPlayerContext, int)} where the value of the {@code range} parameter is {@code 40}. * - * @param ctx The player context for that player. - * @return The number of chunks queued for repacking. + * @param ctx The player, describing the origin + * @return The amount of chunks successfully queued for repacking */ int repack(IPlayerContext ctx); + + /** + * Queues the chunks in a square formation around the specified player, using the specified + * range, which represents 1/2 the square's dimensions, where the player is in the center. + * + * @param ctx The player, describing the origin + * @param range The range to repack + * @return The amount of chunks successfully queued for repacking + */ + int repack(IPlayerContext ctx, int range); } diff --git a/src/api/java/baritone/api/command/Command.java b/src/api/java/baritone/api/command/Command.java index cd8fa5de..4db5c0f3 100644 --- a/src/api/java/baritone/api/command/Command.java +++ b/src/api/java/baritone/api/command/Command.java @@ -18,10 +18,7 @@ package baritone.api.command; import baritone.api.IBaritone; -import baritone.api.utils.Helper; import baritone.api.utils.IPlayerContext; -import baritone.api.command.exception.CommandException; -import baritone.api.command.helpers.arguments.IArgConsumer; import java.util.Collections; import java.util.List; @@ -29,7 +26,19 @@ import java.util.Locale; import java.util.stream.Collectors; import java.util.stream.Stream; -public abstract class Command implements Helper { +/** + * A default implementation of {@link ICommand} which provides easy access to the + * command's bound {@link IBaritone} instance, {@link IPlayerContext} and an easy + * way to provide multiple valid command execution names through the default constructor. + *

+ * So basically, you should use it because it provides a small amount of boilerplate, + * but you're not forced to use it. + * + * @see ICommand + * + * @author LoganDark + */ +public abstract class Command implements ICommand { protected IBaritone baritone; protected IPlayerContext ctx; @@ -52,34 +61,7 @@ public abstract class Command implements Helper { this.ctx = baritone.getPlayerContext(); } - /** - * Called when this command is executed. - */ - public abstract void execute(String label, IArgConsumer args) throws CommandException; - - /** - * Called when the command needs to tab complete. Return a Stream representing the entries to put in the completions - * list. - */ - public abstract Stream tabComplete(String label, IArgConsumer args) throws CommandException; - - /** - * @return A single-line string containing a short description of this command's purpose. - */ - public abstract String getShortDesc(); - - /** - * @return A list of lines that will be printed by the help command when the user wishes to view them. - */ - public abstract List getLongDesc(); - - /** - * @return {@code true} if this command should be hidden from the help menu - */ - public boolean hiddenFromHelp() { - return false; - } - + @Override public final List getNames() { return this.names; } diff --git a/src/api/java/baritone/api/command/ICommand.java b/src/api/java/baritone/api/command/ICommand.java new file mode 100644 index 00000000..792de7c7 --- /dev/null +++ b/src/api/java/baritone/api/command/ICommand.java @@ -0,0 +1,67 @@ +/* + * 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.api.command; + +import baritone.api.command.argument.IArgConsumer; +import baritone.api.command.exception.CommandException; +import baritone.api.utils.Helper; + +import java.util.List; +import java.util.stream.Stream; + +/** + * The base for a command. + * + * @author Brady + * @since 10/7/2019 + */ +public interface ICommand extends Helper { + + /** + * Called when this command is executed. + */ + void execute(String label, IArgConsumer args) throws CommandException; + + /** + * Called when the command needs to tab complete. Return a Stream representing the entries to put in the completions + * list. + */ + Stream tabComplete(String label, IArgConsumer args) throws CommandException; + + /** + * @return A single-line string containing a short description of this command's purpose. + */ + String getShortDesc(); + + /** + * @return A list of lines that will be printed by the help command when the user wishes to view them. + */ + List getLongDesc(); + + /** + * @return A list of the names that can be accepted to have arguments passed to this command + */ + List getNames(); + + /** + * @return {@code true} if this command should be hidden from the help menu + */ + default boolean hiddenFromHelp() { + return false; + } +} diff --git a/src/api/java/baritone/api/command/argparser/IArgParserManager.java b/src/api/java/baritone/api/command/argparser/IArgParserManager.java index fe819150..f38b4624 100644 --- a/src/api/java/baritone/api/command/argparser/IArgParserManager.java +++ b/src/api/java/baritone/api/command/argparser/IArgParserManager.java @@ -22,6 +22,10 @@ import baritone.api.command.exception.CommandInvalidTypeException; import baritone.api.command.registry.Registry; /** + * Used to retrieve {@link IArgParser} instances from the registry, by their target class. + * It can be assumed that a {@link IArgParser} exists for {@link Integer}, {@link Long}, + * {@link Float}, {@link Double} and {@link Boolean}. + * * @author Brady * @since 10/4/2019 */ diff --git a/src/api/java/baritone/api/command/helpers/arguments/IArgConsumer.java b/src/api/java/baritone/api/command/argument/IArgConsumer.java similarity index 99% rename from src/api/java/baritone/api/command/helpers/arguments/IArgConsumer.java rename to src/api/java/baritone/api/command/argument/IArgConsumer.java index c185c1f7..c9212fa4 100644 --- a/src/api/java/baritone/api/command/helpers/arguments/IArgConsumer.java +++ b/src/api/java/baritone/api/command/argument/IArgConsumer.java @@ -15,13 +15,12 @@ * along with Baritone. If not, see . */ -package baritone.api.command.helpers.arguments; +package baritone.api.command.argument; -import baritone.api.command.Command; +import baritone.api.command.ICommand; import baritone.api.command.exception.CommandTooManyArgumentsException; import baritone.api.utils.Helper; import baritone.api.command.argparser.IArgParser; -import baritone.api.command.argument.ICommandArgument; import baritone.api.command.datatypes.IDatatype; import baritone.api.command.datatypes.IDatatypeFor; import baritone.api.command.datatypes.IDatatypePost; @@ -35,7 +34,7 @@ import java.util.LinkedList; import java.util.stream.Stream; /** - * The {@link IArgConsumer} is how {@link Command}s read the arguments passed to them. This class has many benefits: + * The {@link IArgConsumer} is how {@link ICommand}s read the arguments passed to them. This class has many benefits: * *