-
-
Notifications
You must be signed in to change notification settings - Fork 417
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
549 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* 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.client.MinecraftClient; | ||
import net.minecraft.client.gui.screen.TitleScreen; | ||
import net.minecraft.client.gui.widget.ButtonWidget; | ||
|
||
public enum AltManagerTest | ||
{ | ||
; | ||
|
||
public static void testAltManagerButton(MinecraftClient mc) | ||
{ | ||
System.out.println("Checking AltManager button position"); | ||
|
||
if(!(mc.currentScreen instanceof TitleScreen)) | ||
throw new RuntimeException("Not on the title screen"); | ||
|
||
ButtonWidget multiplayerButton = findButton(mc, "menu.multiplayer"); | ||
ButtonWidget realmsButton = findButton(mc, "menu.online"); | ||
ButtonWidget altManagerButton = findButton(mc, "Alt Manager"); | ||
|
||
checkButtonPosition(altManagerButton, realmsButton.getRight() + 4, | ||
multiplayerButton.getBottom() + 4); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.client.option.Perspective; | ||
import net.minecraft.item.Items; | ||
|
||
public enum CopyItemCmdTest | ||
{ | ||
; | ||
|
||
public static void testCopyItemCmd() | ||
{ | ||
System.out.println("Testing .copyitem command"); | ||
setPerspective(Perspective.THIRD_PERSON_FRONT); | ||
|
||
// Put on a golden helmet | ||
runChatCommand("item replace entity @s armor.head with golden_helmet"); | ||
takeScreenshot("copyitem_command_setup"); | ||
assertNoItemInSlot(0); | ||
assertOneItemInSlot(39, Items.GOLDEN_HELMET); | ||
|
||
// .copyitem the helmet | ||
String playerName = submitAndGet(mc -> mc.player.getName().getString()); | ||
runWurstCommand("copyitem " + playerName + " head"); | ||
takeScreenshot("copyitem_command_result"); | ||
assertOneItemInSlot(0, Items.GOLDEN_HELMET); | ||
assertOneItemInSlot(39, Items.GOLDEN_HELMET); | ||
|
||
// Clean up | ||
setPerspective(Perspective.FIRST_PERSON); | ||
runChatCommand("clear"); | ||
clearChat(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* | ||
* 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.item.Items; | ||
|
||
public enum GiveCmdTest | ||
{ | ||
; | ||
|
||
public static void testGiveCmd() | ||
{ | ||
System.out.println("Testing .give command"); | ||
runWurstCommand("give diamond"); | ||
assertOneItemInSlot(0, Items.DIAMOND); | ||
|
||
// Clean up | ||
runChatCommand("clear"); | ||
clearChat(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* 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.component.DataComponentTypes; | ||
import net.minecraft.component.type.NbtComponent; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.nbt.NbtCompound; | ||
|
||
public enum ModifyCmdTest | ||
{ | ||
; | ||
|
||
public static void testModifyCmd() | ||
{ | ||
System.out.println("Testing .modify command"); | ||
|
||
// /give a diamond | ||
runChatCommand("give @s diamond"); | ||
assertOneItemInSlot(0, Items.DIAMOND); | ||
|
||
// .modify it with NBT data | ||
runWurstCommand("modify add {test:123}"); | ||
assertOneItemInSlot(0, Items.DIAMOND); | ||
submitAndWait(mc -> { | ||
ItemStack stack = mc.player.getInventory().getMainHandStack(); | ||
NbtCompound nbt = stack.getComponents().getOrDefault( | ||
DataComponentTypes.CUSTOM_DATA, NbtComponent.DEFAULT).copyNbt(); | ||
if(!nbt.contains("test")) | ||
throw new RuntimeException( | ||
"NBT data is missing the 'test' key"); | ||
if(nbt.getInt("test") != 123) | ||
throw new RuntimeException("NBT data is incorrect"); | ||
}); | ||
runWurstCommand("viewnbt"); | ||
takeScreenshot("modify_command_result"); | ||
|
||
// Clean up | ||
runChatCommand("clear"); | ||
clearChat(); | ||
} | ||
} |
Oops, something went wrong.