@@ -18,7 +18,7 @@ PlayerCoordsAPI provides real-time access to your Minecraft player coordinates t
1818- Lightweight HTTP server running only on localhost providing your coordinates
1919- Client-side only - no server-side components needed
2020- Works in singleplayer and multiplayer
21- - Mod menu integration allowing you to enable/disable the API and configure CORS
21+ - Mod menu integration allowing you to enable/disable the API, change its port, and configure requests with or without an ` Origin ` header
2222
2323## 🚀 Installation
2424
@@ -27,27 +27,27 @@ PlayerCoordsAPI provides real-time access to your Minecraft player coordinates t
27273 . Place the jar in your ` .minecraft/mods ` folder
28284 . Launch Minecraft with the Fabric profile
2929
30- ## 🔌 API Usage
30+ ## ⚙️ Configuration
3131
32- | Endpoint | Method | Description |
33- | ---------------| --------| ----------------------------------------------------------|
34- | ` /api/coords ` | ` GET ` | Returns the player's current coordinates and world infos |
32+ The API is read-only and only accepts loopback connections such as ` 127.0.0.1 ` and ` ::1 ` .
33+ From Mod Menu, you can configure:
34+ - Whether the API is enabled
35+ - Which port it listens on (default: ` 25565 ` )
36+ - How requests without a CORS ` Origin ` header are handled
37+ - How requests with a CORS ` Origin ` header are handled
3538
36- ### Response Format
39+ Requests with an ` Origin ` can be handled in three different modes:
40+ - ` Allow all `
41+ - ` Local origins `
42+ - ` Whitelist `
3743
38- ``` json
39- {
40- "x" : 123.45 ,
41- "y" : 64.00 ,
42- "z" : -789.12 ,
43- "yaw" : 180.00 ,
44- "pitch" : 12.50 ,
45- "world" : " minecraft:overworld" ,
46- "biome" : " minecraft:plains" ,
47- "uuid" : " 550e8400-e29b-41d4-a716-446655440000" ,
48- "username" : " PlayerName"
49- }
50- ```
44+ In ` Whitelist ` mode, you can configure each allowed origin with a scheme, host/IP, and optional port.
45+
46+ ## 🔌 API Usage
47+
48+ | Endpoint | Method | Description |
49+ | ---------------| -----------------| ----------------------------------------------------------|
50+ | ` /api/coords ` | ` GET ` , ` OPTIONS ` | Returns the player's current coordinates and world infos |
5151
5252### Response Fields
5353
@@ -71,16 +71,26 @@ PlayerCoordsAPI provides real-time access to your Minecraft player coordinates t
7171| ` 404 ` | Player not in world |
7272| ` 405 ` | Method not allowed |
7373
74- ## 🔒 Security
74+ ### Response Format Example
7575
76- For security reasons, the API server:
77- - Only accepts connections from loopback addresses such as ` 127.0.0.1 ` and ` ::1 `
78- - Runs on port ` 25565 ` by default
79- - Provides read-only access to player position data
80- - Uses a configurable CORS policy. By default it allows all origins for backward compatibility, but you can restrict it in the config screen
76+ ``` json
77+ {
78+ "x" : 123.45 ,
79+ "y" : 64.00 ,
80+ "z" : -789.12 ,
81+ "yaw" : 180.00 ,
82+ "pitch" : 12.50 ,
83+ "world" : " minecraft:overworld" ,
84+ "biome" : " minecraft:plains" ,
85+ "uuid" : " 550e8400-e29b-41d4-a716-446655440000" ,
86+ "username" : " PlayerName"
87+ }
88+ ```
8189
8290## 🛠️ Examples
8391
92+ Replace ` 25565 ` with your configured port if you changed it in the Mod Menu.
93+
8494### cURL
8595``` bash
8696curl http://localhost:25565/api/coords
0 commit comments