{
  "$schema": "http://json-schema.org/draft-07/schema",
  "$id": "blockception.minecraft.render_controllers",
  "defaultSnippets": [
    {
      "label": "New render controller",
      "body": {
        "format_version": "${1:1.10.0}",
        "render_controllers": {
          "controller.render.${2:${TM_FILENAME/[\\.].*//}}": {
            "geometry": "Geometry.${3:default}",
            "materials": [{ "*": "Material.${4:default}" }],
            "textures": ["Texture.${5:default}"]
          }
        }
      }
    }
  ],
  "examples": [
    {
      "format_version": "1.10.0",
      "render_controllers": {
        "controller.render.example": { "geometry": "Geometry.default", "materials": [{ "*": "Material.default" }], "textures": ["Texture.default"] }
      }
    }
  ],
  "additionalProperties": false,
  "type": "object",
  "title": "Render Controllers",
  "description": "A collection of render controllers to apply.",
  "definitions": {
    "color": {
      "anyOf": [
        { "type": "number", "description": "A color definition as number, between 0 and 1.", "minimum": 0, "maximum": 1, "title": "Color Number" },
        { "type": "string", "description": "A color definition in molang, between 0 and 1.", "title": "Molang Color" }
      ]
    }
  },
  "properties": {
    "format_version": { "type": "string", "enum": ["1.8.0", "1.10.0"] },
    "render_controllers": {
      "title": "Render Controllers",
      "description": "The collection of render controllers, each property is the identifier of a render controller.",
      "type": "object",
      "propertyNames": { "pattern": "^controller\\.render\\.[a-z\\.]+" },
      "additionalProperties": {
        "title": "Render Controller",
        "additionalProperties": false,
        "type": "object",
        "description": "A single render_controller.",
        "required": ["geometry", "materials"],
        "properties": {
          "arrays": {
            "type": "object",
            "title": "Arrays",
            "additionalProperties": false,
            "description": "A collection of definition of arrays.",
            "properties": {
              "geometries": {
                "type": "object",
                "minProperties": 1,
                "description": "A collection of Geometry array.",
                "title": "Geometries",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[Gg]eometry\\..+",
                    "description": "A geometry item, must be defined in the entity.",
                    "title": "Geometry Reference"
                  },
                  "description": "A geometry array definition.",
                  "title": "Geometries"
                }
              },
              "materials": {
                "type": "object",
                "minProperties": 1,
                "description": "A collection of materials array.",
                "title": "Materials",
                "additionalProperties": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "pattern": "^[Mm]aterial\\..+",
                    "description": "A material item, must be defined in the entity.",
                    "title": "Material"
                  },
                  "description": "A material array definition.",
                  "title": "Materials"
                }
              },
              "textures": {
                "type": "object",
                "minProperties": 1,
                "description": "A collection of texture array.",
                "title": "Textures",
                "additionalProperties": {
                  "type": "array",
                  "description": "Textures.",
                  "title": "Texture",
                  "items": {
                    "type": "string",
                    "pattern": "^[Tt]exture\\..+",
                    "default": "texture.",
                    "description": "An texture item.",
                    "title": "Texture"
                  }
                }
              }
            }
          },
          "color": {
            "additionalProperties": false,
            "type": "object",
            "properties": {
              "r": { "$ref": "#/definitions/color", "description": "The value of red, between 0 and 1.", "title": "R" },
              "g": { "$ref": "#/definitions/color", "description": "The value of green, between 0 and 1.", "title": "G" },
              "b": { "$ref": "#/definitions/color", "description": "The value of blue, between 0 and 1.", "title": "B" },
              "a": { "$ref": "#/definitions/color", "description": "The value of alpha, between 0 and 1.", "title": "A" }
            },
            "description": "The color to apply.",
            "title": "Color"
          },
          "filter_lighting": {
            "type": "boolean",
            "description": "Whenever or not to apply enviroment lighting to this object.",
            "title": "Filter Lighting"
          },
          "geometry": {
            "$ref": "../../molang/string.json",
            "description": "The model data to use.",
            "title": "Geometry",
            "examples": ["geometry.default"]
          },
          "ignore_lighting": { "type": "boolean", "description": "Whenever or not to apply enviroment lighting to this object.", "title": "Ignore Lighting" },
          "is_hurt_color": {
            "additionalProperties": false,
            "type": "object",
            "description": "The color to overlay on the entity when hurt.",
            "title": "Is Hurt Color",
            "properties": {
              "r": { "$ref": "#/definitions/color", "description": "The value of red, between 0 and 1.", "title": "R" },
              "g": { "$ref": "#/definitions/color", "description": "The value of green, between 0 and 1.", "title": "G" },
              "b": { "$ref": "#/definitions/color", "description": "The value of blue, between 0 and 1.", "title": "B" },
              "a": { "$ref": "#/definitions/color", "description": "The value of alpha, between 0 and 1.", "title": "A" }
            }
          },
          "light_color_multiplier": {
            "$ref": "../../molang/number.json",
            "description": "The amount of light that blends into what is being rendered, lower values gives darker rendering, (1 = 100%).",
            "title": "Light Color Multiplier"
          },
          "materials": {
            "title": "Materials",
            "description": "The specification where to apply materials to.",
            "type": "array",
            "minItems": 1,
            "examples": [[{ "*": "material.default" }], [{ "Alpha_*": "material.alpha" }]],
            "items": {
              "type": "object",
              "description": "The definitions of what material to apply to what set of bones, can be done through specific names, or patterns using * as a wildcard.",
              "title": "Materials",
              "additionalProperties": {
                "type": "string",
                "description": "The material to apply, or patterns using * as a wildcard.",
                "$comment": "UNDOCUMENTED",
                "title": "Material"
              }
            }
          },
          "on_fire_color": {
            "title": "On Fire Color",
            "description": "The color that will be overlayed when the object is on fire.",
            "additionalProperties": false,
            "type": "object",
            "properties": {
              "r": { "$ref": "#/definitions/color", "description": "The value of red, must result in a float between 0 and 1.", "title": "R" },
              "g": { "$ref": "#/definitions/color", "description": "The value of green, must result in a float between 0 and 1.", "title": "G" },
              "b": { "$ref": "#/definitions/color", "description": "The value of blue, must result in a float between 0 and 1.", "title": "B" },
              "a": { "$ref": "#/definitions/color", "description": "The value of alpha, must result in a float between 0 and 1.", "title": "A" }
            }
          },
          "overlay_color": {
            "additionalProperties": false,
            "type": "object",
            "description": "The color to put over the object.",
            "title": "Overlay Color",
            "properties": {
              "r": { "$ref": "#/definitions/color", "description": "The value of red, between 0 and 1.", "title": "R" },
              "g": { "$ref": "#/definitions/color", "description": "The value of green, between 0 and 1.", "title": "G" },
              "b": { "$ref": "#/definitions/color", "description": "The value of blue, between 0 and 1.", "title": "B" },
              "a": { "$ref": "#/definitions/color", "description": "The value of alpha, between 0 and 1.", "title": "A" }
            }
          },
          "part_visibility": {
            "title": "Part Visibility",
            "description": "Determines what part of the object to show or hide.",
            "type": "array",
            "minItems": 1,
            "items": {
              "description": "The object that describe different bone visibility.",
              "title": "Part Visibility",
              "type": "object",
              "additionalProperties": { "oneOf": [{ "type": "string" }, { "type": "boolean" }, { "type": "number" }] }
            }
          },
          "rebuild_animation_matrices": {
            "type": "boolean",
            "description": "Whenever or not to rebuild the animation matrices.",
            "title": "Rebuild Animation Matrices"
          },
          "textures": {
            "title": "Textures",
            "description": "The texture to apply, multiple texture can be used as to create an overlay effect, a specific material is required though.",
            "type": "array",
            "minItems": 1,
            "items": {
              "description": "The texture definition to apply.",
              "title": "Textures",
              "$ref": "../../molang/string.json",
              "examples": ["texture.default", "Array.skins[query.variant]"]
            }
          },
          "uv_anim": {
            "title": "Uv Anim",
            "description": "The UV animation to apply to the render texture.",
            "additionalProperties": false,
            "type": "object",
            "required": ["offset", "scale"],
            "properties": {
              "offset": {
                "title": "Offset",
                "description": "The offset to apply the UV, this will cause the texture on the object to shift by said amount, can be molang. The value for how much to offset is usually specified between 0 and 1",
                "type": "array",
                "minItems": 2,
                "maxItems": 2,
                "items": { "$ref": "../../molang/number.json", "description": "The offset to apply on the texture, can be molang.", "title": "Offset" }
              },
              "scale": {
                "type": "array",
                "description": "The scale to apply to the texture, this will cause texture to seem to grow and shrink if done per frame.",
                "title": "Scale",
                "minItems": 2,
                "maxItems": 2,
                "items": { "$ref": "../../molang/number.json", "description": "The scale to apply on the texture, can be molang.", "title": "Scale" }
              }
            }
          }
        }
      }
    }
  }
}
