diff --git a/README.md b/README.md index 19ec0e879..90173889d 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.2-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 25fef11e8..118104993 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` + +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 25be6d665..a97f9b483 100755 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,6 @@ version '1.3.5' buildscript { repositories { - jcenter() maven { name = 'forge' url = 'http://files.minecraftforge.net/maven' @@ -29,6 +28,7 @@ buildscript { name = 'impactdevelopment-repo' url = 'https://impactdevelopment.github.io/maven/' } + jcenter() } dependencies { diff --git a/src/api/java/baritone/api/cache/ICachedWorld.java b/src/api/java/baritone/api/cache/ICachedWorld.java index 837ae076c..e681ce51c 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 325d4bd0e..224f64c76 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/main/java/baritone/cache/WorldScanner.java b/src/main/java/baritone/cache/WorldScanner.java index 8e72fd3c4..4255326a9 100644 --- a/src/main/java/baritone/cache/WorldScanner.java +++ b/src/main/java/baritone/cache/WorldScanner.java @@ -111,6 +111,41 @@ public enum WorldScanner implements IWorldScanner { return res; } + @Override + public int repack(IPlayerContext ctx) { + return this.repack(ctx, 40); + } + + @Override + public int repack(IPlayerContext ctx, int range) { + IChunkProvider chunkProvider = ctx.world().getChunkProvider(); + ICachedWorld cachedWorld = ctx.worldData().getCachedWorld(); + + BetterBlockPos playerPos = ctx.playerFeet(); + + int playerChunkX = playerPos.getX() >> 4; + int playerChunkZ = playerPos.getZ() >> 4; + + int minX = playerChunkX - range; + int minZ = playerChunkZ - range; + int maxX = playerChunkX + range; + int maxZ = playerChunkZ + range; + + int queued = 0; + for (int x = minX; x <= maxX; x++) { + for (int z = minZ; z <= maxZ; z++) { + Chunk chunk = chunkProvider.getChunk(x, z, false, false); + + if (chunk != null && !chunk.isEmpty()) { + queued++; + cachedWorld.queueForPacking(chunk); + } + } + } + + return queued; + } + private boolean scanChunkInto(int chunkX, int chunkZ, Chunk chunk, BlockOptionalMetaLookup filter, Collection result, int max, int yLevelThreshold, int playerY, int[] coordinateIterationOrder) { ChunkSection[] chunkInternalStorageArray = chunk.getSections(); boolean foundWithinY = false; @@ -147,26 +182,4 @@ public enum WorldScanner implements IWorldScanner { } return foundWithinY; } - - public int repack(IPlayerContext ctx) { - IChunkProvider chunkProvider = ctx.world().getChunkProvider(); - ICachedWorld cachedWorld = ctx.worldData().getCachedWorld(); - - BetterBlockPos playerPos = ctx.playerFeet(); - int playerChunkX = playerPos.getX() >> 4; - int playerChunkZ = playerPos.getZ() >> 4; - int queued = 0; - for (int x = playerChunkX - 40; x <= playerChunkX + 40; x++) { - for (int z = playerChunkZ - 40; z <= playerChunkZ + 40; z++) { - Chunk chunk = chunkProvider.getChunk(x, z, false, false); - - if (chunk != null && !chunk.isEmpty()) { - queued++; - cachedWorld.queueForPacking(chunk); - } - } - } - - return queued; - } } diff --git a/src/main/java/baritone/utils/BaritoneAutoTest.java b/src/main/java/baritone/utils/BaritoneAutoTest.java index c55289f1d..ad11dce85 100644 --- a/src/main/java/baritone/utils/BaritoneAutoTest.java +++ b/src/main/java/baritone/utils/BaritoneAutoTest.java @@ -28,13 +28,9 @@ import net.minecraft.client.GameSettings; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.tutorial.TutorialSteps; -import net.minecraft.server.integrated.IntegratedServer; import net.minecraft.util.HttpUtil; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.GameType; -import net.minecraft.world.WorldSettings; -import net.minecraft.world.WorldType; -import net.minecraft.world.dimension.DimensionType; +import net.minecraft.world.*; import java.io.File; import java.io.IOException; @@ -92,17 +88,21 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper { if (mc.currentScreen instanceof GuiMainMenu) { System.out.println("Beginning Baritone automatic test routine"); mc.displayGuiScreen(null); - WorldSettings worldsettings = new WorldSettings(TEST_SEED, GameType.getByName("survival"), true, false, WorldType.DEFAULT); + WorldSettings worldsettings = new WorldSettings(TEST_SEED, GameType.SURVIVAL, true, false, WorldType.DEFAULT); mc.launchIntegratedServer("BaritoneAutoTest", "BaritoneAutoTest", worldsettings); } - IntegratedServer server = mc.getIntegratedServer(); + // If the integrated server is running, set the difficulty to peaceful + if (mc.getIntegratedServer() != null) { + mc.getIntegratedServer().setDifficultyForAllWorlds(EnumDifficulty.PEACEFUL); - // If the integrated server is launched and the world has initialized, set the spawn point - // to our defined starting position - if (server != null && server.getWorld(DimensionType.OVERWORLD) != null) { - server.getWorld(DimensionType.OVERWORLD).setSpawnPoint(STARTING_POSITION); - server.getWorld(DimensionType.OVERWORLD).getGameRules().setOrCreateGameRule("spawnRadius", "0", server); + for (final WorldServer world : mc.getIntegratedServer().getWorlds()) { + // If the world has initialized, set the spawn point to our defined starting position + if (world != null) { + world.setSpawnPoint(STARTING_POSITION); + world.getGameRules().setOrCreateGameRule("spawnRadius", "0", mc.getIntegratedServer()); + } + } } if (event.getType() == TickEvent.Type.IN) { // If we're in-game @@ -110,7 +110,7 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper { // Force the integrated server to share the world to LAN so that // the ingame pause menu gui doesn't actually pause our game if (mc.isSingleplayer() && !mc.getIntegratedServer().getPublic()) { - mc.getIntegratedServer().shareToLAN(GameType.getByName("survival"), false, HttpUtil.getSuitableLanPort()); + mc.getIntegratedServer().shareToLAN(GameType.SURVIVAL, false, HttpUtil.getSuitableLanPort()); } // For the first 200 ticks, wait for the world to generate