From b3f06c6faca82182273816a8ae8e3d01e69f4f19 Mon Sep 17 00:00:00 2001 From: Brady Date: Tue, 25 Sep 2018 20:54:33 -0500 Subject: [PATCH 1/4] Allow pause on lost focus --- src/main/java/baritone/utils/BaritoneAutoTest.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/baritone/utils/BaritoneAutoTest.java b/src/main/java/baritone/utils/BaritoneAutoTest.java index 7bf334e36..d0faa970a 100644 --- a/src/main/java/baritone/utils/BaritoneAutoTest.java +++ b/src/main/java/baritone/utils/BaritoneAutoTest.java @@ -55,7 +55,6 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper { s.particleSetting = 2; s.overrideWidth = 128; s.overrideHeight = 128; - s.pauseOnLostFocus = false; s.heldItemTooltips = false; s.entityShadows = false; s.chatScale = 0.0F; From d9596fcac99a725220716e6922e157cffee1fd53 Mon Sep 17 00:00:00 2001 From: Brady Date: Tue, 25 Sep 2018 23:16:20 -0500 Subject: [PATCH 2/4] Travis may actually take 10 seconds to load in --- src/main/java/baritone/utils/BaritoneAutoTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/utils/BaritoneAutoTest.java b/src/main/java/baritone/utils/BaritoneAutoTest.java index d0faa970a..f3f95122e 100644 --- a/src/main/java/baritone/utils/BaritoneAutoTest.java +++ b/src/main/java/baritone/utils/BaritoneAutoTest.java @@ -82,7 +82,7 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper { if (mc.isSingleplayer() && !mc.getIntegratedServer().getPublic()) { mc.getIntegratedServer().shareToLAN(GameType.getByName("survival"), false); } - if (event.getCount() < 100) { + if (event.getCount() < 200) { System.out.println("Waiting for world to generate... " + event.getCount()); return; } From 36651553fe03d4040b8591186c8c41ae45c0731b Mon Sep 17 00:00:00 2001 From: Brady Date: Tue, 25 Sep 2018 23:17:15 -0500 Subject: [PATCH 3/4] Increase max ticks accordingly See last commit --- src/main/java/baritone/utils/BaritoneAutoTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/baritone/utils/BaritoneAutoTest.java b/src/main/java/baritone/utils/BaritoneAutoTest.java index f3f95122e..ac89eb00b 100644 --- a/src/main/java/baritone/utils/BaritoneAutoTest.java +++ b/src/main/java/baritone/utils/BaritoneAutoTest.java @@ -41,7 +41,7 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper { private static final long TEST_SEED = -928872506371745L; private static final BlockPos STARTING_POSITION = new BlockPos(50, 65, 50); private static final Goal GOAL = new GoalBlock(69, 121, 420); - private static final int MAX_TICKS = 3200; + private static final int MAX_TICKS = 3300; /** * Called right after the {@link GameSettings} object is created in the {@link Minecraft} instance. From d899ff7f7b899d7adfc7fa548cc833c7d7679059 Mon Sep 17 00:00:00 2001 From: Brady Date: Tue, 25 Sep 2018 23:24:48 -0500 Subject: [PATCH 4/4] 2 iq --- .../java/baritone/utils/BaritoneAutoTest.java | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/main/java/baritone/utils/BaritoneAutoTest.java b/src/main/java/baritone/utils/BaritoneAutoTest.java index ac89eb00b..f52dda2ea 100644 --- a/src/main/java/baritone/utils/BaritoneAutoTest.java +++ b/src/main/java/baritone/utils/BaritoneAutoTest.java @@ -68,33 +68,52 @@ public class BaritoneAutoTest implements AbstractGameEventListener, Helper { @Override public void onTick(TickEvent event) { - if (mc.currentScreen != null && mc.currentScreen instanceof GuiMainMenu) { + + // If we're on the main menu then create the test world and launch the integrated server + 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.setGeneratorOptions(""); mc.launchIntegratedServer("BaritoneAutoTest", "BaritoneAutoTest", worldsettings); } + + // If the integrated server is launched and the world has initialized, set the spawn point + // to our defined starting position if (mc.getIntegratedServer() != null && mc.getIntegratedServer().worlds[0] != null) { mc.getIntegratedServer().worlds[0].setSpawnPoint(STARTING_POSITION); } - if (event.getType() == TickEvent.Type.IN) { + + if (event.getType() == TickEvent.Type.IN) { // If we're in-game + + // 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); } + + // For the first 200 ticks, wait for the world to generate if (event.getCount() < 200) { System.out.println("Waiting for world to generate... " + event.getCount()); return; } - if (event.getCount() % 100 == 0) { // print only once every 5 seconds + + // Print out an update of our position every 5 seconds + if (event.getCount() % 100 == 0) { System.out.println(playerFeet() + " " + event.getCount()); } + + // Setup Baritone's pathing goal and (if needed) begin pathing PathingBehavior.INSTANCE.setGoal(GOAL); PathingBehavior.INSTANCE.path(); + + // If we have reached our goal, print a message and safely close the game if (GOAL.isInGoal(playerFeet())) { System.out.println("Successfully pathed to " + playerFeet() + " in " + event.getCount() + " ticks"); mc.shutdown(); } + + // If we have exceeded the expected number of ticks to complete the pathing + // task, then throw an IllegalStateException to cause the build to fail if (event.getCount() > MAX_TICKS) { throw new IllegalStateException("took too long"); }