Skip to content

Commit

Permalink
Merge pull request #12 from Niels-NTG/entities_endpoint
Browse files Browse the repository at this point in the history
Entities endpoint
  • Loading branch information
Niels-NTG authored Jan 29, 2023
2 parents b19e6a1 + e1f4984 commit b7cf108
Show file tree
Hide file tree
Showing 8 changed files with 1,091 additions and 77 deletions.
457 changes: 383 additions & 74 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."
}
}
}
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));
}
}
Loading

0 comments on commit b7cf108

Please sign in to comment.