behaviorreal0048

Make a client-side mod forminecraft that adds a /findplayer <username> client command, which scans all players in the server and prints the target player's exact X, Y, Z coordinates to chat only I can see not any other players

Kodari AI
KodariJul 23 at 4:15 pm 2
PlayerLocator
A client-side Fabric mod that adds the `/findplayer &lt;username&gt;` command. It searches the players currently known to the client, matches usernames case-insensitively, and prints the target player's exact X, Y, and Z coordinates privately in the command executor's chat. It requires no server-side installation and provides clear feedback when a player cannot be found or the client is not connected to a server.

Plan:

  1. Create the Fabric 1.21.11 project configuration and metadata.

  2. Add the client initializer and /findplayer <username> command.

  3. Add the required language entry and README usage notes.

behaviorreal0048

Make a client-side mod forminecraft that adds a /findplayer <username> client command, which scans all players in the server and prints the target player's exact X, Y, Z coordinates to chat only I can see not any other players

Kodari AI
KodariJul 23 at 4:17 pm 3
PlayerLocator
A client-side Fabric mod that adds the `/findplayer &lt;username&gt;` command for locating players visible to the client. It searches the server player list known by the client, matches usernames case-insensitively, and displays the target player’s exact X, Y, and Z coordinates privately in the local chat. The command never sends the coordinates or result message to other players and reports clear feedback when the target is unavailable.
A client-side Fabric 1.21.11 mod that adds the `/findplayer &lt;username&gt;` command. It searches every player currently known in the client’s connected world, matches the username without regard to letter case, and displays the target’s exact X, Y, and Z coordinates in private local chat. The command never sends a chat message or command request to the server, so other players cannot see the result.
A client-side Fabric 1.21.11 mod that adds the `/findplayer &lt;username&gt;` command. It searches every player currently known in the client’s connected world, matches usernames case-insensitively, and displays exact X, Y, and Z coordinates in private local chat. The command does not send the result to the server or other players.

Created the complete Fabric 1.21.11 project with:

  • Client-only /findplayer <username> command

  • Case-insensitive username matching

  • Exact decimal coordinates

  • Private local chat output

  • Feedback when disconnected or when the player is not currently known to the client

  • Fabric Loom, Gradle, mod metadata, and language files configured

behaviorreal0048

can you compile it please?

Kodari AI
KodariJul 23 at 4:20 pm 1

I can’t run Gradle compilation directly in this environment because build tools aren’t available. The project is configured for Fabric 1.21.11; compile it locally from the project root with:

Shell
./gradlew build

On Windows:

Shell
gradlew.bat build

The built JAR will be in:

Plain Text
build/libs/
behaviorreal0048

so what do i do

Kodari AI
KodariJul 23 at 4:22 pm 1
  1. Install Java 21:

    • Download from Adoptium.

    • Confirm it works:

      Shell
      java -version
      
  2. Open a terminal in the mod project folder—the folder containing build.gradle and gradlew.

  3. Compile it:

    Windows PowerShell:

    Powershell
    .\gradlew.bat build
    

    macOS/Linux:

    Shell
    chmod +x gradlew
    ./gradlew build
    
  4. After a successful build, find the mod JAR in:

    Plain Text
    build/libs/
    
  5. Install Fabric Loader 1.21.11 and Fabric API 1.21.11 for your Minecraft client, then copy the JAR from build/libs into:

    Plain Text
    .minecraft/mods/
    
  6. Launch Minecraft with the Fabric profile. In-game, use:

    Plain Text
    /findplayer <username>
    

If gradlew or gradlew.bat is missing, tell me what files are in the project folder, or paste the exact error output.

behaviorreal0048

the player doesnt have to be in my view any where on the server I can locate them without OP

Kodari AI
KodariJul 23 at 4:44 pm 1

That isn’t possible with a purely client-side mod without OP or server support.

Minecraft only sends your client information about players currently being tracked/rendered nearby. It does not send every online player’s coordinates, so a client mod cannot scan or discover hidden players anywhere in the server. The tab list only contains names/status—not positions.

To support this legitimately, you need one of these:

  • A server-side Fabric mod/plugin that has permission to read player positions and sends the result privately to the requester.

  • An existing server command/plugin that provides player lookup.

  • OP or a server permission granting a location command.

A client-only mod can display coordinates privately, but it cannot obtain coordinates the server never sends. I can help convert it into a server-side Fabric command with a configurable permission if you control the server.

behaviorreal0048

so server side ?

Kodari AI
KodariJul 23 at 4:46 pm 1

Yes. To locate players anywhere on the server, it must be a server-side Fabric mod.

The server-side command would:

  • Scan all online ServerPlayerEntity instances.

  • Match /findplayer <username>.

  • Read the target’s exact coordinates.

  • Send the result only to the command sender.

  • Require either OP or a configurable permission.

A client-only mod cannot access coordinates for players the server has not sent to your client. This should only be installed and used with the server owner’s permission.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
6 147
src/client/java/com/playerlocator/PlayerLocatorClient.java
package com.playerlocator;

import com.mojang.brigadier.Command;
import com.mojang.brigadier.arguments.StringArgumentType;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback;
import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.network.ClientPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.text.Text;

public class PlayerLocatorClient implements ClientModInitializer {
    @Override
    public void onInitializeClient() {
        ClientCommandRegistrationCallback.EVENT.register((dispatcher, registryAccess) ->
            dispatcher.register(
                ClientCommandManager.literal("findplayer")
                    .then(ClientCommandManager.argument("username", StringArgumentType.word())
                        .executes(context -> findPlayer(
                            StringArgumentType.getString(context, "username")
                        ))
                    )
            )
        );
    }

    private static int findPlayer(String username) {
        MinecraftClient client = MinecraftClient.getInstance();

        if (client.world == null || client.player == null) {
            return sendLocalMessage(client, "You must be connected to a world to use /findplayer.");
        }

        for (PlayerEntity player : client.world.getPlayers()) {
            if (player.getName().getString().equalsIgnoreCase(username)) {
                String coordinates = "X: " + Double.toString(player.getX())
                    + ", Y: " + Double.toString(player.getY())
                    + ", Z: " + Double.toString(player.getZ());

                client.player.sendMessage(
                    Text.literal(player.getName().getString() + " is at " + coordinates),
                    false
                );
                return Command.SINGLE_SUCCESS;
            }
        }

        return sendLocalMessage(client, "Player '" + username + "' is not currently visible to your client.");
    }

    private static int sendLocalMessage(MinecraftClient client, String message) {
        if (client.player != null) {
            client.player.sendMessage(Text.literal(message), false);
        }
        return 0;
    }
}