Skip to content

Commit

Permalink
Finish blockstates schema
Browse files Browse the repository at this point in the history
Reformat all schemas
  • Loading branch information
marvin-roesch committed Dec 9, 2017
1 parent 6dddbeb commit 54b7ac7
Show file tree
Hide file tree
Showing 2 changed files with 270 additions and 86 deletions.
256 changes: 225 additions & 31 deletions src/main/resources/jsonSchemas/blockstates.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,263 @@
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Minecraft Blockstates JSON",
"definitions": {
"baseVariantObject": {
"type": "object",
"properties": {
"__comment": { "type": "string" },
"model": { "type": "string" },
"textures": {
"type": "object",
"additionalProperties": { "type": "string" }
},
"x": {
"type": "number",
"multipleOf": 22.5
},
"y": {
"type": "number",
"multipleOf": 22.5
},
"uvlock": { "type": "boolean" }
},
"additionalProperties": false
},
"vanillaVariantObject": {
"oneOf": [
{ "$ref": "#/definitions/baseVariantObject" },
{
"type": "array",
"items": {
"allOf": [
{ "$ref": "#/definitions/baseVariantObject" },
{
"properties": {
"weight": { "type": "number" }
}
}
]
}
}
]
},
"variantDefinition": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "object",
"additionalProperties": { "$ref": "#/definitions/variantObject" }
"patternProperties": {
"^([a-z0-9_]+=[^,]*,)*([a-z0-9_]+=[^,]*)$": {
"type": "array",
"items": { "$ref": "#/definitions/variantObject" }
},
"^[a-z0-9_]+$": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/variantObject" }
}
}
},
"variantObject": {
"allOf": [
{ "$ref": "#/definitions/baseVariantObject" },
{
"properties": {
"transform": { "$ref": "#/definitions/rootTransform" },
"weight": { "type": "number" },
"submodel": {
"oneOf": [
{ "type": "string" },
{
"type": "object",
"additionalProperties": {
"oneOf": [
{ "$ref": "#/definitions/variantObject" },
{
"type": "array",
"items": { "$ref": "#/definitions/variantObject" }
}
]
}
}
]
},
"custom": {
"type": "object",
"additionalProperties": true
}
}
}
]
},
"rootTransform": {
"oneOf": [
{ "$ref": "#/definitions/transform" },
{
"type": "object",
"patternProperties": {
"(third|first)person_(left|right)hand": { "$ref": "#/definitions/transform" },
"gui|head|ground|fixed": { "$ref": "#/definitions/transform" }
},
{
"type": "array",
"items": { "$ref": "#/definitions/variantObject" }
"additionalProperties": false
}
]
},
"transform": {
"oneOf": [
{
"type": "string",
"enum": ["identity", "forge:default-block", "forge:default-item", "forge:default-tool"]
},
{
"type": "object",
"required": ["matrix"],
"properties": {
"matrix": { "$ref": "#/definitions/transformMatrix" }
}
]
},
{ "$ref": "#/definitions/transformMatrix" },
{
"type": "object",
"properties": {
"translation": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": { "type": "number" }
},
"scale": {
"oneOf": [
{
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": { "type": "number" }
},
{ "type": "number" }
]
},
"rotation": { "$ref": "#/definitions/transformRotation" },
"post-rotation": { "$ref": "#/definitions/transformRotation" }
}
}
]
},
"transformMatrix": {
"type": "array",
"minItems": 3,
"maxItems": 3,
"items": {
"type": "array",
"minItems": 4,
"maxItems": 4,
"items": { "type": "number" }
}
},
"variantObject": {
"type": "object",
"properties": {
"__comment": {
"type": "string"
"transformRotation": {
"oneOf": [
{
"type": "array",
"minItems": 4,
"maxItems": 4,
"items": { "type": "number" }
},
"model": { "type": "string" },
"textures": {
{
"type": "object",
"additionalProperties": {
"type": "string"
"minProperties": 1,
"maxProperties": 1,
"properties": {
"x": { "type": "number" },
"y": { "type": "number" },
"z": { "type": "number" }
}
},
{
"type": "array",
"items": {
"type": "object",
"minProperties": 1,
"maxProperties": 1,
"properties": {
"x": { "type": "number" },
"y": { "type": "number" },
"z": { "type": "number" }
}
}
}
]
},
"multipartCase": {
"type": "object",
"properties": {
"apply": { "$ref": "#/definitions/vanillaVariantObject" },
"when": {
"oneOf": [
{
"type": "object",
"patternProperties": {
"^[a-z0-9_]*$": { }
},
"additionalProperties": false,
"not": { "required": ["OR"] }
},
{
"type": "object",
"properties": {
"OR": {
"type": "array",
"items": {
"type": "object",
"patternProperties": {
"^[a-z0-9_]*$": { }
},
"additionalProperties": false
}
}
},
"required": ["OR"],
"additionalProperties": false
}
]
}
},
"additionalProperties": false
"required": ["apply"]
}
},
"oneOf": [
{
"type": "object",
"properties": {
"__comment": {
"type": "string"
},
"__comment": { "type": "string" },
"variants": {
"type": "object",
"additionalProperties": { "$ref": "#/definitions/variantObject" }
"patternProperties": {
"^([a-z0-9_]+=[^,]*,)*([a-z0-9_]+=[^,]*)$": { "$ref": "#/definitions/vanillaVariantObject" }
}
}
},
"additionalProperties": false,
"required": [ "variants" ],
"not": { "required": [ "forge_marker" ] }
"required": ["variants"]
},
{
"type": "object",
"properties": {
"__comment": {
"type": "string"
},
"__comment": { "type": "string" },
"forge_marker": {
"type": "integer",
"enum": [ 1 ]
"enum": [1]
},
"variants": { "$ref": "#/definitions/variantDefinition" },
"defaults": { "$ref": "#/definitions/variantObject" }
"defaults": { "$ref": "#/definitions/variantObject" },
"multipart": {
"type": "array",
"items": { "$ref": "#/definitions/multipartCase" }
}
},
"additionalProperties": false,
"required": [ "forge_marker", "variants" ]
"dependencies": {
"defaults": ["forge_marker"],
"variants": ["forge_marker"],
"forge_marker": ["variants"],
"multipart": {
"not": { "required": ["forge_marker"] }
}
}
}
]
}
Loading

0 comments on commit 54b7ac7

Please sign in to comment.