From cca35b3fd3ae04b48d5bd05666adef45d9e2d2f0 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 28 Dec 2024 21:31:13 +0100 Subject: [PATCH 01/13] Fix waitUntil() timeout not working --- src/main/java/net/wurstclient/test/WurstClientTestHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/net/wurstclient/test/WurstClientTestHelper.java b/src/main/java/net/wurstclient/test/WurstClientTestHelper.java index b949028a50..b685800a74 100644 --- a/src/main/java/net/wurstclient/test/WurstClientTestHelper.java +++ b/src/main/java/net/wurstclient/test/WurstClientTestHelper.java @@ -103,7 +103,7 @@ public static void waitUntil(String event, break; } - if(startTime.isAfter(timeout)) + if(LocalDateTime.now().isAfter(timeout)) throw new RuntimeException( "Waiting until " + event + " took too long"); From 13ab1616a5127f324156ebd5e2ccc4b6dd9955f8 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 28 Dec 2024 21:42:48 +0100 Subject: [PATCH 02/13] Eclipse clean up --- src/main/java/net/wurstclient/test/NoFallHackTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/wurstclient/test/NoFallHackTest.java b/src/main/java/net/wurstclient/test/NoFallHackTest.java index dc8d96b17c..0593cee994 100644 --- a/src/main/java/net/wurstclient/test/NoFallHackTest.java +++ b/src/main/java/net/wurstclient/test/NoFallHackTest.java @@ -59,9 +59,9 @@ private static void assertOnGround() private static void assertPlayerHealth(Predicate healthCheck) { float health = submitAndGet(mc -> mc.player.getHealth()); - if(healthCheck.test(health)) - System.out.println("Player's health is correct: " + health); - else + if(!healthCheck.test(health)) throw new RuntimeException("Player's health is wrong: " + health); + + System.out.println("Player's health is correct: " + health); } } From b1511bce21ebfc5956c840357bb944e0c569b23d Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sat, 28 Dec 2024 21:44:14 +0100 Subject: [PATCH 03/13] Add AutoMineHackTest --- .../wurstclient/test/AutoMineHackTest.java | 49 +++++++++++++++++++ .../wurstclient/test/WurstE2ETestClient.java | 1 + 2 files changed, 50 insertions(+) create mode 100644 src/main/java/net/wurstclient/test/AutoMineHackTest.java diff --git a/src/main/java/net/wurstclient/test/AutoMineHackTest.java b/src/main/java/net/wurstclient/test/AutoMineHackTest.java new file mode 100644 index 0000000000..facfa87138 --- /dev/null +++ b/src/main/java/net/wurstclient/test/AutoMineHackTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2014-2024 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.test; + +import static net.wurstclient.test.WurstClientTestHelper.*; + +import net.minecraft.block.Block; +import net.minecraft.block.Blocks; +import net.minecraft.util.math.BlockPos; + +public enum AutoMineHackTest +{ + ; + + public static void testAutoMineHack() + { + System.out.println("Testing AutoMine hack"); + runChatCommand("gamemode survival"); + + // Break a dirt block in survival mode + runChatCommand("setblock ~ ~1 ~2 minecraft:dirt"); + waitForBlock(0, 1, 2, Blocks.DIRT); + runWurstCommand("t AutoMine on"); + waitForBlock(0, 1, 2, Blocks.AIR); + takeScreenshot("automine_survival"); + + // Clean up + runWurstCommand("t AutoMine off"); + runChatCommand("gamemode creative"); + runChatCommand("kill @e[type=item]"); + runChatCommand("clear"); + clearChat(); + } + + private static void waitForBlock(int relX, int relY, int relZ, Block block) + { + BlockPos pos = + submitAndGet(mc -> mc.player.getBlockPos().add(relX, relY, relZ)); + waitUntil( + "block at ~" + relX + " ~" + relY + " ~" + relZ + " (" + + pos.toShortString() + ") is " + block, + mc -> mc.world.getBlockState(pos).getBlock() == block); + } +} diff --git a/src/main/java/net/wurstclient/test/WurstE2ETestClient.java b/src/main/java/net/wurstclient/test/WurstE2ETestClient.java index b3e5aefb84..483d09901b 100644 --- a/src/main/java/net/wurstclient/test/WurstE2ETestClient.java +++ b/src/main/java/net/wurstclient/test/WurstE2ETestClient.java @@ -118,6 +118,7 @@ private void runTests() clearChat(); // Test Wurst hacks + AutoMineHackTest.testAutoMineHack(); NoFallHackTest.testNoFallHack(); // Test Wurst commands From 9a3b4f7367bd5f69191fdc5801c9bce02aa86ed0 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 29 Dec 2024 13:55:21 +0100 Subject: [PATCH 04/13] Add PistonTest --- .../wurstclient/test/AutoMineHackTest.java | 12 ------ .../java/net/wurstclient/test/PistonTest.java | 42 +++++++++++++++++++ .../test/WurstClientTestHelper.java | 12 ++++++ .../wurstclient/test/WurstE2ETestClient.java | 3 ++ 4 files changed, 57 insertions(+), 12 deletions(-) create mode 100644 src/main/java/net/wurstclient/test/PistonTest.java diff --git a/src/main/java/net/wurstclient/test/AutoMineHackTest.java b/src/main/java/net/wurstclient/test/AutoMineHackTest.java index facfa87138..11287ba73f 100644 --- a/src/main/java/net/wurstclient/test/AutoMineHackTest.java +++ b/src/main/java/net/wurstclient/test/AutoMineHackTest.java @@ -9,9 +9,7 @@ import static net.wurstclient.test.WurstClientTestHelper.*; -import net.minecraft.block.Block; import net.minecraft.block.Blocks; -import net.minecraft.util.math.BlockPos; public enum AutoMineHackTest { @@ -36,14 +34,4 @@ public static void testAutoMineHack() runChatCommand("clear"); clearChat(); } - - private static void waitForBlock(int relX, int relY, int relZ, Block block) - { - BlockPos pos = - submitAndGet(mc -> mc.player.getBlockPos().add(relX, relY, relZ)); - waitUntil( - "block at ~" + relX + " ~" + relY + " ~" + relZ + " (" - + pos.toShortString() + ") is " + block, - mc -> mc.world.getBlockState(pos).getBlock() == block); - } } diff --git a/src/main/java/net/wurstclient/test/PistonTest.java b/src/main/java/net/wurstclient/test/PistonTest.java new file mode 100644 index 0000000000..bbe3cce1f6 --- /dev/null +++ b/src/main/java/net/wurstclient/test/PistonTest.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2014-2024 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.test; + +import static net.wurstclient.test.WurstClientTestHelper.*; + +import net.minecraft.block.Blocks; + +public enum PistonTest +{ + ; + + public static void testPistonDoesntCrash() + { + System.out.println( + "Testing that a piston can extend and retract without crashing the game"); + + // Place a redstone block and piston + runChatCommand("setblock ~ ~ ~2 minecraft:redstone_block"); + runChatCommand("setblock ~ ~1 ~2 minecraft:piston[facing=up]"); + waitForBlock(0, 0, 2, Blocks.REDSTONE_BLOCK); + waitForBlock(0, 1, 2, Blocks.PISTON); + takeScreenshot("piston_extending"); + waitForWorldTicks(3); + + // Destroy the redstone block + runChatCommand("setblock ~ ~ ~2 minecraft:air"); + waitForBlock(0, 0, 2, Blocks.AIR); + takeScreenshot("piston_retracting"); + waitForWorldTicks(3); + + // Clean up + runChatCommand("setblock ~ ~1 ~2 minecraft:air"); + waitForBlock(0, 1, 2, Blocks.AIR); + clearChat(); + } +} diff --git a/src/main/java/net/wurstclient/test/WurstClientTestHelper.java b/src/main/java/net/wurstclient/test/WurstClientTestHelper.java index b685800a74..003e74bc87 100644 --- a/src/main/java/net/wurstclient/test/WurstClientTestHelper.java +++ b/src/main/java/net/wurstclient/test/WurstClientTestHelper.java @@ -19,6 +19,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.block.Block; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.Drawable; import net.minecraft.client.gui.screen.GameMenuScreen; @@ -37,6 +38,7 @@ import net.minecraft.client.util.ScreenshotRecorder; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import net.wurstclient.WurstClient; public enum WurstClientTestHelper @@ -169,6 +171,16 @@ public static void waitForWorldTicks(int ticks) Duration.ofMillis(ticks * 100).plusMinutes(5)); } + public static void waitForBlock(int relX, int relY, int relZ, Block block) + { + BlockPos pos = + submitAndGet(mc -> mc.player.getBlockPos().add(relX, relY, relZ)); + waitUntil( + "block at ~" + relX + " ~" + relY + " ~" + relZ + " (" + + pos.toShortString() + ") is " + block, + mc -> mc.world.getBlockState(pos).getBlock() == block); + } + /** * Waits for 50ms and then takes a screenshot with the given name. */ diff --git a/src/main/java/net/wurstclient/test/WurstE2ETestClient.java b/src/main/java/net/wurstclient/test/WurstE2ETestClient.java index 483d09901b..34a1fc001a 100644 --- a/src/main/java/net/wurstclient/test/WurstE2ETestClient.java +++ b/src/main/java/net/wurstclient/test/WurstE2ETestClient.java @@ -128,6 +128,9 @@ private void runTests() // TODO: Test more Wurst features + // Test special cases + PistonTest.testPistonDoesntCrash(); + System.out.println("Opening game menu"); openGameMenu(); takeScreenshot("game_menu"); From 4b90ce8107dfce772e4f61ba506de80cd191b92f Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 29 Dec 2024 13:55:43 +0100 Subject: [PATCH 05/13] Change version to 7.46.6 --- gradle.properties | 2 +- src/main/java/net/wurstclient/WurstClient.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index c765610f58..141aabdfd3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -13,7 +13,7 @@ loader_version=0.16.9 fabric_version=0.112.0+1.21.4 # Mod Properties -mod_version = v7.46.5-MC1.21.4 +mod_version = v7.46.6-MC1.21.4 maven_group = net.wurstclient archives_base_name = Wurst-Client diff --git a/src/main/java/net/wurstclient/WurstClient.java b/src/main/java/net/wurstclient/WurstClient.java index 75f1233cb8..bc5ae0e8e1 100644 --- a/src/main/java/net/wurstclient/WurstClient.java +++ b/src/main/java/net/wurstclient/WurstClient.java @@ -50,7 +50,7 @@ public enum WurstClient public static MinecraftClient MC; public static IMinecraftClient IMC; - public static final String VERSION = "7.46.5"; + public static final String VERSION = "7.46.6"; public static final String MC_VERSION = "1.21.4"; private WurstAnalytics analytics; From 0effaa5abc3e566792e9ddfec4da062b6e2f6955 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 29 Dec 2024 13:57:54 +0100 Subject: [PATCH 06/13] Update Fabric stuff --- gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradle.properties b/gradle.properties index 141aabdfd3..1557fa540a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,11 +6,11 @@ org.gradle.parallel=true # check these at https://fabricmc.net/develop/ and # https://modrinth.com/mod/fabric-api/versions minecraft_version=1.21.4 -yarn_mappings=1.21.4+build.2 +yarn_mappings=1.21.4+build.4 loader_version=0.16.9 # Fabric API -fabric_version=0.112.0+1.21.4 +fabric_version=0.113.0+1.21.4 # Mod Properties mod_version = v7.46.6-MC1.21.4 From 29c5df7593d976566df5ef2fe6637b70650c384e Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 29 Dec 2024 14:33:11 +0100 Subject: [PATCH 07/13] Add XRayHackTest --- .../wurstclient/test/WurstE2ETestClient.java | 5 +- .../net/wurstclient/test/XRayHackTest.java | 92 +++++++++++++++++++ 2 files changed, 95 insertions(+), 2 deletions(-) create mode 100644 src/main/java/net/wurstclient/test/XRayHackTest.java diff --git a/src/main/java/net/wurstclient/test/WurstE2ETestClient.java b/src/main/java/net/wurstclient/test/WurstE2ETestClient.java index 34a1fc001a..da23d44d33 100644 --- a/src/main/java/net/wurstclient/test/WurstE2ETestClient.java +++ b/src/main/java/net/wurstclient/test/WurstE2ETestClient.java @@ -110,8 +110,8 @@ private void runTests() // TODO: Open ClickGUI and Navigator // Build a test platform and clear out the space above it - runChatCommand("fill ~-5 ~-1 ~-5 ~5 ~-1 ~5 stone"); - runChatCommand("fill ~-5 ~ ~-5 ~5 ~30 ~5 air"); + runChatCommand("fill ~-7 ~-1 ~-7 ~7 ~-1 ~7 stone"); + runChatCommand("fill ~-7 ~ ~-7 ~7 ~30 ~7 air"); // Clear inventory and chat before running tests runChatCommand("clear"); @@ -120,6 +120,7 @@ private void runTests() // Test Wurst hacks AutoMineHackTest.testAutoMineHack(); NoFallHackTest.testNoFallHack(); + XRayHackTest.testXRayHack(); // Test Wurst commands CopyItemCmdTest.testCopyItemCmd(); diff --git a/src/main/java/net/wurstclient/test/XRayHackTest.java b/src/main/java/net/wurstclient/test/XRayHackTest.java new file mode 100644 index 0000000000..88da924161 --- /dev/null +++ b/src/main/java/net/wurstclient/test/XRayHackTest.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 2014-2024 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.test; + +import static net.wurstclient.test.WurstClientTestHelper.*; + +import java.time.Duration; + +public enum XRayHackTest +{ + ; + + public static void testXRayHack() + { + System.out.println("Testing X-Ray hack"); + buildTestRig(); + clearChat(); + + // Enable X-Ray with default settings + runWurstCommand("setcheckbox X-Ray only_show_exposed off"); + runWurstCommand("setslider X-Ray opacity 0"); + runWurstCommand("t X-Ray on"); + takeScreenshot("xray_default", Duration.ofMillis(250)); + runWurstCommand("t X-Ray off"); + clearChat(); + + // Exposed only + runWurstCommand("setcheckbox X-Ray only_show_exposed on"); + runWurstCommand("setslider X-Ray opacity 0"); + runWurstCommand("t X-Ray on"); + takeScreenshot("xray_exposed_only", Duration.ofMillis(250)); + runWurstCommand("t X-Ray off"); + clearChat(); + + // Opacity mode + runWurstCommand("setcheckbox X-Ray only_show_exposed off"); + runWurstCommand("setslider X-Ray opacity 0.5"); + runWurstCommand("t X-Ray on"); + takeScreenshot("xray_opacity", Duration.ofMillis(250)); + runWurstCommand("t X-Ray off"); + clearChat(); + + // Exposed only + opacity + runWurstCommand("setcheckbox X-Ray only_show_exposed on"); + runWurstCommand("setslider X-Ray opacity 0.5"); + runWurstCommand("t X-Ray on"); + takeScreenshot("xray_exposed_only_opacity", Duration.ofMillis(250)); + runWurstCommand("t X-Ray off"); + clearChat(); + + // Clean up + runChatCommand("fill ~-7 ~ ~-7 ~7 ~30 ~7 air"); + runWurstCommand("setcheckbox X-Ray only_show_exposed off"); + runWurstCommand("setslider X-Ray opacity 0"); + runWurstCommand("t X-Ray off"); + clearChat(); + } + + private static void buildTestRig() + { + runChatCommand("fill ~-5 ~ ~5 ~5 ~5 ~7 stone"); + + // Hidden ores + runChatCommand("setblock ~-4 ~1 ~6 minecraft:coal_ore"); + runChatCommand("setblock ~-2 ~1 ~6 minecraft:iron_ore"); + runChatCommand("setblock ~0 ~1 ~6 minecraft:gold_ore"); + runChatCommand("setblock ~2 ~1 ~6 minecraft:diamond_ore"); + runChatCommand("setblock ~4 ~1 ~6 minecraft:emerald_ore"); + runChatCommand("setblock ~-4 ~3 ~6 minecraft:lapis_ore"); + runChatCommand("setblock ~-2 ~3 ~6 minecraft:redstone_ore"); + runChatCommand("setblock ~0 ~3 ~6 minecraft:copper_ore"); + runChatCommand("setblock ~2 ~3 ~6 minecraft:nether_gold_ore"); + runChatCommand("setblock ~4 ~3 ~6 minecraft:nether_quartz_ore"); + + // Partially exposed ores (air block in front) + runChatCommand("setblock ~-4 ~1 ~5 minecraft:coal_ore"); + runChatCommand("setblock ~-2 ~1 ~5 minecraft:iron_ore"); + runChatCommand("setblock ~0 ~1 ~5 minecraft:gold_ore"); + runChatCommand("setblock ~2 ~1 ~5 minecraft:diamond_ore"); + runChatCommand("setblock ~4 ~1 ~5 minecraft:emerald_ore"); + runChatCommand("setblock ~-4 ~3 ~5 minecraft:lapis_ore"); + runChatCommand("setblock ~-2 ~3 ~5 minecraft:redstone_ore"); + runChatCommand("setblock ~0 ~3 ~5 minecraft:copper_ore"); + runChatCommand("setblock ~2 ~3 ~5 minecraft:nether_gold_ore"); + runChatCommand("setblock ~4 ~3 ~5 minecraft:nether_quartz_ore"); + } +} From 98bf94098c401d8727b87c516de975b76e36bde0 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 29 Dec 2024 14:44:21 +0100 Subject: [PATCH 08/13] Print response if Imgur upload fails --- .github/workflows/gradle.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index e4932359f6..7cca245101 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -138,6 +138,7 @@ jobs: echo "" >> $GITHUB_STEP_SUMMARY else echo "Failed to upload $filename" >> $GITHUB_STEP_SUMMARY + echo "Imgur upload response for $filename: $response" fi fi done From 81582f0234f637a3aeb990bde75a197da7fecb24 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 29 Dec 2024 15:19:15 +0100 Subject: [PATCH 09/13] /kill mobs near the test platform so they don't push the player --- src/main/java/net/wurstclient/test/WurstE2ETestClient.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/net/wurstclient/test/WurstE2ETestClient.java b/src/main/java/net/wurstclient/test/WurstE2ETestClient.java index da23d44d33..f3252bd4c5 100644 --- a/src/main/java/net/wurstclient/test/WurstE2ETestClient.java +++ b/src/main/java/net/wurstclient/test/WurstE2ETestClient.java @@ -112,6 +112,7 @@ private void runTests() // Build a test platform and clear out the space above it runChatCommand("fill ~-7 ~-1 ~-7 ~7 ~-1 ~7 stone"); runChatCommand("fill ~-7 ~ ~-7 ~7 ~30 ~7 air"); + runChatCommand("kill @e[type=!player,distance=..10]"); // Clear inventory and chat before running tests runChatCommand("clear"); From 1acb31c3af229c148a02563fa72b053a9bf470a7 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 29 Dec 2024 15:23:20 +0100 Subject: [PATCH 10/13] Adjust PistonTest timings --- src/main/java/net/wurstclient/test/PistonTest.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/wurstclient/test/PistonTest.java b/src/main/java/net/wurstclient/test/PistonTest.java index bbe3cce1f6..83c90c486b 100644 --- a/src/main/java/net/wurstclient/test/PistonTest.java +++ b/src/main/java/net/wurstclient/test/PistonTest.java @@ -9,6 +9,8 @@ import static net.wurstclient.test.WurstClientTestHelper.*; +import java.time.Duration; + import net.minecraft.block.Blocks; public enum PistonTest @@ -21,17 +23,17 @@ public static void testPistonDoesntCrash() "Testing that a piston can extend and retract without crashing the game"); // Place a redstone block and piston - runChatCommand("setblock ~ ~ ~2 minecraft:redstone_block"); runChatCommand("setblock ~ ~1 ~2 minecraft:piston[facing=up]"); - waitForBlock(0, 0, 2, Blocks.REDSTONE_BLOCK); waitForBlock(0, 1, 2, Blocks.PISTON); - takeScreenshot("piston_extending"); + runChatCommand("setblock ~ ~ ~2 minecraft:redstone_block"); + waitForBlock(0, 0, 2, Blocks.REDSTONE_BLOCK); + takeScreenshot("piston_extending", Duration.ZERO); waitForWorldTicks(3); // Destroy the redstone block runChatCommand("setblock ~ ~ ~2 minecraft:air"); waitForBlock(0, 0, 2, Blocks.AIR); - takeScreenshot("piston_retracting"); + takeScreenshot("piston_retracting", Duration.ZERO); waitForWorldTicks(3); // Clean up From 17f31ba4cf265bda758deb734244c7707ca0e884 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 29 Dec 2024 15:30:07 +0100 Subject: [PATCH 11/13] Adjust piston & X-ray test timings --- src/main/java/net/wurstclient/test/PistonTest.java | 6 ++---- src/main/java/net/wurstclient/test/XRayHackTest.java | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/net/wurstclient/test/PistonTest.java b/src/main/java/net/wurstclient/test/PistonTest.java index 83c90c486b..387548549d 100644 --- a/src/main/java/net/wurstclient/test/PistonTest.java +++ b/src/main/java/net/wurstclient/test/PistonTest.java @@ -9,8 +9,6 @@ import static net.wurstclient.test.WurstClientTestHelper.*; -import java.time.Duration; - import net.minecraft.block.Blocks; public enum PistonTest @@ -27,13 +25,13 @@ public static void testPistonDoesntCrash() waitForBlock(0, 1, 2, Blocks.PISTON); runChatCommand("setblock ~ ~ ~2 minecraft:redstone_block"); waitForBlock(0, 0, 2, Blocks.REDSTONE_BLOCK); - takeScreenshot("piston_extending", Duration.ZERO); + takeScreenshot("piston_extending"); waitForWorldTicks(3); // Destroy the redstone block runChatCommand("setblock ~ ~ ~2 minecraft:air"); waitForBlock(0, 0, 2, Blocks.AIR); - takeScreenshot("piston_retracting", Duration.ZERO); + takeScreenshot("piston_retracting"); waitForWorldTicks(3); // Clean up diff --git a/src/main/java/net/wurstclient/test/XRayHackTest.java b/src/main/java/net/wurstclient/test/XRayHackTest.java index 88da924161..e8bdbd295c 100644 --- a/src/main/java/net/wurstclient/test/XRayHackTest.java +++ b/src/main/java/net/wurstclient/test/XRayHackTest.java @@ -25,7 +25,7 @@ public static void testXRayHack() runWurstCommand("setcheckbox X-Ray only_show_exposed off"); runWurstCommand("setslider X-Ray opacity 0"); runWurstCommand("t X-Ray on"); - takeScreenshot("xray_default", Duration.ofMillis(250)); + takeScreenshot("xray_default", Duration.ofMillis(300)); runWurstCommand("t X-Ray off"); clearChat(); @@ -33,7 +33,7 @@ public static void testXRayHack() runWurstCommand("setcheckbox X-Ray only_show_exposed on"); runWurstCommand("setslider X-Ray opacity 0"); runWurstCommand("t X-Ray on"); - takeScreenshot("xray_exposed_only", Duration.ofMillis(250)); + takeScreenshot("xray_exposed_only", Duration.ofMillis(300)); runWurstCommand("t X-Ray off"); clearChat(); @@ -41,7 +41,7 @@ public static void testXRayHack() runWurstCommand("setcheckbox X-Ray only_show_exposed off"); runWurstCommand("setslider X-Ray opacity 0.5"); runWurstCommand("t X-Ray on"); - takeScreenshot("xray_opacity", Duration.ofMillis(250)); + takeScreenshot("xray_opacity", Duration.ofMillis(300)); runWurstCommand("t X-Ray off"); clearChat(); @@ -49,7 +49,7 @@ public static void testXRayHack() runWurstCommand("setcheckbox X-Ray only_show_exposed on"); runWurstCommand("setslider X-Ray opacity 0.5"); runWurstCommand("t X-Ray on"); - takeScreenshot("xray_exposed_only_opacity", Duration.ofMillis(250)); + takeScreenshot("xray_exposed_only_opacity", Duration.ofMillis(300)); runWurstCommand("t X-Ray off"); clearChat(); From 32b3d1f132c0c2956afac0ec249cd7a7ed71d775 Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 29 Dec 2024 15:47:43 +0100 Subject: [PATCH 12/13] Add FreecamHackTest --- .../net/wurstclient/test/FreecamHackTest.java | 48 +++++++++++++++++++ .../wurstclient/test/WurstE2ETestClient.java | 3 +- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/main/java/net/wurstclient/test/FreecamHackTest.java diff --git a/src/main/java/net/wurstclient/test/FreecamHackTest.java b/src/main/java/net/wurstclient/test/FreecamHackTest.java new file mode 100644 index 0000000000..1211ac6586 --- /dev/null +++ b/src/main/java/net/wurstclient/test/FreecamHackTest.java @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014-2024 Wurst-Imperium and contributors. + * + * This source code is subject to the terms of the GNU General Public + * License, version 3. If a copy of the GPL was not distributed with this + * file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt + */ +package net.wurstclient.test; + +import static net.wurstclient.test.WurstClientTestHelper.*; + +import net.wurstclient.mixinterface.IKeyBinding; + +public enum FreecamHackTest +{ + ; + + public static void testFreecamHack() + { + System.out.println("Testing Freecam hack"); + + // Enable Freecam with default settings + runWurstCommand("setcheckbox Freecam tracer off"); + runWurstCommand("t Freecam on"); + takeScreenshot("freecam_default"); + clearChat(); + + // Press shift to fly down a bit + submitAndWait( + mc -> IKeyBinding.get(mc.options.sneakKey).simulatePress(true)); + waitForWorldTicks(5); + submitAndWait( + mc -> IKeyBinding.get(mc.options.sneakKey).simulatePress(false)); + takeScreenshot("freecam_down"); + clearChat(); + + // Tracer + runWurstCommand("setcheckbox Freecam tracer on"); + takeScreenshot("freecam_tracer"); + clearChat(); + + // Clean up + runWurstCommand("setcheckbox Freecam tracer off"); + runWurstCommand("t Freecam off"); + waitForWorldTicks(5); + clearChat(); + } +} diff --git a/src/main/java/net/wurstclient/test/WurstE2ETestClient.java b/src/main/java/net/wurstclient/test/WurstE2ETestClient.java index f3252bd4c5..1fa18460c7 100644 --- a/src/main/java/net/wurstclient/test/WurstE2ETestClient.java +++ b/src/main/java/net/wurstclient/test/WurstE2ETestClient.java @@ -110,7 +110,7 @@ private void runTests() // TODO: Open ClickGUI and Navigator // Build a test platform and clear out the space above it - runChatCommand("fill ~-7 ~-1 ~-7 ~7 ~-1 ~7 stone"); + runChatCommand("fill ~-7 ~-5 ~-7 ~7 ~-1 ~7 stone"); runChatCommand("fill ~-7 ~ ~-7 ~7 ~30 ~7 air"); runChatCommand("kill @e[type=!player,distance=..10]"); @@ -120,6 +120,7 @@ private void runTests() // Test Wurst hacks AutoMineHackTest.testAutoMineHack(); + FreecamHackTest.testFreecamHack(); NoFallHackTest.testNoFallHack(); XRayHackTest.testXRayHack(); From 531549c3cfc9eb6040016fcde33fd53f6243bb7d Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Sun, 29 Dec 2024 16:27:55 +0100 Subject: [PATCH 13/13] Add more delays to FreecamHackTest --- src/main/java/net/wurstclient/test/FreecamHackTest.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/wurstclient/test/FreecamHackTest.java b/src/main/java/net/wurstclient/test/FreecamHackTest.java index 1211ac6586..af81c7f0f1 100644 --- a/src/main/java/net/wurstclient/test/FreecamHackTest.java +++ b/src/main/java/net/wurstclient/test/FreecamHackTest.java @@ -9,6 +9,8 @@ import static net.wurstclient.test.WurstClientTestHelper.*; +import java.time.Duration; + import net.wurstclient.mixinterface.IKeyBinding; public enum FreecamHackTest @@ -22,7 +24,7 @@ public static void testFreecamHack() // Enable Freecam with default settings runWurstCommand("setcheckbox Freecam tracer off"); runWurstCommand("t Freecam on"); - takeScreenshot("freecam_default"); + takeScreenshot("freecam_default", Duration.ofMillis(100)); clearChat(); // Press shift to fly down a bit @@ -31,12 +33,12 @@ public static void testFreecamHack() waitForWorldTicks(5); submitAndWait( mc -> IKeyBinding.get(mc.options.sneakKey).simulatePress(false)); - takeScreenshot("freecam_down"); + takeScreenshot("freecam_down", Duration.ofMillis(300)); clearChat(); // Tracer runWurstCommand("setcheckbox Freecam tracer on"); - takeScreenshot("freecam_tracer"); + takeScreenshot("freecam_tracer", Duration.ofMillis(100)); clearChat(); // Clean up