Skip to content

Density‐Based Structures

Rebby edited this page Oct 29, 2026 · 1 revision

Density Based Structures require their own page regarding how complex they are. They utilize a single density function to generate their pieces.

Structure Definition

{
  // ID for Density Based Structures
  "type": "largestructlib:density_based",
  // Default structure format
  "biomes": "#minecraft:is_overworld",
  "step": "raw_generation",
  "spawn_overrides": {},
  // Cubic size of a grid voxel in factors of 2.
  // A factor of 2 results in a size of 4,
  // a factor of 3 results in a size of 8,
  // etc.
  //
  // Ranges from 2-4.
  "factor": 3,
  // Y space where pieces may generate. Must
  // not be outside world bounds.
  "min_y": 0,
  "max_y": 256,
  // Density function that the values track.
  // Can be an existing density function or
  // a custom one you've created.
  "density_function": "testing:depth",
  "values": See in Values...
  "structures": See in Structures...
}

Values

Values are the values detected from the density function. Represented by a key and value, they are utilized by the structures to detect if they generate or not. There are currently 3 types of values to detect for

Default

Returns true if the density function at said location is within bounds.

"0": {
  "type": "largestructlib:default",
  "minimum": -10.0,
  "maximum": -0.2
},

Axis for Value

Returns true if any value detected by the density function along an axis is within bounds

"1": {
  "type": "largestructlib:axis_for_value",
  "minimum": 0.0,
  "maximum": 0.4,
  // Axis to check values. Either x, y, or z.
  "axis": "y"
}

Plane for Value

Same as axis but detects an entire plane.

"2": {
  "type": "largestructlib:plane_for_value",
  "minimum": 0.0,
  "maximum": 0.4,
  // Plane to check values. Either x, y, or z,
  // with x checking yz plane, y checking xz plane,
  // etc.
  "axis": "y"
}

Multi-Noise

Allows sampling of other density functions! This vastly expands your options for structures! All frequencies detected must be true in order for it to work.

"h": {
      "type": "largestructlib:multi_noise",
      "minimum": 0.0,
      "maximum": 1.0,
      // List of frequencies to detect
      "frequencies": [
        {
          // Density function to sample from
          "density_function": "testing:depth",
          "minimum": -10.0,
          "maximum": -0.2
        }
      ]
    },

Also supports sampling along an axis or plane with "largestructlib:multi_noise_axis" & "largestructlib:multi_noise_plane" respectively.

Example:

{
  "type": "largestructlib:density_based",
  "biomes": "#minecraft:is_overworld",
  "step": "raw_generation",
  "spawn_overrides": {},
  "factor": 3,
  "min_y": 0,
  "max_y": 256,
  "density_function": "testing:depth",
  "values": {
    "0": {
      "type": "largestructlib:default",
      "minimum": -10.0,
      "maximum": -0.2
    }
  },
  "structures": See in Structures...
}

Structures

These are the structures pieces generated by the density-based structure. They try to generate in order and once a piece generates, no other pieces may generate over the size it encompasses.

Types

Currently there are four types of structure pieces, including:

Default

{
  // Generates a simple structure.
  // The structure generates along a grid
  // repeating based upon the size.
  "type": "largestructlib:default",
  // Optional name of the structure 
  // (defaults to unnamed)
  "name": "L",
  // template pool of the structure to generate.
  "elements": "testing:density/l",
  // Size of the grid voxels to test.
  "bounding_size": [8,8,8],
  // Size of the structure in grid voxels.
  // defaults to [1,1,1]
  "size": [6,6,6],
  // Offset from the bounding size
  // to place the structure.
  "location": [1,1,1],
  // Optional y offset from the grid.
  // defaults to 0. 
  "y_offset": 1,
  "grid": See Grid...
}

Alternating

