Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ run/
out/
classes/

# gradle wrapper jar (optional - some teams prefer to commit this)
gradle/wrapper/gradle-wrapper.jar

# eclipse

*.launch
Expand All @@ -31,11 +34,15 @@ bin/

# fabric

run/

# java

hs_err_*.log
replay_*.log
*.hprof
*.jfr

# personal

.claude/
CLAUDE.md
GEMINI.md
24 changes: 14 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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}`));
```

<div align="center">
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ 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
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
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,14 @@ private void handleCoordsRequest(HttpExchange exchange) throws IOException {
RegistryEntry<Biome> 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 {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading