Skip to content

Commit

Permalink
Merge pull request #13 from Niels-NTG/v0.7.5
Browse files Browse the repository at this point in the history
v0.7.5
  • Loading branch information
Niels-NTG authored Jan 29, 2023
2 parents 8d2a14d + b7cf108 commit cfd47a1
Show file tree
Hide file tree
Showing 19 changed files with 1,480 additions and 428 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# GDMC-HTTP 0.7.5 (Minecraft 1.19.2)
- NEW: `GET /entities` for reading entities within a certain area.
- NEW: `PUT /entities` for creating any number of entities.
- NEW: `PATCH /entities` for editing existing entities in the world.
- NEW: `DELETE /entities` for removing existing entities from the world.
- NEW: Add parameters `doBlockUpdates`, `spawnDrops` and `customFlags` from the `PUT /blocks` endpoint to the `POST /structure` endpoint as well.
- FIX: Issue where output with the response header `Content-Encoding: gzip` didn't actually return gzipped response for the endpoints `GET /chunks` and `GET /structures`.
- FIX: Partial refactor for improved readability and decreased branching.

# GDMC-HTTP 0.7.4 (Minecraft 1.19.2)
- FIX: Placement of multi-part blocks such as beds and doors.

Expand Down
39 changes: 20 additions & 19 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
jcenter()
mavenCentral()
}
dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
plugins {
id 'eclipse'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '5.1.+'
}
apply plugin: 'net.minecraftforge.gradle'
// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.
apply plugin: 'eclipse'
apply plugin: 'maven-publish'

version = '0.7.4'
version = '0.7.5'
group = 'com.nilsgawlik.gdmchttp' // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = 'gdmchttp'

sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '17' // Need this here so eclipse task generates correctly.
// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17.
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"

minecraft {
// The mappings can be changed at any time, and must be in the following format.
Expand All @@ -38,7 +32,7 @@ minecraft {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
Expand All @@ -54,7 +48,7 @@ minecraft {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'
Expand All @@ -70,12 +64,12 @@ minecraft {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
property 'forge.logging.markers', 'REGISTRIES'

// Recommended logging level for the console
property 'forge.logging.console.level', 'debug'

args '--mod', 'gdmchttp', '--all', '--output', file('src/generated/resources/')
args '--mod', 'gdmchttp', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

mods {
gdmchttp {
Expand All @@ -86,6 +80,9 @@ minecraft {
}
}

// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }

dependencies {
// Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency. And it's patches will be applied.
Expand Down Expand Up @@ -144,4 +141,8 @@ publishing {
url "file://${project.projectDir}/mcmodsrepo"
}
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
484 changes: 398 additions & 86 deletions docs/Endpoints.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/schema.blocks.put.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "array",
"items": {
"$ref": "#/definitions/PlacementInstructionElement"
"$ref": "#/definitions/BlockPlacementInstructionElement"
},
"definitions": {
"PlacementInstructionElement": {
"BlockPlacementInstructionElement": {
"type": "object",
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -69,7 +69,7 @@
"required": [
"id"
],
"title": "Placement Instruction Element"
"title": "Block Placement Instruction Element"
},
"PosAxis": {
"anyOf": [
Expand Down
50 changes: 50 additions & 0 deletions docs/schema.entities.get.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "array",
"items": {
"$ref": "#/definitions/EntityInformationElement"
},
"definitions": {
"EntityInformationElement": {
"type": "object",
"additionalProperties": false,
"properties": {
"uuid": {
"type": "string",
"format": "uuid"
},
"data": {
"type": "object",
"title": "Entity Data",
"description": "Object containing entity data (https://minecraft.fandom.com/wiki/Entity_format#Entity_Format) information. This is only included if URL parameter `includeData=true` is present.",
"examples": [
{
"Pos": [
197.50701490860138,
-2.0,
35.512435215238455
],
"variant": "minecraft:red",
"HasVisualFire": true,
"Invulnerable": true
}
]
}
},
"required": [
"uuid"
],
"title": "Entity Information Element"
},
"PosAxis": {
"type": "integer",
"title": "Position Axis",
"description": "Describe x/y/z absolute position of entity",
"examples": [
-2,
781,
97.44
]
}
}
}
37 changes: 37 additions & 0 deletions docs/schema.entities.patch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "array",
"items": {
"$ref": "#/definitions/EntityPatchInstructionElement"
},
"definitions": {
"EntityPatchInstructionElement": {
"type": "object",
"additionalProperties": false,
"properties": {
"uuid" {
"type": "string",
"title": "UUID",
"description": "Universally unique identifier (https://minecraft.fandom.com/wiki/Universally_unique_identifier) of an entity in the world"
},
"data": {
"type": "object",
"title": "Entity Data",
"description": "Object containing entity data (https://minecraft.fandom.com/wiki/Entity_format#Entity_Format) information",
"examples": [
{
"variant": "minecraft:red",
"HasVisualFire": true,
"Invulnerable": true
}
]
}
},
"required": [
"data",
"uuid"
],
"title": "Entity Patch Instruction Element"
}
}
}
79 changes: 79 additions & 0 deletions docs/schema.entities.put.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"type": "array",
"items": {
"$ref": "#/definitions/EntityPlacementInstructionElement"
},
"definitions": {
"EntityPlacementInstructionElement": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"title": "Entity ID",
"description": "Any namespaced entity ID",
"examples": [
"minecraft:cat",
"minecraft:cow",
"minecraft:painting"
]
},
"x": {
"$ref": "#/definitions/PosAxis"
},
"y": {
"$ref": "#/definitions/PosAxis"
},
"z": {
"$ref": "#/definitions/PosAxis"
},
"data": {
"type": "object",
"title": "Entity Data",
"description": "Object containing entity data (https://minecraft.fandom.com/wiki/Entity_format#Entity_Format) information",
"examples": [
{
"variant": "minecraft:red",
"HasVisualFire": true,
"Invulnerable": true
}
]
}
},
"required": [
"data",
"id",
"x",
"y",
"z"
],
"title": "Entity Placement Instruction Element"
},
"PosAxis": {
"anyOf": [
{
"type": "integer",
"description": "Any negative or positive number to represent absolute world coordinates",
"examples": [
-2,
781,
83.74
]
},
{
"type": "string",
"description": "Any negative or positive number to represent absolute world coordinates, a relative coordinate (https://minecraft.fandom.com/wiki/Coordinates#Relative_world_coordinates) or a local coordinate (https://minecraft.fandom.com/wiki/Coordinates#Local_coordinates)",
"examples": [
"-2",
"~84",
"^-412",
"~-2.22"
]
}
],
"title": "Position Axis",
"description": "Describe x/y/z placement position for entity. If omitted, axis value defaults to the corresponding axis in the request URL."
}
}
}
6 changes: 6 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven { url = 'https://maven.minecraftforge.net/' }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,6 @@ private static void createContexts() {
httpServer.createContext("/version", new MinecraftVersionHandler(mcServer));
httpServer.createContext("/biomes", new BiomesHandler(mcServer));
httpServer.createContext("/structure", new StructureHandler(mcServer));
httpServer.createContext("/entities", new EntitiesHandler(mcServer));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,11 @@ protected void internalHandle(HttpExchange httpExchange) throws IOException {

// Response headers
Headers responseHeaders = httpExchange.getResponseHeaders();
addDefaultResponseHeaders(responseHeaders);
setDefaultResponseHeaders(responseHeaders);
if (returnJson) {
addResponseHeadersContentTypeJson(responseHeaders);
setResponseHeadersContentTypeJson(responseHeaders);
} else {
addResponseHeadersContentTypePlain(responseHeaders);
setResponseHeadersContentTypePlain(responseHeaders);
}

resolveRequest(httpExchange, responseString);
Expand Down
Loading

0 comments on commit cfd47a1

Please sign in to comment.