diff --git a/.gitignore b/.gitignore index 47b1963..9650730 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,9 @@ run/ out/ classes/ +# gradle wrapper jar (optional - some teams prefer to commit this) +gradle/wrapper/gradle-wrapper.jar + # eclipse *.launch @@ -31,11 +34,15 @@ bin/ # fabric -run/ - # java hs_err_*.log replay_*.log *.hprof *.jfr + +# personal + +.claude/ +CLAUDE.md +GEMINI.md diff --git a/README.md b/README.md index 62ebb83..da7789e 100644 --- a/README.md +++ b/README.md @@ -38,19 +38,23 @@ PlayerCoordsAPI provides real-time access to your Minecraft player coordinates t "y": 64.00, "z": -789.12, "world": "overworld", - "biome": "plains" + "biome": "plains", + "uuid": "550e8400-e29b-41d4-a716-446655440000", + "username": "PlayerName" } ``` ### Response Fields -| Field | Type | Description | -|---------|----------|-----------------| -| `x` | `number` | East-West | -| `y` | `number` | Height | -| `z` | `number` | North-South | -| `world` | `string` | Minecraft world | -| `biome` | `string` | Minecraft biome | +| Field | Type | Description | +|------------|----------|-------------------| +| `x` | `number` | East-West | +| `y` | `number` | Height | +| `z` | `number` | North-South | +| `world` | `string` | Minecraft world | +| `biome` | `string` | Minecraft biome | +| `uuid` | `string` | Player UUID | +| `username` | `string` | Player username | ### Error Responses @@ -79,14 +83,14 @@ import requests response = requests.get("http://localhost:25565/api/coords") data = response.json() -print(f"Player at X: {data['x']}, Y: {data['y']}, Z: {data['z']}") +print(f"Player {data['username']} (UUID: {data['uuid']}) at X: {data['x']}, Y: {data['y']}, Z: {data['z']}") ``` ### JavaScript ```javascript fetch("http://localhost:25565/api/coords") .then(response => response.json()) - .then(data => console.log(`Player at X: ${data.x}, Y: ${data.y}, Z: ${data.z}`)); + .then(data => console.log(`Player ${data.username} (UUID: ${data.uuid}) at X: ${data.x}, Y: ${data.y}, Z: ${data.z}`)); ```
diff --git a/gradle.properties b/gradle.properties index b157868..abf4adf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,9 +3,9 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21.4 -yarn_mappings=1.21.4+build.8 -loader_version=0.16.10 +minecraft_version=1.21.8 +yarn_mappings=1.21.8+build.1 +loader_version=0.16.14 # Mod Properties mod_version=0.1.0 @@ -13,6 +13,6 @@ maven_group=fr.sukikui.playercoordsapi archives_base_name=playercoordsapi # Dependencies -fabric_version=0.118.0+1.21.4 +fabric_version=0.129.0+1.21.8 modmenu_version=9.0.0 cloth_config_version=13.0.121 \ No newline at end of file diff --git a/src/client/java/fr/sukikui/playercoordsapi/PlayerCoordsAPIClient.java b/src/client/java/fr/sukikui/playercoordsapi/PlayerCoordsAPIClient.java index 71d78bd..fbfb241 100644 --- a/src/client/java/fr/sukikui/playercoordsapi/PlayerCoordsAPIClient.java +++ b/src/client/java/fr/sukikui/playercoordsapi/PlayerCoordsAPIClient.java @@ -103,10 +103,14 @@ private void handleCoordsRequest(HttpExchange exchange) throws IOException { RegistryEntry biomeEntry = player.getWorld().getBiome(player.getBlockPos()); String biome = biomeEntry.getKey().orElseThrow().getValue().toString(); + // Get player UUID and username + String uuid = player.getUuid().toString(); + String username = player.getName().getString(); + // Format as JSON responseText = String.format( - "{\"x\": %.2f, \"y\": %.2f, \"z\": %.2f, \"world\": \"%s\", \"biome\": \"%s\"}", - x, y, z, world, biome + "{\"x\": %.2f, \"y\": %.2f, \"z\": %.2f, \"world\": \"%s\", \"biome\": \"%s\", \"uuid\": \"%s\", \"username\": \"%s\"}", + x, y, z, world, biome, uuid, username ); sendResponse(exchange, 200, responseText); } else { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 0c8926d..8ae1d7f 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,8 +34,8 @@ } ], "depends": { - "fabricloader": ">=0.16.10", - "minecraft": "~1.21.4", + "fabricloader": ">=0.16.14", + "minecraft": "~1.21.8", "java": ">=21", "fabric-api": "*", "cloth-config": ">=13.0.0"