PlayerCoordsAPI
一个轻量级的 Fabric 模组,通过本地 HTTP API 暴露你的 Minecraft 玩家坐标。
? 概览
PlayerCoordsAPI 通过一个简单的 HTTP 端点提供对你 Minecraft 玩家坐标的实时访问。这使得外部应用程序能够追踪你的位置,而无需读取 Minecraft 内存或捕获屏幕。
✨ 特性
- 仅在 localhost 上运行的轻量级 HTTP 服务器,提供你的坐标
- 仅客户端 - 不需要服务端组件
- 适用于单人游戏和多人游戏
- Mod 菜单集成,允许你启用/禁用 API、更改端口,并配置是否携带
Origin 头部的请求
? 安装
- 为受支持的 Minecraft 版本安装 Fabric Loader
- 从 发布页面 下载最新的
playercoordsapi-x.x.x+mcx.x.x.jar
- 将 jar 文件放入
.minecraft/mods 文件夹
- 使用 Fabric 配置文件启动 Minecraft
⚙️ 配置
该 API 为只读模式,仅接受回环连接,如 127.0.0.1 和 ::1。
在 Mod 菜单中,你可以配置:
- 是否启用 API
- 监听哪个端口(默认:
25565)
- 如何处理不带 CORS
Origin 头部的请求
- 如何处理带 CORS
Origin 头部的请求
带 Origin 的请求可以通过三种不同的模式处理:
Allow all(允许所有)
Local origins(本地来源)
Whitelist(白名单)
在 Whitelist 模式下,你可以配置每个允许的来源,包括协议、主机/IP 和可选端口。
? API 用法
| 端点 |
方法 |
描述 |
/api/coords |
GET, OPTIONS |
返回玩家当前的坐标和世界信息 |
响应字段
| 字段 |
类型 |
描述 |
x |
number |
东西方向 |
y |
number |
高度 |
z |
number |
南北方向 |
yaw |
number |
水平旋转角度(度) |
pitch |
number |
垂直旋转角度(度) |
world |
string |
Minecraft 世界注册 ID |
biome |
string |
Minecraft 生物群系注册 ID |
uuid |
string |
玩家 UUID |
username |
string |
玩家用户名 |
错误响应
| 状态码 |
消息 |
403 |
拒绝访问 / 来源不允许 |
404 |
玩家不在世界中 |
405 |
方法不允许 |
响应格式示例
{
"x": 123.45,
"y": 64.00,
"z": -789.12,
"yaw": 180.00,
"pitch": 12.50,
"world": "minecraft:overworld",
"biome": "minecraft:plains",
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"username": "PlayerName"
}
?️ 示例
如果你在 Mod 菜单中更改了端口,请将 25565 替换为你配置的端口。
cURL
curl http://localhost:25565/api/coords
Python
import requests
response = requests.get("http://localhost:25565/api/coords")
data = response.json()
print(f"玩家 {data['username']}(UUID:{data['uuid']})位于 X: {data['x']}, Y: {data['y']}, Z: {data['z']}")
JavaScript
fetch("http://localhost:25565/api/coords")
.then(response => response.json())
.then(data => console.log(`玩家 ${data.username}(UUID:${data.uuid})位于 X: ${data.x}, Y: ${data.y}, Z: ${data.z}`));
由以下人员制作

Sukikui
PlayerCoordsAPI
A lightweight Fabric mod that exposes your Minecraft player coordinates via a local HTTP API.
? Overview
PlayerCoordsAPI provides real-time access to your Minecraft player coordinates through a simple HTTP endpoint. This enables external applications to track your position without needing to read Minecraft's memory or capture the screen.
✨ Features
- Lightweight HTTP server running only on localhost providing your coordinates
- Client-side only - no server-side components needed
- Works in singleplayer and multiplayer
- Mod menu integration allowing you to enable/disable the API, change its port, and configure requests with or without an
Origin header
? Installation
- Install Fabric Loader for a supported Minecraft version
- Download the latest
playercoordsapi-x.x.x+mcx.x.x.jar from the releases page
- Place the jar in your
.minecraft/mods folder
- Launch Minecraft with the Fabric profile
⚙️ Configuration
The API is read-only and only accepts loopback connections such as 127.0.0.1 and ::1.
From Mod Menu, you can configure:
- Whether the API is enabled
- Which port it listens on (default:
25565)
- How requests without a CORS
Origin header are handled
- How requests with a CORS
Origin header are handled
Requests with an Origin can be handled in three different modes:
Allow all
Local origins
Whitelist
In Whitelist mode, you can configure each allowed origin with a scheme, host/IP, and optional port.
? API Usage
| Endpoint |
Method |
Description |
/api/coords |
GET, OPTIONS |
Returns the player's current coordinates and world infos |
Response Fields
| Field |
Type |
Description |
x |
number |
East-West |
y |
number |
Height |
z |
number |
North-South |
yaw |
number |
Horizontal rotation (degrees) |
pitch |
number |
Vertical rotation (degrees) |
world |
string |
Minecraft world registry ID |
biome |
string |
Minecraft biome registry ID |
uuid |
string |
Player UUID |
username |
string |
Player username |
Error Responses
| Status |
Message |
403 |
Access denied / Origin not allowed |
404 |
Player not in world |
405 |
Method not allowed |
Response Format Example
{
"x": 123.45,
"y": 64.00,
"z": -789.12,
"yaw": 180.00,
"pitch": 12.50,
"world": "minecraft:overworld",
"biome": "minecraft:plains",
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"username": "PlayerName"
}
?️ Examples
Replace 25565 with your configured port if you changed it in the Mod Menu.
cURL
curl http://localhost:25565/api/coords
Python
import requests
response = requests.get("http://localhost:25565/api/coords")
data = response.json()
print(f"Player {data['username']} (UUID: {data['uuid']}) at X: {data['x']}, Y: {data['y']}, Z: {data['z']}")
JavaScript
fetch("http://localhost:25565/api/coords")
.then(response => response.json())
.then(data => console.log(`Player ${data.username} (UUID: ${data.uuid}) at X: ${data.x}, Y: ${data.y}, Z: ${data.z}`));
Crafted by

Sukikui
评论 0
登录后参与评分
还没有评论,来抢沙发吧