aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/de/hysky/skyblocker/debug
diff options
context:
space:
mode:
authorAaron <51387595+AzureAaron@users.noreply.github.com>2023-11-11 03:23:01 -0500
committerAaron <51387595+AzureAaron@users.noreply.github.com>2023-11-11 03:23:01 -0500
commit3873256a79589ccff9d100b51152f4d1fd508c24 (patch)
tree9d8ec901e2a8bf4dbf3b59b5183036b36876f4ba /src/main/java/de/hysky/skyblocker/debug
parentd07ad6a62ae84e361b3723017fc173f616f49d0e (diff)
downloadSkyblocker-3873256a79589ccff9d100b51152f4d1fd508c24.tar.gz
Skyblocker-3873256a79589ccff9d100b51152f4d1fd508c24.tar.bz2
Skyblocker-3873256a79589ccff9d100b51152f4d1fd508c24.zip
Blobbercyst Glow
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/debug')
-rw-r--r--src/main/java/de/hysky/skyblocker/debug/Debug.java13
-rw-r--r--src/main/java/de/hysky/skyblocker/debug/DumpPlayersCommand.java34
2 files changed, 47 insertions, 0 deletions
diff --git a/src/main/java/de/hysky/skyblocker/debug/Debug.java b/src/main/java/de/hysky/skyblocker/debug/Debug.java
new file mode 100644
index 00000000..5991f72c
--- /dev/null
+++ b/src/main/java/de/hysky/skyblocker/debug/Debug.java
@@ -0,0 +1,13 @@
+package de.hysky.skyblocker.debug;
+
+import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
+
+public class Debug {
+ private static final boolean DEBUG_ENABLED = Boolean.parseBoolean(System.getProperty("skyblocker.debug", "false"));
+
+ public static void init() {
+ if (DEBUG_ENABLED) {
+ ClientCommandRegistrationCallback.EVENT.register(DumpPlayersCommand::register);
+ }
+ }
+}
diff --git a/src/main/java/de/hysky/skyblocker/debug/DumpPlayersCommand.java b/src/main/java/de/hysky/skyblocker/debug/DumpPlayersCommand.java
new file mode 100644
index 00000000..598672ef
--- /dev/null
+++ b/src/main/java/de/hysky/skyblocker/debug/DumpPlayersCommand.java
@@ -0,0 +1,34 @@
+package de.hysky.skyblocker.debug;
+
+import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal;
+
+import com.mojang.brigadier.Command;
+import com.mojang.brigadier.CommandDispatcher;
+
+import de.hysky.skyblocker.SkyblockerMod;
+import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.command.CommandRegistryAccess;
+import net.minecraft.entity.player.PlayerEntity;
+import net.minecraft.text.Text;
+
+public class DumpPlayersCommand {
+
+ static void register(CommandDispatcher<FabricClientCommandSource> dispatcher, CommandRegistryAccess registryAccess) {
+ dispatcher.register(literal(SkyblockerMod.NAMESPACE)
+ .then(literal("debug")
+ .then(literal("dumpPlayers")
+ .executes(context -> {
+ FabricClientCommandSource source = context.getSource();
+ MinecraftClient client = source.getClient();
+
+ client.world.getEntities().forEach(e -> {
+ if (e instanceof PlayerEntity player) {
+ source.sendFeedback(Text.of("\"" + player.getName().getString() + "\""));
+ }
+ });
+
+ return Command.SINGLE_SUCCESS;
+ }))));
+ }
+}