### Install gdmc_http_interface with Forge Mod Launcher Source: https://github.com/niels-ntg/gdmc_http_interface/wiki/Installation Steps to install the gdmc_http_interface mod by downloading the JAR file and placing it in the Minecraft mods folder. This method is for users who want to play with the mod without modifying the source code. ```text 1. Download the Forge Mod Launcher (Recommended -> Installer). 2. Install Forge (client install). 3. Open your Minecraft Launcher and select the Forge Installation. 4. Navigate to your mod folder (or click "Mods" -> "Open mods folder" from the Forge Installation). 5. Download the gdmc_http_interface JAR file from the releases page. 6. Place the JAR file into the mods folder. 7. Restart Minecraft and launch the Forge Installation. 8. Launch a Minecraft world; the HTTP Server will start automatically. ``` -------------------------------- ### Example: Get Chunk Data Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md An example of how to retrieve chunk data using the GDMC HTTP Interface, specifying coordinates and the desired 'Accept' header for human-readable output. ```http GET /chunks?x=0&z=8&dimension=nether Accept: text/plain ``` ```json { "ChunkDX": 1, "ChunkDZ": 1, "ChunkX": 0, "ChunkZ": 8, "Chunks": [ { "DataVersion": 4189, "Heightmaps": { "MOTION_BLOCKING": [ 2310355422147575936, 2310355422147575936, 2310355422147575936, 2310355422147575936, 2310355422147575936, 2310355422147575936, ... ] } } ] } ``` -------------------------------- ### GDMC HTTP Interface Structure Placement Example Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Provides a step-by-step example of how to save a structure using the Minecraft Structure Block and then place it in a world using the GDMC HTTP Interface. It details the `POST /structure` endpoint with query parameters for coordinates and entity inclusion. ```APIDOC Example: Using the [Structure Block](https://minecraft.wiki/w/Structure_Block), [save](https://minecraft.wiki/w/Structure_Block#Save) an area of any Minecraft world. Give it a name such as "example:test-structure" and set the Include entities setting to "ON", then hit the "SAVE" button. You will now be able to find the file under `(minecraftFiles)/saves/(worldName)/generated/example/test-structure.nbt`. Now in Minecraft load the Minecraft world you want to place this structure in, pick a location and place it there using this endpoint. To place it at location x=102, y=67, z=-21 with entities, include the file as the request body to request `POST /structure?x=102&y=67&z=-21&entities=true`. ``` -------------------------------- ### Place Blocks Request Body Example Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md An example JSON payload for the `PUT /blocks` endpoint, demonstrating how to place a chest with items and a quartz block. ```JSON [ { "id": "minecraft:chest", "x": -55, "y": "~2", "z": 77, "state": { "facing": "east", "type": "single", "waterlogged": "false" }, "data": "{Items:[{Count:48b,Slot:0b,id:\"minecraft:lantern\"},{Count:1b,Slot:1b,id:\"minecraft:golden_axe\",tag:{Damage:0}}]}" }, { "id": "minecraft:quartz_block", "x": -56, "y": "~2", "z": 77 } ] ``` -------------------------------- ### Place Blocks Response Body Example Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md An example JSON response from the `PUT /blocks` endpoint, indicating the status of block placement operations. ```JSON [ { "status": 1 }, { "status": 1 } ] ``` -------------------------------- ### Example Block Retrieval Response Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Example JSON response when requesting a single block. ```JSON [ { "id": "minecraft:grass_block", "x": 5525, "y": 62, "z": 4381 } ] ``` -------------------------------- ### Example Block Retrieval Response with State and Data Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Example JSON response when requesting a block with state and data included, such as chest contents. ```JSON [ { "id": "minecraft:chest", "x": -300, "y": 66, "z": 26, "state": { "facing": "west", "type": "single", "waterlogged": "false" }, "data": "{Items:[{Count:1b,Slot:0b,id:\"minecraft:flint_and_steel\",tag:{Damage:0}},{Count:3b,Slot:2b,id:\"minecraft:lantern\"},{Count:7b,Slot:4b,id:\"minecraft:dandelion\"}]}" } ] ``` -------------------------------- ### Running gdmc_http_interface from Source with Gradle Source: https://github.com/niels-ntg/gdmc_http_interface/wiki/Installation Instructions for developers to set up and run the gdmc_http_interface mod from its source code using Gradle. This involves cloning the repository and configuring an IDE. ```gradle Clone or fork the gdmc_http_interface repository. For Eclipse: Run the gradlew genEclipseRuns task. Refresh your project. For IntelliJ IDEA: Run the gradlew genIntellijRuns task. Reload the project from disk. Add a new Run Configuration under the "Application" tab, selecting the "runClient" configuration. Edit the configuration to fix the "module not specified" error by selecting the "main" module. After setup, open a Minecraft world to test the mod. ``` -------------------------------- ### Example Biome Response Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md An example JSON response when requesting biome data for a row of blocks using the GDMC HTTP interface. ```json [ { "id": "minecraft:river", "x": 2344, "y": 64, "z": -77 }, { "id": "minecraft:river", "x": 2345, "y": 64, "z": -77 }, { "id": "minecraft:river", "x": 2346, "y": 64, "z": -77 }, { "id": "minecraft:river", "x": 2347, "y": 64, "z": -77 }, { "id": "minecraft:river", "x": 2348, "y": 64, "z": -77 }, { "id": "minecraft:forest", "x": 2349, "y": 64, "z": -77 } ] ``` -------------------------------- ### Get Players API Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Retrieves player data from the Minecraft world. The response schema is defined in schema.players.get.json. Includes an example of a player named 'Dev'. ```APIDOC GET /players?includeData=true Response Body Schema: [schema.players.get.json] Example Response: [ { "name": "Dev", "uuid": "380df991-f603-344c-a090-369bad2a924a", "data": "{AbsorptionAmount:0.0f,Air:300s,Attributes:[{Base:0.10000000149011612d,Name:\"minecraft:generic.movement_speed\"}],Brain:{memories:{}},CanUpdate:1b,DataVersion:3120,DeathTime:0s,Dimension:\"minecraft:overworld\",EnderItems:[],FallDistance:0.0f,FallFlying:0b,Fire:-20s,Health:20.0f,HurtByTimestamp:0,HurtTime:0s,Inventory:[{Count:1b,Slot:0b,id:\"minecraft:obsidian\"},{Count:1b,Slot:1b,id:\"minecraft:flint_and_steel\",tag:{Damage:0}}],Invulnerable:0b,Motion:[0.0d,0.0d,0.0d],OnGround:0b,PortalCooldown:0,Pos:[-3.483559135420974d,-58.74889429576954d,-16.579720966624766d],Rotation:[1.6493444f,24.599985f],Score:0,SelectedItemSlot:1,SleepTimer:0s,UUID:[I;940439953,-167562164,-1601161573,-1389718966],XpLevel:0,XpP:0.0f,XpSeed:-275312302,XpTotal:0,abilities:{flySpeed:0.05f,flying:1b,instabuild:1b,invulnerable:1b,mayBuild:1b,mayfly:1b,walkSpeed:0.1f},foodExhaustionLevel:0.0f,foodLevel:20,foodSaturationLevel:5.0f,foodTickTimer:0,playerGameType:1,recipeBook:{isBlastingFurnaceFilteringCraftable:0b,isBlastingFurnaceGuiOpen:0b,isFilteringCraftable:0b,isFurnaceFilteringCraftable:0b,isFurnaceGuiOpen:0b,isGuiOpen:0b,isSmokerFilteringCraftable:0b,isSmokerGuiOpen:0b,recipes:[\"minecraft:flint_and_steel\",\"minecraft:enchanting_table\"],toBeDisplayed:[\"minecraft:flint_and_steel\",\"minecraft:enchanting_table\"]},seenCredits:0b,warden_spawn_tracker:{cooldown_ticks:0,ticks_since_last_warning:8788,warning_level:0}}" } ] ``` -------------------------------- ### Forge Mod Installation Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/README.md Instructions for installing the gdmc_http_interface mod with the Forge mod loader. Requires Minecraft Java Edition, Forge installer, and the mod's jar file. ```text 1. Install Minecraft Java Edition. 2. Download and run the Forge Mod Installer for a compatible Minecraft version. 3. Download the gdmc_http_interface mod jar from releases and place it in the Minecraft mods folder (e.g., %APPDATA%/.minecraft/mods on Windows). 4. Launch Minecraft with the Forge profile. ``` -------------------------------- ### Example Entity Data (Sheep) Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Example of NBT data structure for a Minecraft entity, specifically a sheep, as used in the GDMC HTTP Interface. ```JSON { "data": "{AbsorptionAmount:0.0f,Age:0,Air:300s,ArmorDropChances:[0.085f,0.085f,0.085f,0.085f],ArmorItems:[{},{},{},{}],Attributes:[{Base:0.23000000417232513d,Name:\"minecraft:generic.movement_speed\"},{Base:16.0d,Modifiers:[{Amount:-0.054645176271711594d,Name:\"Random spawn bonus\",Operation:1,UUID:[I;452273734,1153713910,-1393383184,760955385]},{Amount:0.03129074760589258d,Name:\"Random spawn bonus\",Operation:1,UUID:[I;114520113,359677977,-1350020086,1661730340]}],Name:\"minecraft:generic.follow_range\"},{Base:0.0d,Name:\"minecraft:generic.armor_toughness\"},{Base:0.0d,Name:\"minecraft:generic.attack_knockback\"},{Base:8.0d,Name:\"minecraft:generic.max_health\"},{Base:0.0d,Name:\"minecraft:generic.knockback_resistance\"},{Base:0.0d,Name:\"minecraft:generic.armor\"}],Brain:{memories:{}}},CanPickUpLoot:0b,CanUpdate:1b,Color:0b,DeathTime:0s,FallDistance:0.0f,FallFlying:0b,Fire:-1s,ForcedAge:0,HandDropChances:[0.085f,0.085f],HandItems:[{},{}],Health:8.0f,HurtByTimestamp:0,HurtTime:0s,InLove:0,Invulnerable:0b,LeftHanded:0b,Motion:[0.0d,-0.0784000015258789d,0.0d],OnGround:1b,PersistenceRequired:1b,PortalCooldown:0,Pos:[-16.02778909851362d,1.0d,-15.411003372310615d],Rotation:[249.61398f,0.0f],Sheared:0b,UUID:[I;1971995497,233916292,-1364705872,1232123532],id:\"minecraft:sheep\"} } ``` -------------------------------- ### Fabric Mod Installation Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/README.md Instructions for installing the gdmc_http_interface mod with the Fabric mod loader. Requires Minecraft Java Edition, Fabric installer, the mod's jar file, and Fabric API. ```text 1. Install Minecraft Java Edition. 2. Download and run the Fabric Mod Installer. 3. Download the gdmc_http_interface mod jar from releases and place it in the Minecraft mods folder (e.g., %APPDATA%/.minecraft/mods on Windows). 4. Download and place the Fabric API mod jar in the mods folder. 5. Launch Minecraft with the Fabric profile. ``` -------------------------------- ### POST /structure and GET /structure Endpoints Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CHANGELOG.md Handles the uploading and downloading of NBT-formatted structure files. Supports GZIP compression for both operations. ```APIDOC POST /structure Accepts GZIP-compressed or uncompressed NBT files. GET /structure Outputs GZIP-compressed (default) or uncompressed NBT files. To get uncompressed output, set "Accept-Encoding": "*". ``` -------------------------------- ### GET /version Endpoint Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CHANGELOG.md Provides information about the GDMC-HTTP interface version. Only GET requests are allowed. ```APIDOC GET /version Returns the current GDMC-HTTP version. Note: Returns 405 for any HTTP method other than GET (0.7.0+). ``` -------------------------------- ### GDMC HTTP Interface API Documentation Source: https://github.com/niels-ntg/gdmc_http_interface/wiki/Interface-Endpoints This section details the API endpoints for the GDMC HTTP Interface. It covers sending commands to Minecraft and reading block information, including URL parameters, request/response bodies, and examples. ```APIDOC Base URL: `localhost:9000` Error Codes: - `400`: "Could not parse query parameters" - `405`: "Method not allowed" - `500`: "Internal server error" Response Headers (Default): - `Access-Control-Allow-Origin`: `*` - `Content-Disposition`: `inline` - `Content-Type`: `text/plain; charset=UTF-8` (or `application/json; charset=UTF-8` if `Accept: application/json` is present) Send Commands: Endpoint: `POST /commands` Description: Send one or more Minecraft console commands to the server. URL Parameters: - `dimension`: (optional, default: `overworld`) Specifies the dimension for command execution (`overworld`, `the_nether`, `the_end`, `nether`, `end`). Request Body: - Plain-text, with commands separated by new lines. Response Body: - Plain-text, with return values for each command on separate lines (integer or error message). Example: ``` say start tp @p 0 70 0 setblock 0 69 0 stone fill -8 68 -8 8 68 8 oak_planks replace say end ``` Possible Response: ``` 1 1 1 289 1 ``` Or with errors: ``` 1 1 Could not set the block No blocks were filled 1 ``` Read Blocks: Endpoint: `GET /blocks` Description: Get information for one or more blocks in a given area. ``` -------------------------------- ### Get Minecraft Version Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Retrieves the plain-text response containing the Minecraft version number. ```APIDOC GET /version Description: Returns the Minecraft version number. Response Body: Type: text/plain Example: 1.21.4 ``` -------------------------------- ### Version Properties File Example Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CONTRIBUTING.md A properties file, named after the Minecraft version (e.g., `1.20.2.properties`), is used to store version-specific configurations for modding frameworks. This allows the project to manage dependencies and settings for different Minecraft versions. ```properties # Example properties file for Minecraft 1.20.2 # Specifies the version of the modding framework to use # For example, Fabric version fabric_version=0.14.21 # Or Forge version # forge_version=47.1.0 ``` -------------------------------- ### Querying Entities by Coordinates and Dimensions Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md This example shows how to query for entities within a specific bounding box defined by coordinates (x, y, z) and dimensions (dx, dy, dz). It also includes the `includeData=true` parameter to retrieve detailed data for each entity. ```HTTP GET /entities?x=508&y=60&z=1101&dx=10&dy=10&dz=10&includeData=true ``` -------------------------------- ### Get Blocks within Area Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Retrieves all blocks within a specified rectangular area defined by starting coordinates (x, y, z) and dimensions (dx, dy, dz). ```APIDOC GET /blocks?x=&y=&z=&dx=&dy=&dz= ``` -------------------------------- ### Gradle Build Configuration Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CONTRIBUTING.md Gradle is used for managing the build process. Key tasks include building and running the mod for specific mod loaders, such as 'Fabric Client (:fabric)' and 'Forge Client (:forge)'. The `gradle.properties` file is central to configuring project-wide settings like the mod version and target Minecraft version. ```gradle # Example gradle.properties content mod_version=1.0.0 targetMinecraftVersion=1.20.1 # Example Gradle task for Fabric client # ./gradlew fabricClient # Example Gradle task for Forge client # ./gradlew forgeClient ``` -------------------------------- ### API Documentation - Root Endpoint Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CONTRIBUTING.md This section details the OPTIONS request for the root API endpoint ('/'). It outlines the structure of the response, which includes information about the mod version, supported Minecraft versions, and available API endpoints. This is crucial for clients to understand the API's capabilities and version compatibility. ```APIDOC OPTIONS / Description: Returns information about the API, including mod version, supported Minecraft versions, and available endpoints. Parameters: None Responses: 200 OK: Content: application/json: Schema: type: object properties: mod_version: { type: string, description: "The current version of the mod." } supported_minecraft_versions: { type: array, items: { type: string }, description: "A list of Minecraft versions supported by this mod." } endpoints: type: object additionalProperties: type: object properties: description: { type: string } methods: { type: array, items: { type: string } } Example Response: { "mod_version": "1.6.0", "supported_minecraft_versions": ["1.20.1", "1.19.2"], "endpoints": { "/": { "description": "API root", "methods": ["OPTIONS"] }, "/some_other_endpoint": { "description": "Description of another endpoint", "methods": ["GET", "POST"] } } } ``` -------------------------------- ### Build Script for Mod Loaders Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CONTRIBUTING.md The `buildAll.sh` script is used to create a single compatible `.jar` file for each Minecraft version, supporting multiple mod loaders like Fabric and Forge. It facilitates code sharing across different modding frameworks by placing common code in the `common` namespace and loader-specific code in respective namespaces. ```shell #!/bin/bash # This script builds compatible jar files for all supported mod loaders and Minecraft versions. # Example usage: # ./buildAll.sh # Placeholder for actual build commands echo "Building for Fabric..." echo "Building for Forge..." ``` -------------------------------- ### API Documentation - Versioning and Changelog Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CONTRIBUTING.md This documentation entry covers the project's versioning strategy and the process for updating the project. It references Semantic Versioning (SemVer) and outlines the steps for updating the mod version, including modifying `gradle.properties`, updating documentation files like `README.md` and `docs/Endpoints.md`, and updating `CHANGELOG.md` with specific tags (NEW, FIX, BREAKING). ```APIDOC Project Versioning and Update Process: Schema: Semantic Versioning (SemVer) - https://semver.org/ Update Checklist: 1. Set `mod_version` in `gradle.properties`. 2. Find-and-replace previous version number in documentation: - `README.md` (version table, release/API docs links) - `docs/Endpoints.md` (heading, example output) 3. Update `CHANGELOG.md` with `NEW:`, `FIX:`, `BREAKING:` items. 4. Update other relevant documentation. 5. Run `buildAll.sh` to build distribution jars. 6. Perform manual tests across supported versions. 7. Commit changes. 8. Tag commit with `v` (e.g., `v1.6.0`). 9. Push commit and tag. 10. Draft GitHub release, paste changelog items, upload jars. 11. Announce update on GDMC Discord. 12. Update `CITATION.cff` with version, commit hash, and date. Updating to New Minecraft/Modding Framework Version: 1. Check for stable modding framework support for the new Minecraft version. 2. Create `.properties` file in `versionProperties/`. - Example: `1.20.2.properties` - Include framework version (e.g., `fabric_version=0.14.21`). 3. Set `targetMinecraftVersion` in `gradle.properties` to the new version. 4. Reload Gradle in IDE. ``` -------------------------------- ### Build All JARs Script Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CONTRIBUTING.md A bash script to compile JAR files for all supported Minecraft versions. This script requires the JAVA_HOME environment variable to be set correctly. ```bash buildAll.sh ``` -------------------------------- ### Heightmap Preset Types Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Explains the different heightmap presets available, including built-in Minecraft types and custom types provided by the mod. ```APIDOC Heightmap Presets: Built-in Minecraft Types: WORLD_SURFACE: Height of surface ignoring air blocks. OCEAN_FLOOR: Height of surface ignoring air, water, and lava. MOTION_BLOCKING: Height of surface ignoring non-collidable blocks (except water and lava). MOTION_BLOCKING_NO_LEAVES: Same as MOTION_BLOCKING, but also ignores leaves. Custom Mod Types: MOTION_BLOCKING_NO_PLANTS: Same as MOTION_BLOCKING_NO_LEAVES, but also ignores logs, bee nests, mangrove roots, giant mushroom blocks, pumpkin/carved pumpkin, melon, moss, nether wart, cactus, farmland, coral, sponges, bamboo, cobwebs, and sculk. OCEAN_FLOOR_NO_PLANTS: Same as OCEAN_FLOOR, but also excludes blocks listed for MOTION_BLOCKING_NO_PLANTS. ``` -------------------------------- ### GET /biomes Endpoint Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CHANGELOG.md Requests the biome information for a specific location in the world. ```APIDOC GET /biomes Retrieves the biome at a given world coordinate. ``` -------------------------------- ### Block Placement Response Source: https://github.com/niels-ntg/gdmc_http_interface/wiki/Interface-Endpoints Describes the response format for block placement instructions. A '1' indicates success, '0' if the block is already present, and an error code for other issues. The format depends on the 'Accept' header. ```json [ "1", "1" ] ``` -------------------------------- ### Get Minecraft Version Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Retrieves the current version of the Minecraft game. This endpoint does not require any parameters or request body. ```APIDOC GET /version Get the current version of Minecraft. URL parameters: None Request headers: None Request body: N/A Response headers: | key | value | |-----------------------------|-----------------------------| | Content-Type | `text/plain; charset=UTF-8` | ``` -------------------------------- ### Get Heightmap API Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Returns the heightmap of the set build area for a given type. Heightmaps are a feature of Minecraft that define terrain elevation. ```APIDOC GET /heightmap Description: Returns the [heightmap](https://minecraft.wiki/w/Heightmap) of the set build area of a given type. ``` -------------------------------- ### Get Biomes by Row Source: https://github.com/niels-ntg/gdmc_http_interface/wiki/Interface-Endpoints Retrieves biome information for a specified row of blocks. Supports both plain text and JSON output formats. ```APIDOC GET /biomes?x=2350&y=64&z=-77&dx=-6 Response (text): 2344 64 -77 minecraft:river 2345 64 -77 minecraft:river 2346 64 -77 minecraft:river 2347 64 -77 minecraft:river 2348 64 -77 minecraft:river 2349 64 -77 minecraft:forest Response (JSON with Accept: application/json): [ { "id": "minecraft:river", "x": 2344, "y": 64, "z": -77 }, { "id": "minecraft:river", "x": 2345, "y": 64, "z": -77 }, { "id": "minecraft:river", "x": 2346, "y": 64, "z": -77 }, { "id": "minecraft:river", "x": 2347, "y": 64, "z": -77 }, { "id": "minecraft:river", "x": 2348, "y": 64, "z": -77 }, { "id": "minecraft:forest", "x": 2349, "y": 64, "z": -77 } ] ``` -------------------------------- ### Internal Evaluation of doBlockUpdates and spawnDrops Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Shows the internal mapping of `doBlockUpdates` and `spawnDrops` parameters to the `customFlags` bit string. ```APIDOC doBlockUpdates=False, spawnDrops=False -> 0110010 doBlockUpdates=False, spawnDrops=True -> 0110010 doBlockUpdates=True, spawnDrops=False -> 0100011 (default behavior) doBlockUpdates=True, spawnDrops=True -> 0000011 ``` -------------------------------- ### Get Block by Coordinates Source: https://github.com/niels-ntg/gdmc_http_interface/wiki/Interface-Endpoints Retrieves a single block at specified coordinates (x, y, z). The response format can be plain text or JSON. ```http GET /blocks?x=-417&y=63&z=303 ``` -------------------------------- ### Place Structure API Source: https://github.com/niels-ntg/gdmc_http_interface/wiki/Interface-Endpoints Places an NBT structure file into the world at specified coordinates. Supports mirroring, rotation, and entity placement. The structure file can be compressed with GZIP. ```APIDOC POST /structure URL Parameters: x: X coordinate for placement (required). y: Y coordinate for placement (required). z: Z coordinate for placement (required). mirror: Mirror the structure ('x' or 'y'). rotate: Rotate the structure (0, 1, 2, or 3). pivotX: Relative X coordinate for rotation pivot. pivotY: Relative Y coordinate for rotation pivot. pivotZ: Relative Z coordinate for rotation pivot. entities: Whether to place entities ('true' or 'false'). Defaults to 'false'. dimension: Dimension to place the structure in ('overworld', 'the_nether', 'the_end', 'nether', 'end'). Defaults to 'overworld'. Request Headers: Accept: Response data type ('application/json' or 'text/plain'). Defaults to 'text/plain'. Content-Encoding: Compression type of the request body ('gzip' or '*'). Defaults to 'gzip'. '*' attempts both compressed and uncompressed. Request Body: A valid NBT file representing the structure. Response Body: - '1' if successful. - '0' or an error message if unsuccessful. - If `Accept: application/json`, the value is in a JSON array. ``` -------------------------------- ### Create Entities (PUT /entities) Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Endpoint for summoning entities into the world, mirroring the /summon command. Supports mobs, items, paintings, and projectiles. Requires entity ID, coordinates, and optional data. ```APIDOC PUT /entities URL Parameters: x: integer (required) - X coordinate y: integer (required) - Y coordinate z: integer (required) - Z coordinate dimension: string (optional, default: "overworld") - Dimension to place entities in (overworld, the_nether, the_end, nether, end) Request Body: A JSON array of entity objects, each with: id: string (required) - The entity ID (e.g., "minecraft:cat") x: string/integer (required) - X coordinate (can use relative '~') y: string/integer (required) - Y coordinate (can use relative '~') z: string/integer (required) - Z coordinate (can use relative '~') data: object (optional) - NBT data for the entity (e.g., "{variant:\"minecraft:red\",Invulnerable: true}") Response Body: A list of UUIDs for successfully placed entities or error codes. Example: PUT /entities?x=92&y=64&z=-394 [ { "id": "minecraft:cat", "x": "~2", "y": "~", "z": "~-1", "data": "{variant:\"minecraft:red\",Invulnerable: true,HasVisualFire: true}" }, { "id": "minecraft:painting", "x": "~-1", "y": 68, "z": "~2", "data": "{Facing:2,variant:\"wanderer\"}" }, { "id": "minecraft:zombie", "x": "~1", "y": "~", "z": "~-4", "data": "{CanBreakDoors:true}" } ] ``` -------------------------------- ### Get Block with State Source: https://github.com/niels-ntg/gdmc_http_interface/wiki/Interface-Endpoints Retrieves a block at specified coordinates, including its block state information. This is achieved by setting the `includeState=true` query parameter. ```http GET /blocks?x=-417&y=64&z=303&includeState=true ``` -------------------------------- ### Get Build Area Source: https://github.com/niels-ntg/gdmc_http_interface/wiki/Interface-Endpoints Retrieves the current build area defined within Minecraft. The build area can be set using the `/setbuildarea` command in-game. ```APIDOC GET /buildarea Description: Returns the current specified build area. This is a convenience command and does not restrict block placement. URL Parameters: None Request Headers: None Response Headers: Access-Control-Allow-Origin: * Content-Disposition: inline Content-Type: application/json; charset=UTF-8 Response Body: A JSON object containing the build area coordinates: { "xFrom": Integer, "yFrom": Integer, "zFrom": Integer, "xTo": Integer, "yTo": Integer, "zTo": Integer } Example: GET /buildarea Returns: { "xFrom": 2353, "yFrom": 63, "zFrom": -78, "xTo": 2553, "yTo": 263, "zTo": 122 } ``` -------------------------------- ### Place Blocks Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Places one or more blocks into the world at specified coordinates. Allows control over block updates, drop spawning, custom flags, build area constraints, and dimension. ```APIDOC PUT /blocks URL parameters: x (integer, required): X coordinate y (integer, required): Y coordinate z (integer, required): Z coordinate doBlockUpdates (boolean, optional, default: true): Controls block update behavior. spawnDrops (boolean, optional, default: false): Controls item drops when blocks are destroyed. customFlags (bit string, optional, default: "0100011"): Forces specific behaviors. withinBuildArea (boolean, optional, default: false): Restricts placement to the build area. dimension (string, optional, default: "overworld"): Specifies the dimension for placement (overworld, the_nether, the_end). ``` -------------------------------- ### Get Block by Coordinates Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Retrieves block information at a specific coordinate (x, y, z). Supports fetching block states and data by using includeState and includeData parameters. ```APIDOC GET /blocks?x=&y=&z= GET /blocks?x=&y=&z=&includeState=true GET /blocks?x=&y=&z=&includeState=true&includeData=true ``` -------------------------------- ### Read HTTP Interface Information Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Fetches information about the GDMC-HTTP instance and the running Minecraft version. This endpoint returns a JSON object with details about the Minecraft version, data version, and interface version. ```APIDOC OPTIONS / Description: Get information about the GDMC-HTTP instance and Minecraft. URL Parameters: None Request Headers: None Request Body: N/A Response Headers: [Default] Response Body: Type: application/json Content: - minecraftVersion: String, version number of the currently running Minecraft version. - DataVersion: Integer, version number of the Data Version of Minecraft. - interfaceVersion: String, version of the currently loaded GDMC-HTTP. Example: { "minecraftVersion": "1.21.4", "DataVersion": 4189, "interfaceVersion": "1.6.0-1.21.4" } ``` -------------------------------- ### Get Chunks API Source: https://github.com/niels-ntg/gdmc_http_interface/wiki/Interface-Endpoints Retrieves world chunks based on specified coordinates and dimensions. The response format can be NBT, SNBT, or JSON, determined by the 'Accept' header. ```APIDOC GET /chunks?x=&z=&dx=&dz=&dimension= Parameters: x: The starting X coordinate of the chunk. z: The starting Z coordinate of the chunk. dx: The width of the chunk area to retrieve. dz: The depth of the chunk area to retrieve. dimension: The dimension to retrieve chunks from (e.g., 'overworld', 'the_nether', 'the_end'). Defaults to 'overworld'. Accept Header: - `application/json`: Response is JSON formatted. - `text/plain`: Response is human-readable (SNBT or similar). - `application/octet-stream`: Response is raw NBT encoded. Response Body Properties: - ChunkX: The X coordinate of the chunk. - ChunkZ: The Z coordinate of the chunk. - ChunkDX: The width of the retrieved chunk area. - ChunkDZ: The depth of the retrieved chunk area. - Chunks: A list of chunks, each encoded in NBT, SNBT, or JSON format. Example Request: GET /chunks?x=0&z=8&dimension=nether Accept: text/plain Example Response (SNBT): {ChunkDX:1,ChunkDZ:1,ChunkX:0,ChunkZ:8,Chunks:[{DataVersion:3120,Heightmaps:{MOTION_BLOCKING:[L;2310355422147575936L,2310355422147575936L,2310355422147575936L,2310355422147575936L, ...]} ``` -------------------------------- ### GET /chunks Endpoint Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CHANGELOG.md Retrieves chunk data from the world. The default format changed to binary in 0.7.0, with JSON and plain text available via the Accept header. ```APIDOC GET /chunks Default Format: - Binary (0.7.0+) Available Formats: - JSON (when Accept: "application/json") - Plain Text (when Accept: "text/plain") ``` -------------------------------- ### Conditional Compilation with Manifold Preprocessor Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CONTRIBUTING.md Demonstrates how to use Manifold Preprocessor directives for conditional compilation based on Minecraft versions. This allows for code that adapts to different game versions. ```java #if (MC_VER == MC_1_19_2) import net.minecraft.server.level.ChunkHolder; #else import net.minecraft.server.level.FullChunkStatus; #endif ``` ```java #if (MC_VER == MC_1_19_2) blockState.getMaterial().blocksMotion() #else blockState.blocksMotion() #endif ``` -------------------------------- ### GET /blocks Endpoint Response Formats Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/CHANGELOG.md Retrieves block information from the world. Supports JSON and plain text formats, with variations in response structure across versions. ```APIDOC GET /blocks Response Formats: - JSON (when Accept: "application/json"): - Version 0.6.0 and later: JSON array of objects, each including block position. - Before 0.6.0: Single JSON object. - Plain Text (default or when Accept: "text/plain"): - Includes block position before material (version 0.6.0+). - Formatting of coordinates fixed in 0.6.2. Features: - Can return multiple blocks within a given area (0.6.0+). - Response always includes block position (0.6.0+). - OPTIONS /blocks endpoint removed in 0.6.0. ``` -------------------------------- ### Place NBT Structure File Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Allows placing an NBT structure file into the Minecraft world. Supports various transformations like mirroring and rotation, as well as options for entity placement, liquid handling, and block updates. The structure is placed at the specified coordinates. ```APIDOC POST /structure URL parameters: - x: integer (required) - X coordinate - y: integer (required) - Y coordinate - z: integer (required) - Z coordinate - mirror: string ('x', 'y', optional, defaults to '0') - Mirrors the structure front to back ('x') or left to right ('y'). - rotate: string ('0', '1', '2', '3', optional, defaults to '0') - Rotates the structure 0°, 90°, 180°, or 270° clockwise. - pivotX: integer (optional, defaults to '0') - Relative X coordinate for rotation pivot. - pivotZ: integer (optional, defaults to '0') - Relative Z coordinate for rotation pivot. - entities: boolean ('true', 'false', optional, defaults to 'false') - Whether to place entities saved with the file. - keepLiquids: boolean ('true', 'false', optional, defaults to 'true') - If false, removes water sources at the placement location. - doBlockUpdates: boolean ('true', 'false', optional, defaults to 'true') - Controls block update behavior. - spawnDrops: boolean ('true', 'false', optional, defaults to 'false') - Controls block drop behavior. - customFlags: string (bit string, optional, defaults to '0100011') - Custom flags for block placement behavior. - withinBuildArea: boolean ('true', 'false', optional, defaults to 'false') - If true, prevents placement outside the build area. - dimension: string ('overworld', 'the_nether', 'the_end', 'nether', 'end', optional, defaults to 'overworld') - Dimension to place the structure in. Note: Mirror transformation is applied first, then rotation. The pivot point applies to both. ``` -------------------------------- ### Get Build Area API Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Retrieves the current build area defined in Minecraft. The build area can be set using the `/setbuildarea` command. The response follows the schema defined in schema.buildarea.get.json. ```APIDOC GET /buildarea URL Parameters: None Request Headers: None Request Body: N/A Response Headers: [Default](#Response-headers) Response Body Schema: [schema.buildarea.get.json] Example Usage: Set build area in game: `/setbuildarea ~ ~ ~ ~200 ~200 ~200` Request build area: `GET /getbuildarea` Example Response: { "xFrom": 2353, "yFrom": 63, "zFrom": -78, "xTo": 2553, "yTo": 263, "zTo": 122 } ``` -------------------------------- ### Get Chunks API Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Reads chunk data within a given range and returns it as chunk data. Supports specifying chunk coordinates, range, build area filtering, and dimension. ```APIDOC GET /chunks URL Parameters: - x (integer, optional, default: 0): X chunk coordinate. - z (integer, optional, default: 0): Z chunk coordinate. - dx (integer, optional, default: 1): Range of chunks to get counting from x (can be negative). - dz (integer, optional, default: 1): Range of chunks to get counting from z (can be negative). - withinBuildArea (boolean, optional, default: false): If true and a build area is set, skip chunks outside the build area. - dimension (string, optional, default: 'overworld'): Dimension to read chunks from ('overworld', 'the_nether', 'the_end', 'nether', 'end'). Note: - To convert block coordinates to chunk coordinates, bit-shift x and z by 4 places to the right (e.g., `x >> 4`). - If build area is set and parameters like `x`, `z`, `dx`, `dz` are missing, they default to the build area's values. ``` -------------------------------- ### Create NBT Structure File Source: https://github.com/niels-ntg/gdmc_http_interface/blob/master/docs/Endpoints.md Endpoint for creating an NBT structure file from a specified area of the Minecraft world. ```APIDOC # 🏗️ Create NBT structure file `GET /structure` Create an [NBT](https://minecraft.wiki/w/NBT_format) structure file from an area of the world. ``` -------------------------------- ### Get Structure Area Source: https://github.com/niels-ntg/gdmc_http_interface/wiki/Interface-Endpoints Retrieves a specified area from the Minecraft world. Supports specifying dimensions and dimension. Entities are not included by default. Returns gzip-compressed, binary-encoded NBT data. ```APIDOC GET /structure Parameters: x: Integer, starting X coordinate y: Integer, starting Y coordinate z: Integer, starting Z coordinate dx: Integer, width of the area dy: Integer, height of the area dz: Integer, depth of the area dimension: String, the dimension to retrieve from (e.g., 'overworld', 'nether') entities: Boolean, whether to include entities (default: false) Response: Gzip-compressed, binary-encoded NBT data representing the structure. ```