{
  "type": "object",
  "title": "Scatter Feature",
  "description": "`minecraft:scatter_feature` scatters a feature throughout a chunk. The `x`, `y`, and `z` fields are per-coordinate parameters.\nNote that coordinates represent an offset from the input position, not an absolute position. Coordinates may be a single value, a random distribution, or molang expression that resolves to a numeric value. The `coordinate_eval_order` field is provided for finer control of coordinate resolution (particularly when using the `grid` distribution). `iterations` controls how many individual placements should occur if the `scatter_chance` check succeeds. The `scatter_chance` check happens once, so either all placements will run or none will.\nSucceeds if: At least one feature placement succeeds.\nFails if: All feature placements fail.",
  "additionalProperties": false,
  "required": ["description", "places_feature", "iterations"],
  "definitions": {
    "coordinate": {
      "title": "Coordinate",
      "oneOf": [
        {
          "$ref": "../../../molang/number.json",
          "description": "Expression for the coordinate (evaluated each iteration). Mutually exclusive with random distribution object below."
        },
        {
          "type": "object",
          "description": "Distribution for the coordinate (evaluated each iteration). Mutually exclusive with Molang expression above.",
          "additionalProperties": false,
          "required": ["extent", "distribution"],
          "properties": {
            "distribution": {
              "title": "Distribution",
              "description": "Type of distribution - uniform random, gaussian (centered in the range),  triangle (centered in the range), or grid (either fixed-step or jittered).",
              "type": "string",
              "enum": ["uniform", "gaussian", "inverse_gaussian", "triangle", "fixed_grid", "jittered_grid"]
            },
            "step_size": {
              "title": "Step Size",
              "description": "When the distribution type is grid, defines the distance between steps along this axis.",
              "type": "integer",
              "minimum": 1
            },
            "grid_offset": {
              "title": "Step Size",
              "description": "When the distribution type is grid, defines the offset along this axis.",
              "type": "integer",
              "minimum": 0
            },
            "extent": {
              "title": "Extent",
              "description": "The lower and upper bound as an offset from the input position",
              "type": "array",
              "items": [
                {
                  "title": "Lower Bound",
                  "$ref": "../../../molang/number.json",
                  "description": "Lower bound (inclusive) of the scatter range, as an offset from the input point to scatter around."
                },
                {
                  "title": "Upper Bound",
                  "$ref": "../../../molang/number.json",
                  "description": "Upper bound (inclusive) of the scatter range, as an offset from the input point to scatter around."
                }
              ]
            }
          }
        }
      ]
    }
  },
  "properties": {
    "description": {
      "$ref": "../types/description.json"
    },
    "places_feature": {
      "title": "Places Feature",
      "description": "Named reference of feature to be placed.",
      "type": "string",
      "$ref": "../../../general/feature/identifier.json"
    },
    "project_input_to_floor": {
      "title": "Project Input To Floor",
      "description": "If true, snaps the y-value of the scattered position to the terrain heightmap. If false or unset, y-value is unmodified.",
      "type": "boolean"
    },
    "iterations": {
      "title": "Iterations",
      "description": "Number of scattered positions to generate.",
      "$ref": "../../../molang/number.json"
    },
    "scatter_chance": {
      "title": "Scatter Chance",
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "description": "Probability numerator / denominator that this scatter will occur.  Not evaluated each iteration; either no iterations will run, or all will.",
          "properties": {
            "numerator": {
              "title": "Numerator",
              "description": "UNDOCUMENTED.",
              "type": "integer",
              "minimum": 1
            },
            "denominator": {
              "title": "Denominator",
              "description": "UNDOCUMENTED.",
              "type": "integer",
              "minimum": 1
            }
          }
        },
        {
          "$ref": "../../../molang/number.json",
          "description": "Probability (0-100] that this scatter will occur. Not evaluated each iteration; either no iterations will run, or all will."
        }
      ]
    },
    "coordinate_eval_order": {
      "title": "Coordinate Eval Order",
      "description": "The order in which coordinates will be evaluated. Should be used when a coordinate depends on another. If omitted, defaults to `xzy`.",
      "type": "string",
      "enum": ["xyz", "xzy", "yxz", "yzx", "zxy", "zyx"]
    },
    "x": {
      "title": "X",
      "$ref": "#/definitions/coordinate"
    },
    "y": {
      "title": "X",
      "$ref": "#/definitions/coordinate"
    },
    "z": {
      "title": "X",
      "$ref": "#/definitions/coordinate"
    }
  }
}
