From 5170c199c96fc70096527bc16e982809720b05bb Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Wed, 16 Feb 2022 17:44:42 +0100
Subject: [PATCH 01/17] Begin work
---
src/main/kotlin/json/SchemaProviders.kt | 58 +++++++++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100644 src/main/kotlin/json/SchemaProviders.kt
diff --git a/src/main/kotlin/json/SchemaProviders.kt b/src/main/kotlin/json/SchemaProviders.kt
new file mode 100644
index 000000000..54a298544
--- /dev/null
+++ b/src/main/kotlin/json/SchemaProviders.kt
@@ -0,0 +1,58 @@
+/*
+ * Minecraft Dev for IntelliJ
+ *
+ * https://minecraftdev.org
+ *
+ * Copyright (c) 2021 minecraft-dev
+ *
+ * MIT License
+ */
+
+package com.demonwav.mcdev.json
+
+import com.demonwav.mcdev.util.mcDomain
+import com.demonwav.mcdev.util.mcPath
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.vfs.VirtualFile
+import com.jetbrains.jsonSchema.extension.JsonSchemaFileProvider
+import com.jetbrains.jsonSchema.extension.JsonSchemaProviderFactory
+import com.jetbrains.jsonSchema.extension.SchemaType
+
+class SchemaProviderFactory : JsonSchemaProviderFactory {
+ override fun getProviders(project: Project) =
+ listOf(
+ SoundsSchemaProvider(),
+ PathBasedSchemaProvider("Minecraft Blockstates JSON", "blockstates", "blockstates/"),
+ PathBasedSchemaProvider("Minecraft Item Model JSON", "model_item", "models/item/"),
+ PathBasedSchemaProvider("Minecraft Block Model JSON", "model_block", "models/block/"),
+ PathBasedSchemaProvider("Minecraft Loot Table JSON", "loot_table", "loot_tables/"),
+ PathBasedSchemaProvider("Minecraft Advancement JSON", "advancement", "advancements/")
+ )
+}
+
+class SoundsSchemaProvider : JsonSchemaFileProvider {
+ companion object {
+ val FILE = JsonSchemaProviderFactory.getResourceFile(SchemaProviderFactory::class.java, "/jsonSchemas/sounds.schema.json")
+ }
+
+ override fun getName() = "Minecraft Sounds JSON"
+
+ override fun isAvailable(file: VirtualFile) = file.mcDomain != null && file.mcPath == "sounds.json"
+
+ override fun getSchemaType(): SchemaType = SchemaType.embeddedSchema
+
+ override fun getSchemaFile(): VirtualFile = FILE
+}
+
+class PathBasedSchemaProvider(name: String, schema: String, private val path: String) : JsonSchemaFileProvider {
+ private val _name = name
+ private val file = JsonSchemaProviderFactory.getResourceFile(SchemaProviderFactory::class.java, "/jsonSchemas/$schema.schema.json")
+
+ override fun getName() = this._name
+
+ override fun isAvailable(file: VirtualFile) = file.mcDomain != null && file.mcPath?.startsWith(path) == true
+
+ override fun getSchemaType(): SchemaType = SchemaType.embeddedSchema
+
+ override fun getSchemaFile(): VirtualFile = file
+}
\ No newline at end of file
From af1f0f6b123dabd2f703d334c423514aa1e66d46 Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Wed, 16 Feb 2022 18:03:45 +0100
Subject: [PATCH 02/17] Add all schemas
---
src/main/resources/META-INF/plugin.xml | 4 +
.../jsonSchemas/blockstates.schema.json | 18 ++
.../blockstates_common.schema.json | 23 ++
.../jsonSchemas/blockstates_forge.schema.json | 171 ++++++++++++++
.../blockstates_vanilla.schema.json | 94 ++++++++
.../resources/jsonSchemas/common.schema.json | 48 ++++
.../jsonSchemas/loot_table.schema.json | 210 ++++++++++++++++++
.../loot_table_conditions.schema.json | 45 ++++
.../loot_table_functions.schema.json | 76 +++++++
.../jsonSchemas/model_block.schema.json | 17 ++
.../jsonSchemas/model_common.schema.json | 108 +++++++++
.../jsonSchemas/model_item.schema.json | 31 +++
.../resources/jsonSchemas/sounds.schema.json | 50 +++++
13 files changed, 895 insertions(+)
create mode 100644 src/main/resources/jsonSchemas/blockstates.schema.json
create mode 100644 src/main/resources/jsonSchemas/blockstates_common.schema.json
create mode 100644 src/main/resources/jsonSchemas/blockstates_forge.schema.json
create mode 100644 src/main/resources/jsonSchemas/blockstates_vanilla.schema.json
create mode 100644 src/main/resources/jsonSchemas/common.schema.json
create mode 100644 src/main/resources/jsonSchemas/loot_table.schema.json
create mode 100644 src/main/resources/jsonSchemas/loot_table_conditions.schema.json
create mode 100644 src/main/resources/jsonSchemas/loot_table_functions.schema.json
create mode 100644 src/main/resources/jsonSchemas/model_block.schema.json
create mode 100644 src/main/resources/jsonSchemas/model_common.schema.json
create mode 100644 src/main/resources/jsonSchemas/model_item.schema.json
create mode 100644 src/main/resources/jsonSchemas/sounds.schema.json
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index 85c4e4db6..bf757f647 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -861,6 +861,10 @@
+
+
+
+
diff --git a/src/main/resources/jsonSchemas/blockstates.schema.json b/src/main/resources/jsonSchemas/blockstates.schema.json
new file mode 100644
index 000000000..aa6449a17
--- /dev/null
+++ b/src/main/resources/jsonSchemas/blockstates.schema.json
@@ -0,0 +1,18 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Minecraft Blockstates JSON",
+ "oneOf": [
+ {
+ "allOf": [
+ { "required": [ "forge_marker" ] },
+ { "$ref": "blockstates_forge.schema.json" }
+ ]
+ },
+ {
+ "allOf": [
+ { "not": { "required": [ "forge_marker" ] } },
+ { "$ref": "blockstates_vanilla.schema.json" }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/main/resources/jsonSchemas/blockstates_common.schema.json b/src/main/resources/jsonSchemas/blockstates_common.schema.json
new file mode 100644
index 000000000..93b56fd84
--- /dev/null
+++ b/src/main/resources/jsonSchemas/blockstates_common.schema.json
@@ -0,0 +1,23 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Minecraft Blockstates JSON",
+ "baseVariant": {
+ "type": "object",
+ "properties": {
+ "model": { "type": "string" },
+ "textures": {
+ "type": "object",
+ "additionalProperties": { "type": "string" }
+ },
+ "x": {
+ "type": "number",
+ "multipleOf": 22.5
+ },
+ "y": {
+ "type": "number",
+ "multipleOf": 22.5
+ },
+ "uvlock": { "type": "boolean" }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/jsonSchemas/blockstates_forge.schema.json b/src/main/resources/jsonSchemas/blockstates_forge.schema.json
new file mode 100644
index 000000000..ec440b246
--- /dev/null
+++ b/src/main/resources/jsonSchemas/blockstates_forge.schema.json
@@ -0,0 +1,171 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Minecraft Forge Blockstates JSON",
+ "type": "object",
+ "properties": {
+ "forge_marker": {
+ "type": "integer",
+ "enum": [ 1 ]
+ },
+ "variants": { "$ref": "#/definitions/variants" },
+ "defaults": { "$ref": "#/definitions/variantObject" }
+ },
+ "required": [ "forge_marker" ],
+ "definitions": {
+ "variants": {
+ "type": "object",
+ "patternProperties": {
+ "^([a-z0-9_]+=[^,]*,)*([a-z0-9_]+=[^,]*)$": {
+ "$ref": "#/definitions/variant"
+ },
+ "^[a-z0-9_]+$": {
+ "oneOf": [
+ {
+ "type": "object",
+ "additionalProperties": { "$ref": "#/definitions/variant" }
+ },
+ {
+ "type": "array",
+ "items": { "$ref": "#/definitions/variantObject" }
+ }
+ ]
+ }
+ },
+ "additionalProperties": false
+ },
+ "variant": {
+ "anyOf": [
+ { "$ref": "#/definitions/variantObject" },
+ {
+ "type": "array",
+ "items": { "$ref": "#/definitions/variantObject" }
+ }
+ ]
+ },
+ "variantObject": {
+ "allOf": [
+ { "$ref": "blockstates_common.schema.json#/baseVariant" },
+ {
+ "properties": {
+ "transform": { "$ref": "#/definitions/rootTransform" },
+ "weight": { "type": "number" },
+ "submodel": {
+ "oneOf": [
+ { "type": "string" },
+ {
+ "type": "object",
+ "additionalProperties": {
+ "$ref": "#/definitions/variant"
+ }
+ }
+ ]
+ },
+ "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" }
+ },
+ "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" }
+ },
+ "additionalProperties": false
+ },
+ { "$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" }
+ },
+ "additionalProperties": false
+ }
+ ]
+ },
+ "transformMatrix": {
+ "type": "array",
+ "minItems": 3,
+ "maxItems": 3,
+ "items": {
+ "type": "array",
+ "minItems": 4,
+ "maxItems": 4,
+ "items": { "type": "number" }
+ }
+ },
+ "transformRotation": {
+ "oneOf": [
+ {
+ "type": "array",
+ "minItems": 4,
+ "maxItems": 4,
+ "items": { "type": "number" }
+ },
+ {
+ "type": "object",
+ "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" }
+ }
+ }
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/jsonSchemas/blockstates_vanilla.schema.json b/src/main/resources/jsonSchemas/blockstates_vanilla.schema.json
new file mode 100644
index 000000000..f3ac0107d
--- /dev/null
+++ b/src/main/resources/jsonSchemas/blockstates_vanilla.schema.json
@@ -0,0 +1,94 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Minecraft Vanilla Blockstates JSON",
+ "type": "object",
+ "properties": {
+ "variants": {
+ "type": "object",
+ "patternProperties": {
+ "^([a-z0-9_]+=[^,]*,)*([a-z0-9_]+=[^,]*)$": { "$ref": "#/definitions/variant" }
+ },
+ "additionalProperties": false
+ },
+ "multipart": {
+ "type": "array",
+ "items": { "$ref": "#/definitions/multipartCase" }
+ }
+ },
+ "dependencies": {
+ "variants": {
+ "required": [ "variants" ],
+ "not": { "title": "Multipart and full variant definitions are mutually exclusive", "required": [ "multipart" ] }
+ },
+ "multipart": {
+ "required": [ "multipart" ],
+ "not": { "title": "Multipart and full variant definitions are mutually exclusive", "required": [ "variants" ] }
+ }
+ },
+ "definitions": {
+ "variant": {
+ "anyOf": [
+ {
+ "allOf": [
+ { "$ref": "blockstates_common.schema.json#/baseVariant" },
+ { "required": [ "model" ] }
+ ]
+ },
+ {
+ "type": "array",
+ "items": {
+ "allOf": [
+ { "$ref": "blockstates_common.schema.json#/baseVariant" },
+ { "required": [ "model" ] },
+ {
+ "properties": {
+ "weight": {
+ "type": "number"
+ }
+ }
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "multipartCase": {
+ "type": "object",
+ "properties": {
+ "apply": {
+ "$ref": "#/definitions/variant"
+ },
+ "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
+ }
+ ]
+ }
+ },
+ "required": [ "apply" ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/jsonSchemas/common.schema.json b/src/main/resources/jsonSchemas/common.schema.json
new file mode 100644
index 000000000..8d63d7144
--- /dev/null
+++ b/src/main/resources/jsonSchemas/common.schema.json
@@ -0,0 +1,48 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "integerRange": {
+ "oneOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "min": { "type": "integer" },
+ "max": { "type": "integer" }
+ },
+ "required": [ "min", "max" ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "floatRange": {
+ "oneOf": [
+ {
+ "type": "number"
+ },
+ {
+ "type": "object",
+ "properties": {
+ "min": { "type": "number" },
+ "max": { "type": "number" }
+ },
+ "required": [ "min", "max" ],
+ "additionalProperties": false
+ }
+ ]
+ },
+ "equipmentSlot": { "type": "string", "enum": [ "mainhand", "offhand", "feet", "legs", "chest", "head" ] },
+ "equipmentSlots": {
+ "oneOf": [
+ { "$ref": "#/equipmentSlot" },
+ { "type": "array", "items": { "$ref": "#/equipmentSlot" } }
+ ]
+ },
+ "textComponent": {
+ "anyOf": [
+ { "type": "string" },
+ { "type": "object" }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/jsonSchemas/loot_table.schema.json b/src/main/resources/jsonSchemas/loot_table.schema.json
new file mode 100644
index 000000000..df5fa5536
--- /dev/null
+++ b/src/main/resources/jsonSchemas/loot_table.schema.json
@@ -0,0 +1,210 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Minecraft Loot Table JSON",
+ "type": "object",
+ "properties": {
+ "pools": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "conditions": { "$ref": "#/definitions/conditions" },
+ "rolls": { "$ref": "common.schema.json#/integerRange" },
+ "bonusRolls": { "$ref": "common.schema.json#/integerRange" },
+ "entries": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "conditions": { "$ref": "#/definitions/conditions" },
+ "type": { "type": "string" },
+ "weight": { "type": "number" },
+ "quality": { "type": "number" }
+ },
+ "required": [ "type" ],
+ "anyOf": [
+ {
+ "allOf": [
+ { "properties": { "type": { "enum": [ "item" ] } } },
+ {
+ "properties": {
+ "name": { "type": "string" },
+ "functions": { "$ref": "#/definitions/functions" }
+ },
+ "required": [ "name" ]
+ }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "type": { "enum": [ "loot_table" ] } } },
+ {
+ "properties": {
+ "name": { "type": "string" }
+ },
+ "required": [ "name" ]
+ }
+ ]
+ },
+ { }
+ ]
+ }
+ }
+ },
+ "required": [ "entries" ]
+ }
+ }
+ },
+ "definitions": {
+ "conditions": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "condition": {
+ "anyOf": [
+ { "type": "string" },
+ {
+ "type": "string",
+ "enum": [
+ "entity_properties",
+ "entity_scores",
+ "killed_by_player",
+ "random_chance",
+ "random_chance_with_looting"
+ ]
+ }
+ ]
+ }
+ },
+ "required": [ "condition" ],
+ "anyOf": [
+ {
+ "allOf": [
+ { "properties": { "condition": { "enum": [ "entity_properties" ] } } },
+ { "$ref": "loot_table_conditions.schema.json#/entityProperties" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "condition": { "enum": [ "entity_scores" ] } } },
+ { "$ref": "loot_table_conditions.schema.json#/entityScores" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "condition": { "enum": [ "killed_by_player" ] } } },
+ { "$ref": "loot_table_conditions.schema.json#/killedByPlayer" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "condition": { "enum": [ "random_chance" ] } } },
+ { "$ref": "loot_table_conditions.schema.json#/randomChance" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "condition": { "enum": [ "random_chance_with_looting" ] } } },
+ { "$ref": "loot_table_conditions.schema.json#/randomChanceWithLooting" }
+ ]
+ },
+ { }
+ ]
+ }
+ },
+ "functions": {
+ "type": "array",
+ "items": { "$ref": "#/definitions/function" }
+ },
+ "function": {
+ "type": "object",
+ "properties": {
+ "function": {
+ "anyOf": [
+ { "type": "string" },
+ {
+ "type": "string",
+ "enum": [
+ "enchant_randomly",
+ "enchant_with_levels",
+ "exploration_map",
+ "furnace_smelt",
+ "looting_enchant",
+ "set_attributes",
+ "set_count",
+ "set_damage",
+ "set_data",
+ "set_nbt"
+ ]
+ }
+ ]
+ },
+ "conditions": { "$ref": "#/definitions/conditions" }
+ },
+ "required": [ "function" ],
+ "anyOf": [
+ {
+ "allOf": [
+ { "properties": { "function": { "enum": [ "enchant_randomly" ] } } },
+ { "$ref": "loot_table_functions.schema.json#/enchantRandomly" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "function": { "enum": [ "enchant_with_levels" ] } } },
+ { "$ref": "loot_table_functions.schema.json#/enchantWithLevels" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "function": { "enum": [ "exploration_map" ] } } },
+ { "$ref": "loot_table_functions.schema.json#/explorationMap" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "function": { "enum": [ "furnace_smelt" ] } } }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "function": { "enum": [ "looting_enchant" ] } } },
+ { "$ref": "loot_table_functions.schema.json#/lootingEnchant" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "function": { "enum": [ "set_attributes" ] } } },
+ { "$ref": "loot_table_functions.schema.json#/setAttributes" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "function": { "enum": [ "set_count" ] } } },
+ { "$ref": "loot_table_functions.schema.json#/setCount" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "function": { "enum": [ "set_damage" ] } } },
+ { "$ref": "loot_table_functions.schema.json#/setDamage" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "function": { "enum": [ "set_data" ] } } },
+ { "$ref": "loot_table_functions.schema.json#/setData" }
+ ]
+ },
+ {
+ "allOf": [
+ { "properties": { "function": { "enum": [ "set_nbt" ] } } },
+ { "$ref": "loot_table_functions.schema.json#/setNbt" }
+ ]
+ },
+ { }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/jsonSchemas/loot_table_conditions.schema.json b/src/main/resources/jsonSchemas/loot_table_conditions.schema.json
new file mode 100644
index 000000000..090d6c146
--- /dev/null
+++ b/src/main/resources/jsonSchemas/loot_table_conditions.schema.json
@@ -0,0 +1,45 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "entityProperties": {
+ "properties": {
+ "entity": {
+ "type": "string",
+ "enum": [ "this", "killer", "killer_player" ]
+ },
+ "properties": {
+ "type": "object",
+ "properties": {
+ "on_fire": { "type": "boolean" }
+ }
+ }
+ }
+ },
+ "entityScores": {
+ "properties": {
+ "entity": {
+ "type": "string",
+ "enum": [ "this", "killer", "killer_player" ]
+ },
+ "scores": {
+ "type": "object",
+ "additionalProperties": { "$ref": "common.schema.json#/integerRange" }
+ }
+ }
+ },
+ "killedByPlayer": {
+ "properties": {
+ "on_fire": { "type": "inverse" }
+ }
+ },
+ "randomChance": {
+ "properties": {
+ "chance": { "type": "number", "minimum": 0, "maximum": 1 }
+ }
+ },
+ "randomChanceWithLooting": {
+ "properties": {
+ "chance": { "type": "number", "minimum": 0, "maximum": 1 },
+ "looting_multiplier": { "type": "number" }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/jsonSchemas/loot_table_functions.schema.json b/src/main/resources/jsonSchemas/loot_table_functions.schema.json
new file mode 100644
index 000000000..a73269232
--- /dev/null
+++ b/src/main/resources/jsonSchemas/loot_table_functions.schema.json
@@ -0,0 +1,76 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "enchantRandomly": {
+ "properties": {
+ "enchantments": {
+ "type": "array",
+ "items": { "type": "string" }
+ }
+ }
+ },
+ "enchantWithLevels": {
+ "properties": {
+ "treasure": { "type": "boolean" },
+ "levels": { "$ref": "common.schema.json#/integerRange" }
+ }
+ },
+ "explorationMap": {
+ "properties": {
+ "destination": { "type": "string" },
+ "decoration": { "type": "string" },
+ "zoom": { "type": "integer" },
+ "search_radius": { "type": "integer" },
+ "skip_existing_chunks": { "type": "boolean" }
+ }
+ },
+ "lootingEnchant": {
+ "properties": {
+ "limit": { "type": "integer", "minimum": 0 },
+ "count": { "$ref": "common.schema.json#/integerRange" }
+ }
+ },
+ "setAttributes": {
+ "properties": {
+ "modifiers": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "name": { "type": "string" },
+ "attribute": { "type": "string" },
+ "operation": { "type": "string", "enum": [ "addition", "multiply_base", "multiply_total" ] },
+ "amount": { "$ref": "common.schema.json#/floatRange" },
+ "id": { "type": "string" },
+ "slot": { "$ref": "common.schema.json#/equipmentSlots" }
+ },
+ "additionalProperties": false,
+ "required": [ "name", "attribute", "operation", "amount" ]
+ }
+ }
+ }
+ },
+ "setCount": {
+ "properties": {
+ "count": { "$ref": "common.schema.json#/integerRange" }
+ },
+ "required": [ "count" ]
+ },
+ "setDamage": {
+ "properties": {
+ "damage": { "$ref": "common.schema.json#/floatRange" }
+ },
+ "required": [ "damage" ]
+ },
+ "setData": {
+ "properties": {
+ "data": { "$ref": "common.schema.json#/integerRange" }
+ },
+ "required": [ "data" ]
+ },
+ "setNbt": {
+ "properties": {
+ "tag": { "type": "string" }
+ },
+ "required": [ "tag" ]
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/jsonSchemas/model_block.schema.json b/src/main/resources/jsonSchemas/model_block.schema.json
new file mode 100644
index 000000000..d4f5990c0
--- /dev/null
+++ b/src/main/resources/jsonSchemas/model_block.schema.json
@@ -0,0 +1,17 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Minecraft Block Model JSON",
+ "type": "object",
+ "properties": {
+ "parent": { "type": "string" },
+ "textures": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "ambientocclusion": { "type": "boolean" },
+ "elements": { "$ref": "model_common.schema.json#/elements" },
+ "display": { "$ref": "model_common.schema.json#/transforms" }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/jsonSchemas/model_common.schema.json b/src/main/resources/jsonSchemas/model_common.schema.json
new file mode 100644
index 000000000..69e2d128f
--- /dev/null
+++ b/src/main/resources/jsonSchemas/model_common.schema.json
@@ -0,0 +1,108 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "elements": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "from": { "$ref": "#/elementCoord" },
+ "to": { "$ref": "#/elementCoord" },
+ "rotation": {
+ "type": "object",
+ "properties": {
+ "origin": { "$ref": "#/elementCoord" },
+ "axis": {
+ "type": "string",
+ "enum": [ "x", "y", "z" ]
+ },
+ "angle": {
+ "type": "number",
+ "multipleOf": 22.5,
+ "minimum": -45,
+ "maximum": 45
+ }
+ },
+ "additionalProperties": false,
+ "required": [ "axis" ]
+ },
+ "faces": {
+ "type": "object",
+ "patternProperties": {
+ "down|up|north|south|west|east": {
+ "type": "object",
+ "properties": {
+ "uv": {
+ "type": "array",
+ "minItems": 4,
+ "maxItems": 4,
+ "items": {
+ "type": "number"
+ }
+ },
+ "texture": {
+ "type": "string",
+ "pattern": "^#.*?"
+ },
+ "cullface": {
+ "type": "string",
+ "enum": [ "down", "up", "north", "south", "west", "east" ]
+ },
+ "rotation": {
+ "type": "integer",
+ "enum": [ 0, 90, 180, 270 ]
+ },
+ "tintindex": {
+ "type": "integer"
+ }
+ }
+ }
+ },
+ "additionalProperties": false
+ }
+ },
+ "required": [ "from", "to" ]
+ }
+ },
+ "elementCoord": {
+ "type": "array",
+ "minItems": 3,
+ "maxItems": 3,
+ "items": {
+ "type": "number",
+ "minimum": -16,
+ "maximum": 32
+ }
+ },
+ "transforms": {
+ "type": "object",
+ "patternProperties": {
+ "(third|first)person_(left|right)hand": { "$ref": "#/transform" },
+ "gui|head|ground|fixed": { "$ref": "#/transform" }
+ },
+ "additionalProperties": false
+ },
+ "transform": {
+ "type": "object",
+ "properties": {
+ "rotation": {
+ "type": "array",
+ "minItems": 3,
+ "maxItems": 3,
+ "items": { "type": "number" }
+ },
+ "translation": {
+ "type": "array",
+ "minItems": 3,
+ "maxItems": 3,
+ "items": { "type": "number", "minimum": -80, "maximum": 80 }
+ },
+ "scale": {
+ "type": "array",
+ "minItems": 3,
+ "maxItems": 3,
+ "items": { "type": "number", "minimum": -4, "maximum": 4 }
+ }
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/jsonSchemas/model_item.schema.json b/src/main/resources/jsonSchemas/model_item.schema.json
new file mode 100644
index 000000000..1a7db14d3
--- /dev/null
+++ b/src/main/resources/jsonSchemas/model_item.schema.json
@@ -0,0 +1,31 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Minecraft Item Model JSON",
+ "type": "object",
+ "properties": {
+ "parent": { "type": "string" },
+ "textures": {
+ "type": "object",
+ "additionalProperties": {
+ "type": "string"
+ }
+ },
+ "elements": { "$ref": "model_common.schema.json#/elements" },
+ "display": { "$ref": "model_common.schema.json#/transforms" },
+ "overrides": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "properties": {
+ "predicate": {
+ "type": "object",
+ "additionalProperties": { "type": "number" }
+ },
+ "model": { "type": "string" }
+ },
+ "additionalProperties": false,
+ "required": [ "predicate", "model" ]
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/main/resources/jsonSchemas/sounds.schema.json b/src/main/resources/jsonSchemas/sounds.schema.json
new file mode 100644
index 000000000..73101387f
--- /dev/null
+++ b/src/main/resources/jsonSchemas/sounds.schema.json
@@ -0,0 +1,50 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "title": "Minecraft Sounds JSON",
+ "type": "object",
+ "additionalProperties": {
+ "type": "object",
+ "properties": {
+ "category": { "type": "string" },
+ "replace": { "type": "boolean" },
+ "subtitle": { "type": "string" },
+ "sounds": {
+ "type": "array",
+ "items": {
+ "oneOf": [
+ { "type": "string" },
+ {
+ "type": "object",
+ "properties": {
+ "name": { "type": "string" },
+ "volume": {
+ "type": "number",
+ "minimum": 0,
+ "maximum": 1,
+ "default": 1
+ },
+ "pitch": {
+ "type": "number",
+ "default": 1
+ },
+ "weight": {
+ "type": "number",
+ "default": 1
+ },
+ "stream": {
+ "type": "boolean",
+ "default": false
+ },
+ "type": {
+ "enum": ["sound", "event"],
+ "default": "sound"
+ }
+ }
+ }
+ ]
+ },
+ "uniqueItems": true
+ }
+ }
+ }
+}
\ No newline at end of file
From cb952c33b6e9222091930642224c1104eeb264a6 Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Wed, 16 Feb 2022 18:04:36 +0100
Subject: [PATCH 03/17] Add advancement.schema.json
---
.../jsonSchemas/advancement.schema.json | 112 ++++++++++++++++++
1 file changed, 112 insertions(+)
create mode 100644 src/main/resources/jsonSchemas/advancement.schema.json
diff --git a/src/main/resources/jsonSchemas/advancement.schema.json b/src/main/resources/jsonSchemas/advancement.schema.json
new file mode 100644
index 000000000..55ce40e26
--- /dev/null
+++ b/src/main/resources/jsonSchemas/advancement.schema.json
@@ -0,0 +1,112 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Minecraft Advancement JSON",
+ "type": "object",
+ "properties": {
+ "display": {
+ "type": "object",
+ "properties": {
+ "icon": {
+ "type": "object",
+ "properties": {
+ "item": { "type": "string" },
+ "data": { "type": "integer", "minimum": 0, "maximum": 32767 }
+ },
+ "required": [ "item" ]
+ },
+ "title": { "$ref": "common.json#/textComponent" },
+ "frame": {
+ "anyOf": [
+ { "type": "string" },
+ { "enum": [ "task", "goal", "challenge" ], "default": "task" }
+ ]
+ },
+ "background": { "type": "string" },
+ "description": { "$ref": "common.json#/textComponent" },
+ "show_toast": { "type": "boolean" },
+ "announce_to_chat": { "type": "boolean" },
+ "hidden": { "type": "boolean" }
+ },
+ "required": [ "title", "description", "icon" ]
+ },
+ "parent": { "type": "string" },
+ "criteria": {
+ "type": "object",
+ "additionalProperties": { "$ref": "#/definitions/trigger" },
+ "minProperties": 1
+ },
+ "requirements": {
+ "type": "array",
+ "items": {
+ "type": "array",
+ "items": { "type": "string", "minLength": 1 }
+ }
+ },
+ "rewards": {
+ "type": "object",
+ "properties": {
+ "recipes": {
+ "type": "array",
+ "items": { "type": "string", "minLength": 1 }
+ },
+ "loot": {
+ "type": "array",
+ "items": { "type": "string", "minLength": 1 }
+ },
+ "experience": { "type": "integer" },
+ "function": { "type": "string" }
+ }
+ }
+ },
+ "require": [ "criteria" ],
+ "definitions": {
+ "trigger": {
+ "type": "object",
+ "properties": {
+ "trigger": {
+ "anyOf": [
+ { "type": "string" },
+ {
+ "type": "string",
+ "enum": [
+ "minecraft:bred_animals",
+ "minecraft:brewed_potion",
+ "minecraft:changed_dimension",
+ "minecraft:channeled_lightning",
+ "minecraft:construct_beacon",
+ "minecraft:consume_item",
+ "minecraft:cured_zombie_villager",
+ "minecraft:effects_changed",
+ "minecraft:enchanted_item",
+ "minecraft:enter_block",
+ "minecraft:entity_hurt_player",
+ "minecraft:entity_killed_player",
+ "minecraft:filled_bucket",
+ "minecraft:fishing_rod_hooked",
+ "minecraft:impossible",
+ "minecraft:inventory_changed",
+ "minecraft:item_durability_changed",
+ "minecraft:levitation",
+ "minecraft:location",
+ "minecraft:nether_travel",
+ "minecraft:nether_travel",
+ "minecraft:placed_block",
+ "minecraft:player_hurt_entity",
+ "minecraft:player_killed_entity",
+ "minecraft:recipe_unlocked",
+ "minecraft:slept_in_bed",
+ "minecraft:summoned_entity",
+ "minecraft:tame_animal",
+ "minecraft:tick",
+ "minecraft:used_ender_eye",
+ "minecraft:used_totem",
+ "minecraft:villager_trade"
+ ]
+ }
+ ]
+ }
+ },
+ "required": [ "trigger" ]
+ }
+ }
+}
\ No newline at end of file
From 7b3365ad5f1bc64c9903f1f001655eb5aeba8a5b Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Wed, 16 Feb 2022 18:13:19 +0100
Subject: [PATCH 04/17] Complete sounds.schema.json with attenuation_distance
and preload
---
src/main/resources/jsonSchemas/sounds.schema.json | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/main/resources/jsonSchemas/sounds.schema.json b/src/main/resources/jsonSchemas/sounds.schema.json
index 73101387f..7ccc721dc 100644
--- a/src/main/resources/jsonSchemas/sounds.schema.json
+++ b/src/main/resources/jsonSchemas/sounds.schema.json
@@ -35,6 +35,14 @@
"type": "boolean",
"default": false
},
+ "attenuation_distance": {
+ "type": "number",
+ "default": 16
+ },
+ "preload": {
+ "type": "boolean",
+ "default": false
+ },
"type": {
"enum": ["sound", "event"],
"default": "sound"
From e0182c09da9528d5124559a00bd4bc754f35bfb4 Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Wed, 16 Feb 2022 18:18:37 +0100
Subject: [PATCH 05/17] Add default value for replace
---
src/main/resources/jsonSchemas/sounds.schema.json | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/main/resources/jsonSchemas/sounds.schema.json b/src/main/resources/jsonSchemas/sounds.schema.json
index 7ccc721dc..ab66d9050 100644
--- a/src/main/resources/jsonSchemas/sounds.schema.json
+++ b/src/main/resources/jsonSchemas/sounds.schema.json
@@ -6,7 +6,10 @@
"type": "object",
"properties": {
"category": { "type": "string" },
- "replace": { "type": "boolean" },
+ "replace": {
+ "type": "boolean",
+ "default": false
+ },
"subtitle": { "type": "string" },
"sounds": {
"type": "array",
From 9968a2817732ab676037811d669e6fa102899554 Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Wed, 16 Feb 2022 18:26:39 +0100
Subject: [PATCH 06/17] Remake list of criteria
---
.../jsonSchemas/advancement.schema.json | 20 ++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/main/resources/jsonSchemas/advancement.schema.json b/src/main/resources/jsonSchemas/advancement.schema.json
index 55ce40e26..8e1d9acdd 100644
--- a/src/main/resources/jsonSchemas/advancement.schema.json
+++ b/src/main/resources/jsonSchemas/advancement.schema.json
@@ -69,6 +69,8 @@
{
"type": "string",
"enum": [
+ "minecraft:impossible",
+ "minecraft:bee_nest_destroyed",
"minecraft:bred_animals",
"minecraft:brewed_potion",
"minecraft:changed_dimension",
@@ -81,26 +83,38 @@
"minecraft:enter_block",
"minecraft:entity_hurt_player",
"minecraft:entity_killed_player",
+ "minecraft:fall_from_height",
"minecraft:filled_bucket",
"minecraft:fishing_rod_hooked",
- "minecraft:impossible",
+ "minecraft:hero_of_the_village",
"minecraft:inventory_changed",
"minecraft:item_durability_changed",
+ "minecraft:item_used_on_block",
+ "minecraft:killed_by_crossbow",
"minecraft:levitation",
+ "minecraft:lightning_strike",
"minecraft:location",
"minecraft:nether_travel",
- "minecraft:nether_travel",
"minecraft:placed_block",
+ "minecraft:player_generates_container_loot",
"minecraft:player_hurt_entity",
+ "minecraft:player_interacted_with_entity",
"minecraft:player_killed_entity",
"minecraft:recipe_unlocked",
+ "minecraft:shot_crossbow",
"minecraft:slept_in_bed",
+ "minecraft:slide_down_block",
+ "minecraft:started_riding",
"minecraft:summoned_entity",
"minecraft:tame_animal",
+ "minecraft:target_hit",
+ "minecraft:thrown_item_picked_up_by_entity",
"minecraft:tick",
"minecraft:used_ender_eye",
"minecraft:used_totem",
- "minecraft:villager_trade"
+ "minecraft:using_item",
+ "minecraft:villager_trade",
+ "minecraft:voluntary_exile"
]
}
]
From 10fb2f0bcac49a72c1344498bde0e2a85a27fc8b Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Wed, 16 Feb 2022 18:41:44 +0100
Subject: [PATCH 07/17] Fix compile errors
---
src/main/kotlin/json/SchemaProviders.kt | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/src/main/kotlin/json/SchemaProviders.kt b/src/main/kotlin/json/SchemaProviders.kt
index 54a298544..3699324d0 100644
--- a/src/main/kotlin/json/SchemaProviders.kt
+++ b/src/main/kotlin/json/SchemaProviders.kt
@@ -1,13 +1,3 @@
-/*
- * Minecraft Dev for IntelliJ
- *
- * https://minecraftdev.org
- *
- * Copyright (c) 2021 minecraft-dev
- *
- * MIT License
- */
-
package com.demonwav.mcdev.json
import com.demonwav.mcdev.util.mcDomain
@@ -32,7 +22,10 @@ class SchemaProviderFactory : JsonSchemaProviderFactory {
class SoundsSchemaProvider : JsonSchemaFileProvider {
companion object {
- val FILE = JsonSchemaProviderFactory.getResourceFile(SchemaProviderFactory::class.java, "/jsonSchemas/sounds.schema.json")
+ val FILE: VirtualFile = JsonSchemaProviderFactory.getResourceFile(
+ SchemaProviderFactory::class.java,
+ "/jsonSchemas/sounds.schema.json"
+ )
}
override fun getName() = "Minecraft Sounds JSON"
@@ -46,7 +39,10 @@ class SoundsSchemaProvider : JsonSchemaFileProvider {
class PathBasedSchemaProvider(name: String, schema: String, private val path: String) : JsonSchemaFileProvider {
private val _name = name
- private val file = JsonSchemaProviderFactory.getResourceFile(SchemaProviderFactory::class.java, "/jsonSchemas/$schema.schema.json")
+ private val file = JsonSchemaProviderFactory.getResourceFile(
+ SchemaProviderFactory::class.java,
+ "/jsonSchemas/$schema.schema.json"
+ )
override fun getName() = this._name
@@ -55,4 +51,4 @@ class PathBasedSchemaProvider(name: String, schema: String, private val path: St
override fun getSchemaType(): SchemaType = SchemaType.embeddedSchema
override fun getSchemaFile(): VirtualFile = file
-}
\ No newline at end of file
+}
From 25863c0fe58aef8051b70967e38a7147a1c547a5 Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Wed, 16 Feb 2022 18:50:26 +0100
Subject: [PATCH 08/17] Readd license header
---
src/main/kotlin/json/SchemaProviders.kt | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/main/kotlin/json/SchemaProviders.kt b/src/main/kotlin/json/SchemaProviders.kt
index 3699324d0..440ad5bca 100644
--- a/src/main/kotlin/json/SchemaProviders.kt
+++ b/src/main/kotlin/json/SchemaProviders.kt
@@ -1,3 +1,14 @@
+/*
+ * Minecraft Dev for IntelliJ
+ *
+ * https://minecraftdev.org
+ *
+ * Copyright (c) 2021 minecraft-dev
+ *
+ * MIT License
+ */
+
+
package com.demonwav.mcdev.json
import com.demonwav.mcdev.util.mcDomain
From 446d9649d95e8c77f6bb2574b1c784d5dd6cb937 Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Wed, 16 Feb 2022 19:05:45 +0100
Subject: [PATCH 09/17] Add tags schema
---
src/main/kotlin/json/SchemaProviders.kt | 2 +-
.../resources/jsonSchemas/tags.schema.json | 18 ++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
create mode 100644 src/main/resources/jsonSchemas/tags.schema.json
diff --git a/src/main/kotlin/json/SchemaProviders.kt b/src/main/kotlin/json/SchemaProviders.kt
index 440ad5bca..c55a6b09f 100644
--- a/src/main/kotlin/json/SchemaProviders.kt
+++ b/src/main/kotlin/json/SchemaProviders.kt
@@ -8,7 +8,6 @@
* MIT License
*/
-
package com.demonwav.mcdev.json
import com.demonwav.mcdev.util.mcDomain
@@ -27,6 +26,7 @@ class SchemaProviderFactory : JsonSchemaProviderFactory {
PathBasedSchemaProvider("Minecraft Item Model JSON", "model_item", "models/item/"),
PathBasedSchemaProvider("Minecraft Block Model JSON", "model_block", "models/block/"),
PathBasedSchemaProvider("Minecraft Loot Table JSON", "loot_table", "loot_tables/"),
+ PathBasedSchemaProvider("Minecraft Tag JSON", "tags", "tags/"),
PathBasedSchemaProvider("Minecraft Advancement JSON", "advancement", "advancements/")
)
}
diff --git a/src/main/resources/jsonSchemas/tags.schema.json b/src/main/resources/jsonSchemas/tags.schema.json
new file mode 100644
index 000000000..c59cf81f5
--- /dev/null
+++ b/src/main/resources/jsonSchemas/tags.schema.json
@@ -0,0 +1,18 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Minecraft Tag JSON",
+ "type": "object",
+ "properties": {
+ "replace": {
+ "type": "boolean",
+ "default": false
+ },
+ "values": {
+ "type": "array",
+ "values": {
+ "type": "array",
+ "items": { "type": "string", "minLength": 1 }
+ }
+ }
+ }
+}
\ No newline at end of file
From 1b7861b047e7642274fda59e07f7e79db5feba08 Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Wed, 16 Feb 2022 19:29:42 +0100
Subject: [PATCH 10/17] Complete Item Model schema
---
src/main/resources/jsonSchemas/model_item.schema.json | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/resources/jsonSchemas/model_item.schema.json b/src/main/resources/jsonSchemas/model_item.schema.json
index 1a7db14d3..078ae8a57 100644
--- a/src/main/resources/jsonSchemas/model_item.schema.json
+++ b/src/main/resources/jsonSchemas/model_item.schema.json
@@ -10,6 +10,10 @@
"type": "string"
}
},
+ "gui_light": {
+ "enum": ["front", "side"],
+ "default": "side"
+ },
"elements": { "$ref": "model_common.schema.json#/elements" },
"display": { "$ref": "model_common.schema.json#/transforms" },
"overrides": {
From 633fde6078d937935dab449f318c0dc036bd5bbb Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Wed, 16 Feb 2022 19:39:12 +0100
Subject: [PATCH 11/17] Add shade property in model_common.schema.json
---
src/main/resources/jsonSchemas/model_common.schema.json | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/main/resources/jsonSchemas/model_common.schema.json b/src/main/resources/jsonSchemas/model_common.schema.json
index 69e2d128f..932e9f51a 100644
--- a/src/main/resources/jsonSchemas/model_common.schema.json
+++ b/src/main/resources/jsonSchemas/model_common.schema.json
@@ -25,6 +25,10 @@
"additionalProperties": false,
"required": [ "axis" ]
},
+ "shade": {
+ "type": "boolean",
+ "default": true
+ },
"faces": {
"type": "object",
"patternProperties": {
From fa90956c15c490d08b17ddd6f5a0edc59bda926e Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Thu, 17 Feb 2022 15:38:08 +0100
Subject: [PATCH 12/17] Update advancement.schema.json for new versions
---
src/main/resources/jsonSchemas/advancement.schema.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/main/resources/jsonSchemas/advancement.schema.json b/src/main/resources/jsonSchemas/advancement.schema.json
index 8e1d9acdd..bded6fea5 100644
--- a/src/main/resources/jsonSchemas/advancement.schema.json
+++ b/src/main/resources/jsonSchemas/advancement.schema.json
@@ -10,7 +10,7 @@
"type": "object",
"properties": {
"item": { "type": "string" },
- "data": { "type": "integer", "minimum": 0, "maximum": 32767 }
+ "nbt": { "type": "string" }
},
"required": [ "item" ]
},
From ff8a861bf8249a7d073fa50eb9ac3eda54b5515a Mon Sep 17 00:00:00 2001
From: Mysterious_Dev
Date: Sun, 20 Feb 2022 18:33:42 +0100
Subject: [PATCH 13/17] Particle Schema
---
src/main/kotlin/json/SchemaProviders.kt | 1 +
.../resources/jsonSchemas/particles.schema.json | 14 ++++++++++++++
2 files changed, 15 insertions(+)
create mode 100644 src/main/resources/jsonSchemas/particles.schema.json
diff --git a/src/main/kotlin/json/SchemaProviders.kt b/src/main/kotlin/json/SchemaProviders.kt
index c55a6b09f..60e78fcb6 100644
--- a/src/main/kotlin/json/SchemaProviders.kt
+++ b/src/main/kotlin/json/SchemaProviders.kt
@@ -27,6 +27,7 @@ class SchemaProviderFactory : JsonSchemaProviderFactory {
PathBasedSchemaProvider("Minecraft Block Model JSON", "model_block", "models/block/"),
PathBasedSchemaProvider("Minecraft Loot Table JSON", "loot_table", "loot_tables/"),
PathBasedSchemaProvider("Minecraft Tag JSON", "tags", "tags/"),
+ PathBasedSchemaProvider("Minecraft Particle JSON", "particles", "particles/"),
PathBasedSchemaProvider("Minecraft Advancement JSON", "advancement", "advancements/")
)
}
diff --git a/src/main/resources/jsonSchemas/particles.schema.json b/src/main/resources/jsonSchemas/particles.schema.json
new file mode 100644
index 000000000..34a7f2ca9
--- /dev/null
+++ b/src/main/resources/jsonSchemas/particles.schema.json
@@ -0,0 +1,14 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "Minecraft Particle JSON",
+ "type": "object",
+ "properties": {
+ "textures": {
+ "type": "array",
+ "values": {
+ "type": "array",
+ "items": { "type": "string", "minLength": 1 }
+ }
+ }
+ }
+}
\ No newline at end of file
From 61fdb5ee773f33006aaadce8144315f121e32fcb Mon Sep 17 00:00:00 2001
From: Mysterious_Dev
Date: Sun, 20 Feb 2022 18:42:42 +0100
Subject: [PATCH 14/17] Make value property required
---
src/main/resources/jsonSchemas/tags.schema.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/resources/jsonSchemas/tags.schema.json b/src/main/resources/jsonSchemas/tags.schema.json
index c59cf81f5..2e0a26c39 100644
--- a/src/main/resources/jsonSchemas/tags.schema.json
+++ b/src/main/resources/jsonSchemas/tags.schema.json
@@ -14,5 +14,6 @@
"items": { "type": "string", "minLength": 1 }
}
}
- }
+ },
+ "required": ["values"]
}
\ No newline at end of file
From 48865f862b7d8de4552369c9d24ebc67a690fafd Mon Sep 17 00:00:00 2001
From: Mysterious_Dev
Date: Mon, 21 Feb 2022 22:07:53 +0100
Subject: [PATCH 15/17] Begin rework loot table
---
.../jsonSchemas/loot_table.schema.json | 11 ++++-
.../loot_table_conditions.schema.json | 46 +++++++++++++++++--
2 files changed, 50 insertions(+), 7 deletions(-)
diff --git a/src/main/resources/jsonSchemas/loot_table.schema.json b/src/main/resources/jsonSchemas/loot_table.schema.json
index df5fa5536..aac31ec32 100644
--- a/src/main/resources/jsonSchemas/loot_table.schema.json
+++ b/src/main/resources/jsonSchemas/loot_table.schema.json
@@ -3,21 +3,28 @@
"title": "Minecraft Loot Table JSON",
"type": "object",
"properties": {
+ "type": { "type": "string" },
"pools": {
"type": "array",
"items": {
"type": "object",
"properties": {
"conditions": { "$ref": "#/definitions/conditions" },
+ "functions": { "$ref": "#/definitions/functions" },
"rolls": { "$ref": "common.schema.json#/integerRange" },
- "bonusRolls": { "$ref": "common.schema.json#/integerRange" },
+ "bonus_rolls": { "$ref": "common.schema.json#/integerRange" },
"entries": {
"type": "array",
"items": {
"type": "object",
"properties": {
"conditions": { "$ref": "#/definitions/conditions" },
- "type": { "type": "string" },
+ "functions": { "$ref": "#/definitions/functions" },
+ "type": {
+ "type": "string",
+ "enum": [ "item", "tag", "loot_table", "group", "alternatives", "sequence", "dynamic", "empty" ]
+ },
+ "expand": { "type": "boolean" },
"weight": { "type": "number" },
"quality": { "type": "number" }
},
diff --git a/src/main/resources/jsonSchemas/loot_table_conditions.schema.json b/src/main/resources/jsonSchemas/loot_table_conditions.schema.json
index 090d6c146..9812cb3e7 100644
--- a/src/main/resources/jsonSchemas/loot_table_conditions.schema.json
+++ b/src/main/resources/jsonSchemas/loot_table_conditions.schema.json
@@ -1,6 +1,13 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
- "entityProperties": {
+ "block_state_property": {
+ "properties": {
+ "block": {
+ "type": "string"
+ }
+ }
+ },
+ "entity_properties": {
"properties": {
"entity": {
"type": "string",
@@ -14,7 +21,7 @@
}
}
},
- "entityScores": {
+ "entity_scores": {
"properties": {
"entity": {
"type": "string",
@@ -26,20 +33,49 @@
}
}
},
- "killedByPlayer": {
+ "killed_by_player": {
"properties": {
"on_fire": { "type": "inverse" }
}
},
- "randomChance": {
+ "random_chance": {
"properties": {
"chance": { "type": "number", "minimum": 0, "maximum": 1 }
}
},
- "randomChanceWithLooting": {
+ "random_chance_with_looting": {
"properties": {
"chance": { "type": "number", "minimum": 0, "maximum": 1 },
"looting_multiplier": { "type": "number" }
}
+ },
+ "survives_explosion": {},
+ "value_check": {
+ "properties": {
+ "value": {
+ "type": "integer"
+ },
+ "range": {
+ "type": "object",
+ "properties": {
+ "min": {
+ "type": "integer"
+ },
+ "max": {
+ "type": "integer"
+ }
+ }
+ }
+ }
+ },
+ "weather_check": {
+ "properties": {
+ "raining": {
+ "type": "boolean"
+ },
+ "thundering": {
+ "type": "boolean"
+ }
+ }
}
}
\ No newline at end of file
From a10a75ab3361cd66dcac43bd6aea4f557634c4b0 Mon Sep 17 00:00:00 2001
From: Mysterious_Dev
Date: Mon, 21 Feb 2022 22:19:04 +0100
Subject: [PATCH 16/17] Rewriting loot table 1/?
---
.../loot_table_conditions.schema.json | 36 +++++++++++++++----
1 file changed, 30 insertions(+), 6 deletions(-)
diff --git a/src/main/resources/jsonSchemas/loot_table_conditions.schema.json b/src/main/resources/jsonSchemas/loot_table_conditions.schema.json
index 9812cb3e7..506431f86 100644
--- a/src/main/resources/jsonSchemas/loot_table_conditions.schema.json
+++ b/src/main/resources/jsonSchemas/loot_table_conditions.schema.json
@@ -7,7 +7,7 @@
}
}
},
- "entity_properties": {
+ "entityProperties": {
"properties": {
"entity": {
"type": "string",
@@ -21,7 +21,7 @@
}
}
},
- "entity_scores": {
+ "entityScores": {
"properties": {
"entity": {
"type": "string",
@@ -33,23 +33,44 @@
}
}
},
- "killed_by_player": {
+ "locationCheck": {
+ "properties": {
+ "offsetX": { "type": "number" },
+ "offsetY": { "type": "number" },
+ "offsetZ": { "type": "number" }
+ }
+ },
+ "inverted": {
+ "properties": {
+ "term": {
+ "type": "object"
+ }
+ }
+ },
+ "killedByPlayer": {
"properties": {
"on_fire": { "type": "inverse" }
}
},
- "random_chance": {
+ "randomChance": {
"properties": {
"chance": { "type": "number", "minimum": 0, "maximum": 1 }
}
},
- "random_chance_with_looting": {
+ "randomChanceWithLooting": {
"properties": {
"chance": { "type": "number", "minimum": 0, "maximum": 1 },
"looting_multiplier": { "type": "number" }
}
},
- "survives_explosion": {},
+ "reference": {
+ "properties": {
+ "name": {
+ "type": "string"
+ }
+ }
+ },
+ "survivesExplosion": {},
"value_check": {
"properties": {
"value": {
@@ -65,6 +86,9 @@
"type": "integer"
}
}
+ },
+ "range": {
+ "type": "integer"
}
}
},
From de38383d33bae6988e261b9d34380384ff101fbd Mon Sep 17 00:00:00 2001
From: Mysterious_Dev <40738104+Mysterious-Dev@users.noreply.github.com>
Date: Thu, 3 Mar 2022 18:05:18 +0100
Subject: [PATCH 17/17] Begin rewrite of blockstates schema
---
.../blockstates_common.schema.json | 40 +++++++++++--------
1 file changed, 24 insertions(+), 16 deletions(-)
diff --git a/src/main/resources/jsonSchemas/blockstates_common.schema.json b/src/main/resources/jsonSchemas/blockstates_common.schema.json
index 93b56fd84..dd01fdee8 100644
--- a/src/main/resources/jsonSchemas/blockstates_common.schema.json
+++ b/src/main/resources/jsonSchemas/blockstates_common.schema.json
@@ -1,23 +1,31 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Minecraft Blockstates JSON",
- "baseVariant": {
- "type": "object",
- "properties": {
- "model": { "type": "string" },
- "textures": {
- "type": "object",
- "additionalProperties": { "type": "string" }
+ "type": "object",
+ "properties": {
+ "variants": {
+ "type": "array",
+ "items": {
+ "oneOf": [
+ { "type": "string" },
+ {
+ "type": "object",
+ "properties": {
+ "x": {
+ "type": "number"
+ },
+ "y": {
+ "type": "number"
+ },
+ "uvlock": {
+ "type": "boolean",
+ "default": false
+ }
+ }
+ }
+ ]
},
- "x": {
- "type": "number",
- "multipleOf": 22.5
- },
- "y": {
- "type": "number",
- "multipleOf": 22.5
- },
- "uvlock": { "type": "boolean" }
+ "uniqueItems": true
}
}
}
\ No newline at end of file