From 3873256a79589ccff9d100b51152f4d1fd508c24 Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Sat, 11 Nov 2023 03:23:01 -0500 Subject: Blobbercyst Glow --- .../hysky/skyblocker/debug/DumpPlayersCommand.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/main/java/de/hysky/skyblocker/debug/DumpPlayersCommand.java (limited to 'src/main/java/de/hysky/skyblocker/debug/DumpPlayersCommand.java') 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 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; + })))); + } +} -- cgit From fb249dcac9581945d35a89c417bb54afe4ed7c32 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Mon, 13 Nov 2023 19:29:54 -0500 Subject: Refactor debug --- .../de/hysky/skyblocker/debug/DumpPlayersCommand.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/main/java/de/hysky/skyblocker/debug/DumpPlayersCommand.java') diff --git a/src/main/java/de/hysky/skyblocker/debug/DumpPlayersCommand.java b/src/main/java/de/hysky/skyblocker/debug/DumpPlayersCommand.java index 598672ef..5f6e0362 100644 --- a/src/main/java/de/hysky/skyblocker/debug/DumpPlayersCommand.java +++ b/src/main/java/de/hysky/skyblocker/debug/DumpPlayersCommand.java @@ -1,17 +1,15 @@ 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; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; + public class DumpPlayersCommand { static void register(CommandDispatcher dispatcher, CommandRegistryAccess registryAccess) { @@ -20,14 +18,13 @@ public class DumpPlayersCommand { .then(literal("dumpPlayers") .executes(context -> { FabricClientCommandSource source = context.getSource(); - MinecraftClient client = source.getClient(); - - client.world.getEntities().forEach(e -> { + + source.getWorld().getEntities().forEach(e -> { if (e instanceof PlayerEntity player) { - source.sendFeedback(Text.of("\"" + player.getName().getString() + "\"")); + source.sendFeedback(Text.of("'" + player.getName().getString() + "'")); } }); - + return Command.SINGLE_SUCCESS; })))); } -- cgit