{
  // Generates a structure that shifts
  // one or more grid units along the
  // y axis so long as it remains under
  // the y size
  "type": "largestructlib:alternating",
  // Optional name of the structure 
  // (defaults to unnamed)
  "name": "L",
  // template pool of the structure
  // to generate.
  "elements": "testing:density/l",
  // Size of the grid voxels to test.
  "bounding_size": [8,8,8],
  // Size of the structure in grid voxels.
  // defaults to [1,1,1]
  "size": [6,6,6],
  // Offset from the bounding size
  // to place the structure.
  "location": [1,1,1],
  "grid": See Grid...
}

Layered

{
  // Generates a skyscraper-like
  // layered structure if the base
  // generates. Upper layers do not
  // check their own density position.
  "type": "largestructlib:layered",
  // Optional name of the structure 
  // (defaults to unnamed)
  "name": "L",
  // base of the tower
  "base_elements": "testing:density/b",
  // middle elements of the tower
  "middle_elements": "testing:density/m",
  // top of the tower.
  "top_elements": "testing:density/h",
  // Minimum and maximum height of the tower.
  // Values are chosen at random and represent
  // how many layers are on this tower.
  "min_y": 0,
  "max_y": 6,
  "rarity": 0.5,
  // Size of the grid to test.
  "bounding_size": [8,8,8],
  // Size of each piece of this tower
  // based upon grid voxels.
  // defaults to [1,1,1]
  "size": [6,6,6],
  // Offset from the bounding size
  // to place the tower piece.
  "location": [1,1,1],
  // Optional y offset from the grid.
  // defaults to 0. 
  "y_offset": 1,
  "grid": See Grid...
}

Layered Grid

{
  // Same as layered but separated by a grid
  // the same size as the size field, forming
  // a grid pattern.
  "type": "largestructlib:layered_grid",
  // Optional name of the structure 
  // (defaults to unnamed)
  "name": "L",
  // base of the tower
  "base_elements": "testing:density/b",
  // middle elements of the tower
  "middle_elements": "testing:density/m",
  // top of the tower.
  "top_elements": "testing:density/h",
  // Minimum and maximum height of the tower.
  // Values are chosen at random and represent
  // how many layers are on this tower.
  "min_y": 0,
  "max_y": 6,
  "rarity": 0.5,
  // Size of the grid to test.
  "bounding_size": [8,8,8],
  // Size of each piece of this tower
  // based upon grid voxels.
  // defaults to [1,1,1]
  "size": [6,6,6],
  // Offset from the bounding size
  // to place the tower piece.
  "location": [1,1,1],
  // Optional y offset from the grid.
  // defaults to 0. 
  "y_offset": 1,
  "grid": See Grid...
}

Grid

The grid is a single list of value checks that represent the area that checks the density. Remember the keys for values? We use that here! Each key is placed in a grid that detects the density function provided. If all keys pass as true, the structure is placed. It is important to organize your keys. We place them in a grid as follows, with the maximum values for x, y, & z defined by the bounding size:

grid diagram

Tips and Tricks.

If you want to check for a single value along a plane or axis, define a single value check for it and fill the rest with a value check that encompasses the whole. For example, if you want to check for a specific value on the xy plane, you may want to define a "plane_for_value" check as so:

"xy": {
  "type": "largestructlib:plane_for_value",
  "minimum": 0.0,
  "maximum": 0.4,
  "axis": "z"
}

Then you'll define a default check that encompasses all possible values at that area:

"a": {
  "type": "largestructlib:default",
  "minimum": -10.0,
  "maximum": 10.0
},

And finally in your structure piece definition, you format the both values as so:

{
      "type": "largestructlib:default",
      "name": "Northwest inner temple",
      "elements": "yumecraft:verdant_temple/inner_temple/northwest",
      "bounding_size": [3,4,3],
      "size": [1,3,1],
      "location": [1,0,1],
      "grid": [
        "a", "-", "-",
        "xy", "-", "-",
        "a", "-", "-",

        "a", "-", "-",
        "a", "-", "-",
        "a", "-", "-",

        "a", "-", "-",
        "a", "-", "-",
        "a", "-", "-",

        "a", "-", "-",
        "a", "-", "-",
        "a", "-", "-",
      ]
},

Note "xy" can be anywhere along the xy plane.

Clone this wiki locally