From 5f12f04e873c6d63eb79bd30692178fbba69634f Mon Sep 17 00:00:00 2001 From: SuperOP535 <27556391+SuperOP535@users.noreply.github.com> Date: Wed, 1 May 2019 14:05:47 +0200 Subject: [PATCH 01/19] Automatic CRLF -> LF normalization --- .gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..176a458f9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto From 0ffbb0c15112e029534acad1e9dc92d0e90a2ebc Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 2 May 2019 11:47:35 -0700 Subject: [PATCH 02/19] quiet --- src/main/java/baritone/cache/ContainerMemory.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/baritone/cache/ContainerMemory.java b/src/main/java/baritone/cache/ContainerMemory.java index c1cb7b34d..e79435e3a 100644 --- a/src/main/java/baritone/cache/ContainerMemory.java +++ b/src/main/java/baritone/cache/ContainerMemory.java @@ -29,6 +29,7 @@ import net.minecraft.util.math.BlockPos; import java.io.IOException; import java.nio.file.Files; +import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.util.*; @@ -45,6 +46,8 @@ public class ContainerMemory implements IContainerMemory { this.saveTo = saveTo; try { read(Files.readAllBytes(saveTo)); + } catch (NoSuchFileException ignored) { + inventories.clear(); } catch (Exception ex) { ex.printStackTrace(); inventories.clear(); From 77303b4a629c467d79964ff5c6ac71df4dd14ff4 Mon Sep 17 00:00:00 2001 From: evilsourcerer Date: Fri, 3 May 2019 01:48:37 -0400 Subject: [PATCH 03/19] render boxes for goalYLevel --- .gitignore | 2 +- src/api/java/baritone/api/Settings.java | 4 +++- .../java/baritone/api/pathing/goals/GoalYLevel.java | 2 +- src/main/java/baritone/utils/PathRenderer.java | 12 +++++++++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index de408ec06..0834b1e85 100644 --- a/.gitignore +++ b/.gitignore @@ -18,4 +18,4 @@ classes/ # Copyright Files !/.idea/copyright/Baritone.xml -!/.idea/copyright/profiles_settings.xml \ No newline at end of file +!/.idea/copyright/profiles_settings.xml diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index a2de8b40c..aa181a39d 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -30,8 +30,8 @@ import java.awt.*; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; -import java.util.*; import java.util.List; +import java.util.*; import java.util.function.Consumer; /** @@ -81,6 +81,8 @@ public final class Settings { */ public final Setting jumpPenalty = new Setting<>(2D); + public final Setting yLevelBoxSize = new Setting<>(15D); + /** * Walking on water uses up hunger really quick, so penalize it */ diff --git a/src/api/java/baritone/api/pathing/goals/GoalYLevel.java b/src/api/java/baritone/api/pathing/goals/GoalYLevel.java index ce54eebb7..9add7176a 100644 --- a/src/api/java/baritone/api/pathing/goals/GoalYLevel.java +++ b/src/api/java/baritone/api/pathing/goals/GoalYLevel.java @@ -29,7 +29,7 @@ public class GoalYLevel implements Goal, ActionCosts { /** * The target Y level */ - private final int level; + public final int level; public GoalYLevel(int level) { this.level = level; diff --git a/src/main/java/baritone/utils/PathRenderer.java b/src/main/java/baritone/utils/PathRenderer.java index d1afe34d6..88a181470 100644 --- a/src/main/java/baritone/utils/PathRenderer.java +++ b/src/main/java/baritone/utils/PathRenderer.java @@ -276,13 +276,13 @@ public final class PathRenderer implements Helper { double maxY; double y1; double y2; + double y = MathHelper.cos((float) (((float) ((System.nanoTime() / 100000L) % 20000L)) / 20000F * Math.PI * 2)); if (goal instanceof IGoalRenderPos) { BlockPos goalPos = ((IGoalRenderPos) goal).getGoalPos(); minX = goalPos.getX() + 0.002 - renderPosX; maxX = goalPos.getX() + 1 - 0.002 - renderPosX; minZ = goalPos.getZ() + 0.002 - renderPosZ; maxZ = goalPos.getZ() + 1 - 0.002 - renderPosZ; - double y = MathHelper.cos((float) (((float) ((System.nanoTime() / 100000L) % 20000L)) / 20000F * Math.PI * 2)); if (goal instanceof GoalGetToBlock || goal instanceof GoalTwoBlocks) { y /= 2; } @@ -341,6 +341,16 @@ public final class PathRenderer implements Helper { drawDankLitGoalBox(player, g, partialTicks, color); } return; + } else if (goal instanceof GoalYLevel) { + GoalYLevel goalpos = (GoalYLevel) goal; + minX = player.posX - Baritone.settings().yLevelBoxSize.value - renderPosX; + minZ = player.posZ - Baritone.settings().yLevelBoxSize.value - renderPosZ; + maxX = player.posX + Baritone.settings().yLevelBoxSize.value - renderPosX; + maxZ = player.posZ + Baritone.settings().yLevelBoxSize.value - renderPosZ; + minY = ((GoalYLevel) goal).level - renderPosY; + maxY = minY + 2; + y1 = 1 + y + goalpos.level - renderPosY; + y2 = 1 - y + goalpos.level - renderPosY; } else { return; } From 0f09a4654058f2adb0583a9687027bc3ef26bc81 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 2 May 2019 23:03:10 -0700 Subject: [PATCH 04/19] javadoc --- src/api/java/baritone/api/Settings.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index aa181a39d..7a63fef73 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -30,8 +30,8 @@ import java.awt.*; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; -import java.util.List; import java.util.*; +import java.util.List; import java.util.function.Consumer; /** @@ -81,6 +81,9 @@ public final class Settings { */ public final Setting jumpPenalty = new Setting<>(2D); + /** + * The size of the box that is rendered when the current goal is a GoalYLevel + */ public final Setting yLevelBoxSize = new Setting<>(15D); /** From 2a5ef35794e934306cfbd7a56bb7204d0d2b86a3 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 3 May 2019 11:44:37 -0700 Subject: [PATCH 05/19] move this down to the other render settings --- src/api/java/baritone/api/Settings.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 7a63fef73..76ea0e9a2 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -81,11 +81,6 @@ public final class Settings { */ public final Setting jumpPenalty = new Setting<>(2D); - /** - * The size of the box that is rendered when the current goal is a GoalYLevel - */ - public final Setting yLevelBoxSize = new Setting<>(15D); - /** * Walking on water uses up hunger really quick, so penalize it */ @@ -804,6 +799,11 @@ public final class Settings { */ public final Setting> logger = new Setting<>(Minecraft.getMinecraft().ingameGUI.getChatGUI()::printChatMessage); + /** + * The size of the box that is rendered when the current goal is a GoalYLevel + */ + public final Setting yLevelBoxSize = new Setting<>(15D); + /** * The color of the current path */ From 7dcd7384f14a6e8cf4ac7259a1754698b9219cfb Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 4 May 2019 15:01:11 -0700 Subject: [PATCH 06/19] allow overshooting traverse --- src/api/java/baritone/api/Settings.java | 7 +++++++ .../pathing/movement/movements/MovementTraverse.java | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 76ea0e9a2..0c2c5d4b3 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -215,6 +215,13 @@ public final class Settings { */ public final Setting sprintAscends = new Setting<>(true); + /** + * 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 + */ + public final Setting overshootTraverse = new Setting<>(true); + /** * When breaking blocks for a movement, wait until all falling blocks have settled before continuing */ diff --git a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java index 4f7ae7134..a9266f14c 100644 --- a/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java +++ b/src/main/java/baritone/pathing/movement/movements/MovementTraverse.java @@ -36,8 +36,6 @@ import net.minecraft.init.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import java.util.Objects; - public class MovementTraverse extends Movement { /** @@ -230,7 +228,11 @@ public class MovementTraverse extends Movement { } if (isTheBridgeBlockThere) { - if (ctx.playerFeet().equals(dest)) { + BetterBlockPos feet = ctx.playerFeet(); + if (feet.equals(dest)) { + return state.setStatus(MovementStatus.SUCCESS); + } + if (Baritone.settings().overshootTraverse.value && (feet.equals(dest.add(getDirection())) || feet.equals(dest.add(getDirection()).add(getDirection())))) { return state.setStatus(MovementStatus.SUCCESS); } Block low = BlockStateInterface.get(ctx, src).getBlock(); From 482d874af2206b63d14bad38ee774953d4d899c0 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 5 May 2019 23:57:56 -0700 Subject: [PATCH 07/19] this counts as a commit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 93b114743..50d2acfd0 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Here are some links to help to get started: # API -The API is heavily documented, you can find the Javadocs for the latest release [here](https://baritone.leijurv.com/). +The API is heavily documented, you can find the Javadocs for the latest release [here](https://baritone.leijurv.com). Please note that usage of anything located outside of the ``baritone.api`` package is not supported by the API release jar. From 1501d721e7a56bf4ebbe541698a94cd6dbcbded4 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 6 May 2019 14:01:01 -0700 Subject: [PATCH 08/19] build repeat vector --- src/api/java/baritone/api/Settings.java | 11 +++-------- src/api/java/baritone/api/utils/SettingsUtil.java | 6 ++++++ src/main/java/baritone/process/BuilderProcess.java | 12 ++++-------- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 0c2c5d4b3..17bacf06c 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -23,7 +23,7 @@ import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.init.Blocks; import net.minecraft.item.Item; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.Vec3i; import net.minecraft.util.text.ITextComponent; import java.awt.*; @@ -663,14 +663,9 @@ public final class Settings { public final Setting buildInLayers = new Setting<>(false); /** - * How far to move before repeating the build. -1 for the size of the build in that axis. 0 to disable + * How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely */ - public final Setting buildRepeatDistance = new Setting<>(0); - - /** - * What direction to repeat the build in - */ - public final Setting buildRepeatDirection = new Setting<>(EnumFacing.NORTH); + public final Setting buildRepeat = new Setting<>(new Vec3i(0, 0, 0)); /** * Allow standing above a block while mining it, in BuilderProcess diff --git a/src/api/java/baritone/api/utils/SettingsUtil.java b/src/api/java/baritone/api/utils/SettingsUtil.java index b494c662a..5dee6e884 100644 --- a/src/api/java/baritone/api/utils/SettingsUtil.java +++ b/src/api/java/baritone/api/utils/SettingsUtil.java @@ -21,6 +21,7 @@ import baritone.api.Settings; import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.Vec3i; import java.awt.*; import java.io.BufferedReader; @@ -179,6 +180,11 @@ public class SettingsUtil { str -> new Color(Integer.parseInt(str.split(",")[0]), Integer.parseInt(str.split(",")[1]), Integer.parseInt(str.split(",")[2])), color -> color.getRed() + "," + color.getGreen() + "," + color.getBlue() ), + VEC3I( + Vec3i.class, + str -> new Vec3i(Integer.parseInt(str.split(",")[0]), Integer.parseInt(str.split(",")[1]), Integer.parseInt(str.split(",")[2])), + vec -> vec.getX() + "," + vec.getY() + "," + vec.getZ() + ), BLOCK( Block.class, str -> BlockUtils.stringToBlockRequired(str.trim()), diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index c08ca8c6e..230edf0d8 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -330,20 +330,16 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro layer++; return onTick(calcFailed, isSafeToCancel); } - int distance = Baritone.settings().buildRepeatDistance.value; - EnumFacing direction = Baritone.settings().buildRepeatDirection.value; - if (distance == 0) { + Vec3i repeat = Baritone.settings().buildRepeat.value; + if (repeat.equals(new Vec3i(0, 0, 0))) { logDirect("Done building"); onLostControl(); return null; } // build repeat time - if (distance == -1) { - distance = schematic.size(direction.getAxis()); - } layer = 0; - origin = new BlockPos(origin).offset(direction, distance); - logDirect("Repeating build " + distance + " blocks to the " + direction + ", new origin is " + origin); + origin = new BlockPos(origin).add(repeat); + logDirect("Repeating build in vector " + repeat + ", new origin is " + origin); return onTick(calcFailed, isSafeToCancel); } trim(bcc); From da8bf6b1b3c8a3d0e428874de906fc4c2ff29f56 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 6 May 2019 14:07:46 -0700 Subject: [PATCH 09/19] fix a potential concurrency issue --- 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 230edf0d8..81f790b6d 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -301,6 +301,7 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro if (realSchematic == null) { realSchematic = schematic; } + ISchematic realSchematic = this.realSchematic; // wrap this properly, dont just have the inner class refer to the builderprocess.this schematic = new ISchematic() { @Override public IBlockState desiredState(int x, int y, int z) { From c738007538563921487ba75c4353f243cbd971e9 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 7 May 2019 21:40:03 -0800 Subject: [PATCH 10/19] epic label --- src/main/java/baritone/process/MineProcess.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index e8368d877..59c2d3703 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -88,14 +88,14 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro return null; } } - boolean shouldCancel = calcFailed; - if (calcFailed && !knownOreLocations.isEmpty() && Baritone.settings().blacklistClosestOnFailure.value) { - logDirect("Unable to find any path to " + mining + ", blacklisting presumably unreachable closest instance..."); - knownOreLocations.stream().min(Comparator.comparingDouble(ctx.player()::getDistanceSq)).ifPresent(blacklist::add); - knownOreLocations.removeIf(blacklist::contains); - shouldCancel = false; // 😎 - } - if (shouldCancel) { + CANCEL: + if (calcFailed) { + if (!knownOreLocations.isEmpty() && Baritone.settings().blacklistClosestOnFailure.value) { + logDirect("Unable to find any path to " + mining + ", blacklisting presumably unreachable closest instance..."); + knownOreLocations.stream().min(Comparator.comparingDouble(ctx.player()::getDistanceSq)).ifPresent(blacklist::add); + knownOreLocations.removeIf(blacklist::contains); + break CANCEL; // 😎 + } logDirect("Unable to find any path to " + mining + ", canceling Mine"); cancel(); return null; From c9e81897a5d3105fbf1fdff78a43f147363f642f Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 8 May 2019 11:51:48 -0700 Subject: [PATCH 11/19] im blind lol thanks babj --- src/main/java/baritone/process/MineProcess.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/baritone/process/MineProcess.java b/src/main/java/baritone/process/MineProcess.java index 59c2d3703..ca1b3490a 100644 --- a/src/main/java/baritone/process/MineProcess.java +++ b/src/main/java/baritone/process/MineProcess.java @@ -88,17 +88,16 @@ public final class MineProcess extends BaritoneProcessHelper implements IMinePro return null; } } - CANCEL: if (calcFailed) { if (!knownOreLocations.isEmpty() && Baritone.settings().blacklistClosestOnFailure.value) { logDirect("Unable to find any path to " + mining + ", blacklisting presumably unreachable closest instance..."); knownOreLocations.stream().min(Comparator.comparingDouble(ctx.player()::getDistanceSq)).ifPresent(blacklist::add); knownOreLocations.removeIf(blacklist::contains); - break CANCEL; // 😎 + } else { + logDirect("Unable to find any path to " + mining + ", canceling Mine"); + cancel(); + return null; } - logDirect("Unable to find any path to " + mining + ", canceling Mine"); - cancel(); - return null; } int mineGoalUpdateInterval = Baritone.settings().mineGoalUpdateInterval.value; List curr = new ArrayList<>(knownOreLocations); From 264b3db63c912857db528cce000e5170ddac4f06 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 9 May 2019 15:20:37 -0700 Subject: [PATCH 12/19] this counts as a commit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 50d2acfd0..71e60aa49 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ [![HitCount](http://hits.dwyl.com/cabaletta/baritone.svg)](http://hits.dwyl.com/cabaletta/baritone) [![Code of Conduct](https://img.shields.io/badge/%E2%9D%A4-code%20of%20conduct-blue.svg?style=flat)](https://github.com/cabaletta/baritone/blob/master/CODE_OF_CONDUCT.md) [![Known Vulnerabilities](https://snyk.io/test/github/cabaletta/baritone/badge.svg?targetFile=build.gradle)](https://snyk.io/test/github/cabaletta/baritone?targetFile=build.gradle) -[![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/cabaletta/baritone/issues) +[![Contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat)](https://github.com/cabaletta/baritone/issues) [![Issues](https://img.shields.io/github/issues/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/issues/) [![GitHub issues-closed](https://img.shields.io/github/issues-closed/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/issues?q=is%3Aissue+is%3Aclosed) [![Pull Requests](https://img.shields.io/github/issues-pr/cabaletta/baritone.svg)](https://github.com/cabaletta/baritone/pulls/) From 79d448e5f435aed0d51c6f1b15cd8cb13eb6bd8f Mon Sep 17 00:00:00 2001 From: Leijurv Date: Fri, 10 May 2019 23:55:50 -0700 Subject: [PATCH 13/19] add crucial explanation --- 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 17bacf06c..ab04d334d 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -646,7 +646,7 @@ public final class Settings { public final Setting exploreMaintainY = new Setting<>(64); /** - * Replant nether wart + * Replant nether wart while farming */ public final Setting replantNetherWart = new Setting<>(false); From 6a13e94c4fd942e0d0696c2504680e580c30a1dd Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sat, 11 May 2019 21:13:46 -0700 Subject: [PATCH 14/19] warning --- src/api/java/baritone/api/Settings.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index ab04d334d..56fb949ef 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -545,6 +545,8 @@ public final class Settings { /** * Exclusively use cached chunks for pathing + *

+ * Never turn this on */ public final Setting pathThroughCachedOnly = new Setting<>(false); From 0293a767025ae8c9c838589b3b5936deaa852ba1 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Sun, 12 May 2019 23:25:50 -0700 Subject: [PATCH 15/19] less yikes --- src/main/java/baritone/process/BuilderProcess.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 81f790b6d..7fb1b0aec 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -456,7 +456,7 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro observedCompleted.add(BetterBlockPos.longHash(pos)); } else { incorrectPositions.add(pos); - observedCompleted.rem(BetterBlockPos.longHash(pos)); + observedCompleted.remove(BetterBlockPos.longHash(pos)); } } } @@ -481,7 +481,7 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro observedCompleted.add(BetterBlockPos.longHash(blockX, blockY, blockZ)); } else { incorrectPositions.add(new BetterBlockPos(blockX, blockY, blockZ)); - observedCompleted.rem(BetterBlockPos.longHash(blockX, blockY, blockZ)); + observedCompleted.remove(BetterBlockPos.longHash(blockX, blockY, blockZ)); } continue; } From b2f38807225491224028fe6ca4477e5f5e431a21 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Mon, 13 May 2019 20:13:22 -0800 Subject: [PATCH 16/19] add todo --- src/api/java/baritone/api/utils/BetterBlockPos.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/api/java/baritone/api/utils/BetterBlockPos.java b/src/api/java/baritone/api/utils/BetterBlockPos.java index a1a3cb320..3b94a8339 100644 --- a/src/api/java/baritone/api/utils/BetterBlockPos.java +++ b/src/api/java/baritone/api/utils/BetterBlockPos.java @@ -61,6 +61,8 @@ public final class BetterBlockPos extends BlockPos { } public static long longHash(int x, int y, int z) { + // TODO use the same thing as BlockPos.fromLong(); + // invertibility would be incredibly useful /* * This is the hashcode implementation of Vec3i (the superclass of the class which I shall not name) * From da58988f017e884faee4ab79f8749ace9d4f334a Mon Sep 17 00:00:00 2001 From: Leijurv Date: Tue, 14 May 2019 16:03:11 -0700 Subject: [PATCH 17/19] build in layers order --- src/api/java/baritone/api/Settings.java | 7 +++++++ .../java/baritone/process/BuilderProcess.java | 18 +++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/api/java/baritone/api/Settings.java b/src/api/java/baritone/api/Settings.java index 56fb949ef..ed17ce179 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -664,6 +664,13 @@ public final class Settings { */ public final Setting buildInLayers = new Setting<>(false); + /** + * false = build from bottom to top + *

+ * true = build from top to bottom + */ + public final Setting layerOrder = new Setting<>(false); + /** * How far to move before repeating the build. 0 to disable repeating on a certain axis, 0,0,0 to disable entirely */ diff --git a/src/main/java/baritone/process/BuilderProcess.java b/src/main/java/baritone/process/BuilderProcess.java index 7fb1b0aec..17424345c 100644 --- a/src/main/java/baritone/process/BuilderProcess.java +++ b/src/main/java/baritone/process/BuilderProcess.java @@ -302,12 +302,28 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro realSchematic = schematic; } ISchematic realSchematic = this.realSchematic; // wrap this properly, dont just have the inner class refer to the builderprocess.this + int minYInclusive; + int maxYInclusive; + // layer = 0 should be nothing + // layer = realSchematic.heightY() should be everything + if (Baritone.settings().layerOrder.value) { // top to bottom + maxYInclusive = realSchematic.heightY() - 1; + minYInclusive = realSchematic.heightY() - layer; + } else { + maxYInclusive = layer - 1; + minYInclusive = 0; + } schematic = new ISchematic() { @Override public IBlockState desiredState(int x, int y, int z) { return realSchematic.desiredState(x, y, z); } + @Override + public boolean inSchematic(int x, int y, int z) { + return ISchematic.super.inSchematic(x, y, z) && y >= minYInclusive && y <= maxYInclusive; + } + @Override public int widthX() { return realSchematic.widthX(); @@ -315,7 +331,7 @@ public class BuilderProcess extends BaritoneProcessHelper implements IBuilderPro @Override public int heightY() { - return layer; + return realSchematic.heightY(); } @Override From 0dd4834e18f472812adbe4c7540c5a0f174a0b9c Mon Sep 17 00:00:00 2001 From: Leijurv Date: Wed, 15 May 2019 21:55:01 -0800 Subject: [PATCH 18/19] add explanation --- 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 ed17ce179..031443f4f 100644 --- a/src/api/java/baritone/api/Settings.java +++ b/src/api/java/baritone/api/Settings.java @@ -577,7 +577,7 @@ public final class Settings { public final Setting renderCachedChunks = new Setting<>(false); /** - * 0.0f = not visible, fully transparent + * 0.0f = not visible, fully transparent (instead of setting this to 0, turn off renderCachedChunks) * 1.0f = fully opaque */ public final Setting cachedChunksOpacity = new Setting<>(0.5f); From 6861bfd4e667c9c23a8849e3efc42049fa6b6205 Mon Sep 17 00:00:00 2001 From: Leijurv Date: Thu, 16 May 2019 11:50:48 -0700 Subject: [PATCH 19/19] relative goals --- .../baritone/api/utils/ExampleBaritoneControl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/api/java/baritone/api/utils/ExampleBaritoneControl.java b/src/api/java/baritone/api/utils/ExampleBaritoneControl.java index 715d8edba..67cd5b472 100644 --- a/src/api/java/baritone/api/utils/ExampleBaritoneControl.java +++ b/src/api/java/baritone/api/utils/ExampleBaritoneControl.java @@ -688,18 +688,20 @@ public class ExampleBaritoneControl implements Helper, AbstractGameEventListener private Goal parseGoal(String[] params) { Goal goal; try { + BetterBlockPos playerFeet = ctx.playerFeet(); switch (params.length) { case 0: - goal = new GoalBlock(ctx.playerFeet()); + goal = new GoalBlock(playerFeet); break; case 1: - goal = new GoalYLevel(Integer.parseInt(params[0])); + + goal = new GoalYLevel(parseOrDefault(params[0], playerFeet.y)); break; case 2: - goal = new GoalXZ(Integer.parseInt(params[0]), Integer.parseInt(params[1])); + goal = new GoalXZ(parseOrDefault(params[0], playerFeet.x), parseOrDefault(params[1], playerFeet.z)); break; case 3: - goal = new GoalBlock(new BlockPos(Integer.parseInt(params[0]), Integer.parseInt(params[1]), Integer.parseInt(params[2]))); + goal = new GoalBlock(new BlockPos(parseOrDefault(params[0], playerFeet.x), parseOrDefault(params[1], playerFeet.y), parseOrDefault(params[2], playerFeet.z))); break; default: logDirect("unable to understand lol");