From 7d96ec8f17bb53375ba1660dc1fcd9c53313016f Mon Sep 17 00:00:00 2001 From: DaanV2 Date: Tue, 6 Apr 2021 22:41:46 +0200 Subject: [PATCH] Adding format version regex --- .vscode/settings.json | 2 +- .../animation_controllers/animation_controller.json | 8 ++++++-- source/behavior/animations/animations.json | 3 ++- source/behavior/biomes/biomes.json | 5 ++++- source/behavior/blocks/blocks.json | 3 ++- source/behavior/entities/entities.json | 3 ++- source/behavior/items/items.json | 3 ++- source/behavior/recipes/recipes.json | 3 ++- source/behavior/spawn_rules/spawn_rules.json | 3 ++- source/general/format_version.json | 8 ++++++++ .../animation_controllers/animation_controller.json | 3 ++- source/resource/animations/actor_animation.json | 3 ++- source/resource/attachables/attachables.json | 3 ++- source/resource/entity/entity.json | 3 ++- source/resource/fog/fog.json | 5 ++++- source/resource/items/items.json | 3 ++- source/resource/models/entity/model_entity.json | 3 ++- source/resource/particles/particles.json | 3 ++- .../resource/render_controllers/render_controllers.json | 3 ++- source/resource/sounds/sound_definitions.json | 3 ++- 20 files changed, 53 insertions(+), 20 deletions(-) create mode 100644 source/general/format_version.json diff --git a/.vscode/settings.json b/.vscode/settings.json index 4d4b9039..b0ab0dc5 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,7 +4,7 @@ "[json]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, "[jsonc]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, - "prettier.printWidth": 150, + "prettier.printWidth": 180, "prettier.useTabs": false, "prettier.tabWidth": 2 } diff --git a/source/behavior/animation_controllers/animation_controller.json b/source/behavior/animation_controllers/animation_controller.json index 40a86221..b1d59d0c 100644 --- a/source/behavior/animation_controllers/animation_controller.json +++ b/source/behavior/animation_controllers/animation_controller.json @@ -5,12 +5,16 @@ { "format_version": "1.10.0", "animation_controllers": { - "controller.animation.example": { "initial_state": "default", "states": { "default": { "transitions": [{ "state_1": "query.is_baby" }] }, "state_1": {} } } + "controller.animation.example": { + "initial_state": "default", + "states": { "default": { "transitions": [{ "state_1": "query.is_baby" }] }, "state_1": {} } + } } } ], "allOf": [ { "if": { "properties": { "format_version": { "type": "string", "const": "1.8.0" } } }, "then": { "$ref": "./1.8.0/animation_controller.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/animation_controller.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/animation_controller.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/behavior/animations/animations.json b/source/behavior/animations/animations.json index 60f24953..212debe2 100644 --- a/source/behavior/animations/animations.json +++ b/source/behavior/animations/animations.json @@ -4,6 +4,7 @@ "examples": [{ "format_version": "1.10.0", "animations": { "animation.example": {} } }], "allOf": [ { "if": { "properties": { "format_version": { "type": "string", "const": "1.8.0" } } }, "then": { "$ref": "./1.8.0/animations.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/animations.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/animations.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/behavior/biomes/biomes.json b/source/behavior/biomes/biomes.json index ddbc9a51..cea89892 100644 --- a/source/behavior/biomes/biomes.json +++ b/source/behavior/biomes/biomes.json @@ -7,6 +7,9 @@ "type": "object", "title": "Biome", "description": "A biome definition", - "allOf": [{ "if": { "properties": { "format_version": { "type": "string", "const": "1.12.0" } } }, "then": { "$ref": "./1.12.0/biomes.json" } }] + "allOf": [ + { "if": { "properties": { "format_version": { "type": "string", "const": "1.12.0" } } }, "then": { "$ref": "./1.12.0/biomes.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } + ] } } diff --git a/source/behavior/blocks/blocks.json b/source/behavior/blocks/blocks.json index 8001bb1b..156f00d8 100644 --- a/source/behavior/blocks/blocks.json +++ b/source/behavior/blocks/blocks.json @@ -8,6 +8,7 @@ { "if": { "properties": { "format_version": { "type": "string", "const": "1.12.0" } } }, "then": { "$ref": "./1.12.0/blocks.json" } }, { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.0" } } }, "then": { "$ref": "./1.16.0/blocks.json" } }, { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.100" } } }, "then": { "$ref": "./1.16.100/blocks.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.200" } } }, "then": { "$ref": "./1.16.200/blocks.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.200" } } }, "then": { "$ref": "./1.16.200/blocks.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/behavior/entities/entities.json b/source/behavior/entities/entities.json index fbe00a44..3a227fde 100644 --- a/source/behavior/entities/entities.json +++ b/source/behavior/entities/entities.json @@ -21,6 +21,7 @@ { "if": { "properties": { "format_version": { "type": "string", "const": "1.13.0" } } }, "then": { "$ref": "./1.13.0/entities.json" } }, { "if": { "properties": { "format_version": { "type": "string", "const": "1.14.0" } } }, "then": { "$ref": "./1.14.0/entities.json" } }, { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.0" } } }, "then": { "$ref": "./1.16.0/entities.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.100" } } }, "then": { "$ref": "./1.16.100/entities.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.100" } } }, "then": { "$ref": "./1.16.100/entities.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/behavior/items/items.json b/source/behavior/items/items.json index 9b286340..57ef69a0 100644 --- a/source/behavior/items/items.json +++ b/source/behavior/items/items.json @@ -10,6 +10,7 @@ { "if": { "properties": { "format_version": { "type": "string", "const": "1.16" } } }, "then": { "$ref": "./1.16.0/items.json" } }, { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.0" } } }, "then": { "$ref": "./1.16.0/items.json" } }, { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.100" } } }, "then": { "$ref": "./1.16.100/items.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.200" } } }, "then": { "$ref": "./1.16.100/items.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.200" } } }, "then": { "$ref": "./1.16.100/items.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/behavior/recipes/recipes.json b/source/behavior/recipes/recipes.json index c9a72018..716fba72 100644 --- a/source/behavior/recipes/recipes.json +++ b/source/behavior/recipes/recipes.json @@ -15,6 +15,7 @@ ], "allOf": [ { "if": { "properties": { "format_version": { "type": "string", "const": "1.12" } } }, "then": { "$ref": "./1.12.0/recipes.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.12.0" } } }, "then": { "$ref": "./1.12.0/recipes.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.12.0" } } }, "then": { "$ref": "./1.12.0/recipes.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/behavior/spawn_rules/spawn_rules.json b/source/behavior/spawn_rules/spawn_rules.json index 4877e2f0..920c9dd0 100644 --- a/source/behavior/spawn_rules/spawn_rules.json +++ b/source/behavior/spawn_rules/spawn_rules.json @@ -6,6 +6,7 @@ ], "allOf": [ { "if": { "properties": { "format_version": { "type": "string", "const": "1.8.0" } } }, "then": { "$ref": "./1.8.0/spawn_rules.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.11.0" } } }, "then": { "$ref": "./1.11.0/spawn_rules.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.11.0" } } }, "then": { "$ref": "./1.11.0/spawn_rules.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/general/format_version.json b/source/general/format_version.json new file mode 100644 index 00000000..669ec3ba --- /dev/null +++ b/source/general/format_version.json @@ -0,0 +1,8 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "format_version", + "title": "Format version", + "description": "A version that tells minecraft what type of data format can be expected when reading this file.", + "pattern": "^[0-9,.]+?$", + "type": "string" +} diff --git a/source/resource/animation_controllers/animation_controller.json b/source/resource/animation_controllers/animation_controller.json index 2d92f021..97027e30 100644 --- a/source/resource/animation_controllers/animation_controller.json +++ b/source/resource/animation_controllers/animation_controller.json @@ -16,6 +16,7 @@ ], "allOf": [ { "if": { "properties": { "format_version": { "type": "string", "const": "1.8.0" } } }, "then": { "$ref": "./1.8.0/animation_controller.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/animation_controller.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/animation_controller.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/resource/animations/actor_animation.json b/source/resource/animations/actor_animation.json index 19625834..6ff8822b 100644 --- a/source/resource/animations/actor_animation.json +++ b/source/resource/animations/actor_animation.json @@ -4,6 +4,7 @@ "examples": [{ "format_version": "1.8.0", "animations": { "animation.annie.idle": { "loop": true, "animation_length": 2.12, "bones": {} } } }], "allOf": [ { "if": { "properties": { "format_version": { "type": "string", "const": "1.8.0" } } }, "then": { "$ref": "./1.8.0/actor_animation.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/actor_animation.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/actor_animation.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/resource/attachables/attachables.json b/source/resource/attachables/attachables.json index 4526ab62..588a22a5 100644 --- a/source/resource/attachables/attachables.json +++ b/source/resource/attachables/attachables.json @@ -19,6 +19,7 @@ "allOf": [ { "if": { "properties": { "format_version": { "type": "string", "const": "1.8.0" } } }, "then": { "$ref": "./1.8.0/attachables.json" } }, { "if": { "properties": { "format_version": { "type": "string", "const": "1.10" } } }, "then": { "$ref": "./1.10.0/attachables.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/attachables.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/attachables.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/resource/entity/entity.json b/source/resource/entity/entity.json index 6e5ae7d3..63f682df 100644 --- a/source/resource/entity/entity.json +++ b/source/resource/entity/entity.json @@ -21,6 +21,7 @@ ], "allOf": [ { "if": { "properties": { "format_version": { "type": "string", "const": "1.8.0" } } }, "then": { "$ref": "./1.8.0/entity.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/entity.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/entity.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/resource/fog/fog.json b/source/resource/fog/fog.json index 74d90f95..69eb9b3f 100644 --- a/source/resource/fog/fog.json +++ b/source/resource/fog/fog.json @@ -2,5 +2,8 @@ "$schema": "http://json-schema.org/draft-07/schema", "$id": "blockception.minecraft.resource.fog", "examples": [], - "allOf": [{ "if": { "properties": { "format_version": { "type": "string", "const": "1.16.100" } } }, "then": { "$ref": "./1.16.100/fog.json" } }] + "allOf": [ + { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.100" } } }, "then": { "$ref": "./1.16.100/fog.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } + ] } diff --git a/source/resource/items/items.json b/source/resource/items/items.json index 794f1cbf..f95671bf 100644 --- a/source/resource/items/items.json +++ b/source/resource/items/items.json @@ -12,6 +12,7 @@ ], "allOf": [ { "if": { "properties": { "format_version": { "type": "string", "const": "1.10" } } }, "then": { "$ref": "./1.10.0/items.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/items.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/items.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/resource/models/entity/model_entity.json b/source/resource/models/entity/model_entity.json index 0308dc6d..b4182e96 100644 --- a/source/resource/models/entity/model_entity.json +++ b/source/resource/models/entity/model_entity.json @@ -17,6 +17,7 @@ { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/model_entity.json" } }, { "if": { "properties": { "format_version": { "type": "string", "const": "1.12.0" } } }, "then": { "$ref": "./1.12.0/model_entity.json" } }, { "if": { "properties": { "format_version": { "type": "string", "const": "1.14.0" } } }, "then": { "$ref": "./1.14.0/model_entity.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.0" } } }, "then": { "$ref": "./1.16.0/model_entity.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.16.0" } } }, "then": { "$ref": "./1.16.0/model_entity.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/resource/particles/particles.json b/source/resource/particles/particles.json index 71c7ebe2..952cf4ae 100644 --- a/source/resource/particles/particles.json +++ b/source/resource/particles/particles.json @@ -13,6 +13,7 @@ ], "allOf": [ { "if": { "properties": { "format_version": { "type": "string", "const": "1.8.0" } } }, "then": { "$ref": "./1.8.0/particle.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/particle.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/particle.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/resource/render_controllers/render_controllers.json b/source/resource/render_controllers/render_controllers.json index fd4a47f9..c862a382 100644 --- a/source/resource/render_controllers/render_controllers.json +++ b/source/resource/render_controllers/render_controllers.json @@ -13,6 +13,7 @@ "allOf": [ { "if": { "properties": { "format_version": { "type": "string", "const": "1.8.0" } } }, "then": { "$ref": "./1.8.0/render_controllers.json" } }, { "if": { "properties": { "format_version": { "type": "string", "const": "1.10" } } }, "then": { "$ref": "./1.10.0/render_controllers.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/render_controllers.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.10.0" } } }, "then": { "$ref": "./1.10.0/render_controllers.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] } diff --git a/source/resource/sounds/sound_definitions.json b/source/resource/sounds/sound_definitions.json index 8a6fd7bc..5046b060 100644 --- a/source/resource/sounds/sound_definitions.json +++ b/source/resource/sounds/sound_definitions.json @@ -4,6 +4,7 @@ "examples": [{ "format_version": "1.14.0", "sound_definitions": { "music.game": { "category": "music", "sounds": [""] } } }], "allOf": [ { "if": { "properties": { "format_version": { "type": "string" } } }, "else": { "$ref": "./sound_definitions_unknown.json" } }, - { "if": { "properties": { "format_version": { "type": "string", "const": "1.14.0" } } }, "then": { "$ref": "./1.14.0/sound_definitions.json" } } + { "if": { "properties": { "format_version": { "type": "string", "const": "1.14.0" } } }, "then": { "$ref": "./1.14.0/sound_definitions.json" } }, + { "properties": { "format_version": { "$ref": "../../general/format_version.json" } } } ] }