diff --git a/src/main/java/baritone/bot/Settings.java b/src/main/java/baritone/bot/Settings.java index d9fe7db1..48ad9679 100644 --- a/src/main/java/baritone/bot/Settings.java +++ b/src/main/java/baritone/bot/Settings.java @@ -29,6 +29,8 @@ public class Settings { public boolean chuckCaching = false; public boolean allowWaterBucketFall = true; public int planningTickLookAhead = 150; + public boolean renderPath = true; + public boolean chatDebug = true; Settings() { diff --git a/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java b/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java index 2ffb36d2..074d2b04 100644 --- a/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java +++ b/src/main/java/baritone/bot/behavior/impl/PathingBehavior.java @@ -42,7 +42,8 @@ public class PathingBehavior extends Behavior { public static final PathingBehavior INSTANCE = new PathingBehavior(); - private PathingBehavior() {} + private PathingBehavior() { + } private PathExecutor current; private PathExecutor next; @@ -274,6 +275,9 @@ public class PathingBehavior extends Behavior { @Override public void onRenderPass(RenderEvent event) { + if (!Baritone.settings().renderPath) { + return; + } // System.out.println("Render passing"); // System.out.println(event.getPartialTicks()); float partialTicks = event.getPartialTicks(); diff --git a/src/main/java/baritone/bot/event/GameEventHandler.java b/src/main/java/baritone/bot/event/GameEventHandler.java index 7c9f03a1..a6fd77d1 100644 --- a/src/main/java/baritone/bot/event/GameEventHandler.java +++ b/src/main/java/baritone/bot/event/GameEventHandler.java @@ -130,17 +130,19 @@ public final class GameEventHandler implements IGameEventListener, Helper { @Override public void onWorldEvent(WorldEvent event) { - CachedWorldProvider cache = CachedWorldProvider.INSTANCE; + if (Baritone.settings().chuckCaching) { + CachedWorldProvider cache = CachedWorldProvider.INSTANCE; - switch (event.getState()) { - case PRE: - cache.ifWorldLoaded(CachedWorld::save); - break; - case POST: - cache.closeWorld(); - if (event.getWorld() != null) - cache.initWorld(event.getWorld()); - break; + switch (event.getState()) { + case PRE: + cache.ifWorldLoaded(CachedWorld::save); + break; + case POST: + cache.closeWorld(); + if (event.getWorld() != null) + cache.initWorld(event.getWorld()); + break; + } } dispatch(behavior -> behavior.onWorldEvent(event)); diff --git a/src/main/java/baritone/bot/pathing/calc/AStarPathFinder.java b/src/main/java/baritone/bot/pathing/calc/AStarPathFinder.java index 242911f9..3de70552 100644 --- a/src/main/java/baritone/bot/pathing/calc/AStarPathFinder.java +++ b/src/main/java/baritone/bot/pathing/calc/AStarPathFinder.java @@ -34,6 +34,7 @@ package baritone.bot.pathing.calc; +import baritone.bot.Baritone; import baritone.bot.chunk.CachedWorldProvider; import baritone.bot.pathing.calc.openset.BinaryHeapOpenSet; import baritone.bot.pathing.calc.openset.IOpenSet; @@ -86,6 +87,7 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { int numNodes = 0; CalculationContext calcContext = new CalculationContext(); int numEmptyChunk = 0; + boolean cache = Baritone.settings().chuckCaching; while (!openSet.isEmpty() && numEmptyChunk < 50 && System.currentTimeMillis() < timeoutTime) { if (slowPath) { try { @@ -117,11 +119,14 @@ public class AStarPathFinder extends AbstractNodeCostSearch implements Helper { } boolean isPositionCached = false; - if (CachedWorldProvider.INSTANCE.getCurrentWorld() != null) - if (CachedWorldProvider.INSTANCE.getCurrentWorld().getBlockType(movementToGetToNeighbor.getDest()) != null) - isPositionCached = true; - - if (Minecraft.getMinecraft().world.getChunk(movementToGetToNeighbor.getDest()) instanceof EmptyChunk && !isPositionCached) { + if (cache) { + if (CachedWorldProvider.INSTANCE.getCurrentWorld() != null) { + if (CachedWorldProvider.INSTANCE.getCurrentWorld().getBlockType(movementToGetToNeighbor.getDest()) != null) { + isPositionCached = true; + } + } + } + if (!isPositionCached && Minecraft.getMinecraft().world.getChunk(movementToGetToNeighbor.getDest()) instanceof EmptyChunk) { numEmptyChunk++; continue; } diff --git a/src/main/java/baritone/bot/utils/BlockStateInterface.java b/src/main/java/baritone/bot/utils/BlockStateInterface.java index 23aa88e3..7ab42c1d 100644 --- a/src/main/java/baritone/bot/utils/BlockStateInterface.java +++ b/src/main/java/baritone/bot/utils/BlockStateInterface.java @@ -17,6 +17,7 @@ package baritone.bot.utils; +import baritone.bot.Baritone; import baritone.bot.chunk.CachedWorld; import baritone.bot.chunk.CachedWorldProvider; import baritone.bot.utils.pathing.PathingBlockType; @@ -39,7 +40,8 @@ public class BlockStateInterface implements Helper { Chunk chunk = mc.world.getChunk(pos); if (chunk.isLoaded()) { return chunk.getBlockState(pos); - } else { + } + if(Baritone.settings().chuckCaching) { CachedWorld world = CachedWorldProvider.INSTANCE.getCurrentWorld(); if (world != null) { PathingBlockType type = world.getBlockType(pos); diff --git a/src/main/java/baritone/bot/utils/Helper.java b/src/main/java/baritone/bot/utils/Helper.java index 0bc696f4..ffa3094d 100755 --- a/src/main/java/baritone/bot/utils/Helper.java +++ b/src/main/java/baritone/bot/utils/Helper.java @@ -17,6 +17,7 @@ package baritone.bot.utils; +import baritone.bot.Baritone; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.GuiNewChat; @@ -69,6 +70,11 @@ public interface Helper { } default void displayChatMessageRaw(String message) { + if (!Baritone.settings().chatDebug) { + System.out.println("Suppressed debug message:"); + System.out.println(message); + return; + } GuiNewChat gui = mc.ingameGUI.getChatGUI(); int normalMaxWidth = MathHelper.floor((float) gui.getChatWidth() / gui.getChatScale()); int widthWithStyleFormat = normalMaxWidth - 2;