> For the complete documentation index, see [llms.txt](https://frinn.gitbook.io/custom-machinery-1.19/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://frinn.gitbook.io/custom-machinery-1.19/mod-integrations/kubejs/recipes/structure.md).

# Structure

**Use one of these methods to add a** [**Structure Requirement**](https://github.com/Frinn38/Custom-Machinery/wiki/Structure-Requirement) **to the recipe.**

```javascript
//Only requires the structure
.requireStructure(pattern, keys)

//Destroys the structure (DON'T drop the blocks)
.destroyStructure(pattern, keys)

//Break the structure (drop the blocks)
.breakStructure(pattern, keys)

//Place the structure (drops the replaced blocks)
.placeStructure(String[][] pattern, Map<char, String> keys, true)

//Place the structure (DON'T drop the replaced blocks)
.placeStructure(String[][] pattern, Map<char, String> keys, false)
```

* The `pattern` param must be an array of array of strings. \
  See `pattern` property of structure requirement.\
  Example: `[["aaa", "aaa", "aaa"], ["aaa", "ama", "aaa"], ["aaa", "aaa", "aaa"]]` Define a 3x3x3 box around the machine `m`
* The `keys` param must be a map of string -> string. \
  See keys property of structure requirement.\
  The keys of the map must be single characters (except `m` which is reserved for the machine) and the values must be a block ID with the format: `namespace:block_id[state1=value,state2=value]` (states are optional).\
  Example: `{"a": "minecraft:stone", "b": "minecraft:diamond_block"}`

### **Example**

```javascript
ServerEvents.recipes(event => {

  event.recipes.custommachinery.custom_machine("custommachinery:power_crusher", 100)
    .requireStructure([[
      "aaa",
      "a a",
      "aaa",
      " m "
    ]], {"a": "minecraft:stone"})
    
})
```

A 3x1x3 hollow ring of stone behind the machine.
