Improve texture set schema (#339)

* Added `metalness_emissive_roughness_subsurface` parameter

* Prevent incompatible parameters from being specified at the same time

* Corrected color array schema

* Improved color schemas

* Require `format_version` to be a supported value

* Require `format_version` and `minecraft:texture_set` to be included

* Sorted parameter definitions

* Prevent UI texture definition schema from being applied to texture sets

* Corrected `format_version` schema
This commit is contained in:
QuazChick
2025-03-23 16:39:12 +00:00
committed by GitHub
parent c35566e0f4
commit 30a9de7a9b
2 changed files with 108 additions and 72 deletions

View File

@@ -3,72 +3,110 @@
"$id": "blockception.minecraft.resource.texture.texture_set", "$id": "blockception.minecraft.resource.texture.texture_set",
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"required": ["format_version", "minecraft:texture_set"],
"properties": { "properties": {
"format_version": { "$ref": "../../general/format_version.json" }, "format_version": {
"title": "Format Version",
"description": "A version that tells minecraft what type of data format can be expected when reading this file.",
"enum": ["1.16.100", "1.21.30"]
},
"minecraft:texture_set": { "minecraft:texture_set": {
"title": "Texture Set", "title": "Texture Set",
"description": "Texture Sets are used to define multiple PBR layers for a texture resource.", "description": "Texture Sets are used to define multiple PBR layers for a texture resource.",
"type": "object", "type": "object",
"additionalProperties": false, "additionalProperties": false,
"required": ["color"], "required": ["color"],
"not": {
"anyOf": [
{
"required": ["heightmap", "normal"]
},
{
"required": ["metalness_emissive_roughness", "metalness_emissive_roughness_subsurface"]
}
]
},
"properties": { "properties": {
"color": { "$ref": "#/definitions/color" }, "color": { "$ref": "#/definitions/color" },
"heightmap": { "$ref": "#/definitions/heightmap" }, "heightmap": { "$ref": "#/definitions/heightmap" },
"metalness_emissive_roughness": { "$ref": "#/definitions/mer" }, "metalness_emissive_roughness": { "$ref": "#/definitions/mer" },
"metalness_emissive_roughness_subsurface": { "$ref": "#/definitions/mers" },
"normal": { "$ref": "#/definitions/normal" } "normal": { "$ref": "#/definitions/normal" }
} }
} }
}, },
"definitions": { "definitions": {
"color": { "file_name": {
"title": "Color", "type": "string",
"description": "This is an RGB 3-channel image (defaults to uniform alpha of 1.0), or an RGBA 4-channel image, or a 4 value array for a uniform color with alpha.", "defaultSnippets": [
"examples": [[255, 255, 255, 255]], {
"label": "File Name",
"body": "${1:${TM_FILENAME_BASE}}"
}
]
},
"rgb": {
"defaultSnippets": [
{
"label": "RGB Color",
"body": "#${1:RR}${2:GG}${3:BB}"
}
],
"oneOf": [ "oneOf": [
{ "type": "string" }, { "type": "string" },
{ {
"type": "array", "type": "array",
"items": [ "minItems": 3,
{ "maxItems": 3,
"title": "Red", "items": {
"type": "integer", "type": "integer",
"minimum": 0, "minimum": 0,
"maximum": 255 "maximum": 255
}, }
{
"title": "Green",
"type": "integer",
"minimum": 0,
"maximum": 255
},
{
"title": "Blue",
"type": "integer",
"minimum": 0,
"maximum": 255
},
{
"title": "Alpha",
"type": "integer",
"default": 255,
"minimum": 0,
"maximum": 255
}
]
} }
] ]
}, },
"normal": { "rgba": {
"title": "Normal Map", "defaultSnippets": [
"description": "This is a 3-channel normal map image (or 4-channel where the 4th channel is ignored). This layer and the \"heightmap\" layer should not both be defined at the same time.", {
"type": "string" "label": "ARGB Color",
"body": "#${1:AA}${2:RR}${3:GG}${4:BB}"
}
],
"oneOf": [
{ "type": "string" },
{
"type": "array",
"minItems": 4,
"maxItems": 4,
"items": {
"type": "integer",
"minimum": 0,
"maximum": 255
}
}
]
},
"color": {
"title": "Color",
"description": "This is an RGB 3-channel image (defaults to uniform alpha of 1.0), or an RGBA 4-channel image, or a 4 value array for a uniform color with alpha.",
"anyOf": [
{
"$ref": "#/definitions/file_name"
},
{
"$ref": "#/definitions/rgba"
}
]
}, },
"heightmap": { "heightmap": {
"title": "Heightmap", "title": "Heightmap",
"description": "1-channel layer image or a single value in this JSON file for a uniform heightmap. This layer and the \"normal\" layer should not both be defined at the same time.", "description": "1-channel layer image or a single value in this JSON file for a uniform heightmap. This layer and the \"normal\" layer should not both be defined at the same time.",
"examples": [255], "examples": [255],
"oneOf": [ "anyOf": [
{ "type": "string" }, {
"$ref": "#/definitions/file_name"
},
{ {
"type": "integer", "type": "integer",
"minimum": 0, "minimum": 0,
@@ -79,33 +117,31 @@
"mer": { "mer": {
"title": "Metalness Emissive Roughness", "title": "Metalness Emissive Roughness",
"description": "This is a 3-channel image (or 4-channel where the 4th channel is ignored) or a 3-value array for a uniform MER. RGB images map Red to Metalness, Green to Emissive, and Blue to Roughness.", "description": "This is a 3-channel image (or 4-channel where the 4th channel is ignored) or a 3-value array for a uniform MER. RGB images map Red to Metalness, Green to Emissive, and Blue to Roughness.",
"examples": [[255, 255, 255]], "anyOf": [
"oneOf": [
{ "type": "string" },
{ {
"type": "array", "$ref": "#/definitions/file_name"
"items": [ },
{ {
"title": "Red", "$ref": "#/definitions/rgb"
"type": "integer",
"minimum": 0,
"maximum": 255
},
{
"title": "Green",
"type": "integer",
"minimum": 0,
"maximum": 255
},
{
"title": "Blue",
"type": "integer",
"minimum": 0,
"maximum": 255
}
]
} }
] ]
},
"mers": {
"title": "Metalness Emissive Roughness Subsurface",
"description": "This is a 4-channel image or a 4-value array for a uniform MERS. RGBA images map Red to Metalness, Green to Emissive, Blue to Roughness and Alpha to Subsurface.",
"anyOf": [
{
"$ref": "#/definitions/file_name"
},
{
"$ref": "#/definitions/rgba"
}
]
},
"normal": {
"title": "Normal Map",
"description": "This is a 3-channel normal map image (or 4-channel where the 4th channel is ignored). This layer and the \"heightmap\" layer should not both be defined at the same time.",
"$ref": "#/definitions/file_name"
} }
} }
} }

View File

@@ -560,16 +560,16 @@
}, },
{ {
"fileMatch": [ "fileMatch": [
"resource_packs/*/textures/*/*.{json,jsonc,json5}", "resource_packs/*/textures/*/!(*.texture_set).{json,jsonc,json5}",
"*resource*pack*/textures/*/*.{json,jsonc,json5}", "*resource*pack*/textures/*/!(*.texture_set).{json,jsonc,json5}",
"*Resource*Pack*/textures/*/*.{json,jsonc,json5}", "*Resource*Pack*/textures/*/!(*.texture_set).{json,jsonc,json5}",
"*RP*/textures/*/*.{json,jsonc,json5}", "*RP*/textures/*/!(*.texture_set).{json,jsonc,json5}",
"*rp*/textures/*/*.{json,jsonc,json5}", "*rp*/textures/*/!(*.texture_set).{json,jsonc,json5}",
"resource_packs/*/textures/*/**/*.{json,jsonc,json5}", "resource_packs/*/textures/*/**/!(*.texture_set).{json,jsonc,json5}",
"*resource*pack*/textures/*/**/*.{json,jsonc,json5}", "*resource*pack*/textures/*/**/!(*.texture_set).{json,jsonc,json5}",
"*Resource*Pack*/textures/*/**/*.{json,jsonc,json5}", "*Resource*Pack*/textures/*/**/!(*.texture_set).{json,jsonc,json5}",
"*RP*/textures/*/**/*.{json,jsonc,json5}", "*RP*/textures/*/**/!(*.texture_set).{json,jsonc,json5}",
"*rp*/textures/*/**/*.{json,jsonc,json5}" "*rp*/textures/*/**/!(*.texture_set).{json,jsonc,json5}"
], ],
"url": "https://raw.githubusercontent.com/Blockception/Minecraft-bedrock-json-schemas/main/resource/textures/ui_texture_definition.json" "url": "https://raw.githubusercontent.com/Blockception/Minecraft-bedrock-json-schemas/main/resource/textures/ui_texture_definition.json"
}, },