# Example: paper press

Definition, process recipe and controller recipe for a paper press.

This example copies the shipped paper press's structure and capacities, gives it a separate recipe key, and changes its process to produce six paper. Its controller crafting recipe uses paper in the centre to distinguish it from the original. See the [definition field reference](https://movblock.mov/ntm-next/26.3/wiki/custom-machines.md) for every field.

Use [Quick Start](https://movblock.mov/ntm-next/26.3/wiki/quick-start.md)'s format-107.1 `pack.mcmeta` with these files:

```text
custom-paper-press/
  pack.mcmeta
  data/example/
    hbm/custom_machine/paper_press.json
    recipe/custom_machine/paper_press.json
    recipe/custom_machine_paper_press.json
```

## 1. Definition

File: `data/example/hbm/custom_machine/paper_press.json`

Definition ID: `example:paper_press`

```json
{
  "fluid_in_cap": 1000,
  "fluid_in_count": 1,
  "item_in_count": 1,
  "item_out_count": 1,
  "max_pollution_cap": 100,
  "max_power": 10000,
  "name": {
    "text": "Example Paper Press"
  },
  "recipe_key": "example:paper_press",
  "cells": [
    {
      "blocks": "hbm:cm_block_steel",
      "x": -1,
      "y": -1,
      "z": 0
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": -1,
      "y": -1,
      "z": 1
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": -1,
      "y": -1,
      "z": 2
    },
    {
      "blocks": "hbm:cm_sheet_steel",
      "x": -1,
      "y": 0,
      "z": 0
    },
    {
      "blocks": "hbm:cm_sheet_steel",
      "x": -1,
      "y": 0,
      "z": 1
    },
    {
      "blocks": "hbm:cm_sheet_steel",
      "x": -1,
      "y": 0,
      "z": 2
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": -1,
      "y": 1,
      "z": 0
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": -1,
      "y": 1,
      "z": 1
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": -1,
      "y": 1,
      "z": 2
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": 0,
      "y": -1,
      "z": 1
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": 0,
      "y": -1,
      "z": 2
    },
    {
      "blocks": "hbm:cm_sheet_steel",
      "x": 0,
      "y": 0,
      "z": 2
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": 0,
      "y": 1,
      "z": 1
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": 0,
      "y": 1,
      "z": 2
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": 1,
      "y": -1,
      "z": 0
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": 1,
      "y": -1,
      "z": 1
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": 1,
      "y": -1,
      "z": 2
    },
    {
      "blocks": "hbm:cm_sheet_steel",
      "x": 1,
      "y": 0,
      "z": 0
    },
    {
      "blocks": "hbm:cm_sheet_steel",
      "x": 1,
      "y": 0,
      "z": 1
    },
    {
      "blocks": "hbm:cm_sheet_steel",
      "x": 1,
      "y": 0,
      "z": 2
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": 1,
      "y": 1,
      "z": 0
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": 1,
      "y": 1,
      "z": 1
    },
    {
      "blocks": "hbm:cm_block_steel",
      "x": 1,
      "y": 1,
      "z": 2
    },
    {
      "blocks": "hbm:cm_port_steel",
      "x": 0,
      "y": -1,
      "z": 0
    },
    {
      "blocks": "hbm:cm_port_steel",
      "x": 0,
      "y": 1,
      "z": 0
    }
  ]
}
```

The `name` is a text component. This example uses a literal name; a translated name can instead use `{"translate":"machine.example.paper_press"}` with the corresponding language entry in a client resource pack.

`cells` are checked relative to the controller. Each `blocks` value accepts a block ID, a list of block IDs, or a block-tag reference. Only listed positions are checked, by block or tag membership.

For a north-facing controller, a cell `(x,y,z)` is that offset in world X/Y/Z. Other facings rotate the horizontal offset:

| Controller faces | World offset `(X,Y,Z)` |
| - | - |
| North | `(x, y, z)` |
| South | `(-x, y, -z)` |
| West | `(z, y, -x)` |
| East | `(-z, y, x)` |

Keep the controller at the origin when designing a structure. A requirement for another block at `(0,0,0)` would conflict with the controller itself. Use custom-machine port blocks for automation.

## 2. Process recipe

File: `data/example/recipe/custom_machine/paper_press.json`

Recipe ID: `example:custom_machine/paper_press`

```json
{
  "type": "hbm:custom_machine",
  "duration": 60,
  "input_fluids": [
    {
      "type": "minecraft:water",
      "amount": 250
    }
  ],
  "input_items": [
    {
      "ingredient": "hbm:powder_sawdust"
    }
  ],
  "order": 0,
  "output_items": [
    {
      "count": 6,
      "id": "minecraft:paper"
    }
  ],
  "pollution_amount": 0.03,
  "pollution_type": "SOOT",
  "power": 10,
  "recipe_key": "example:paper_press"
}
```

The definition and recipe both use `example:paper_press` as their `recipe_key`. This string is case-sensitive. Several definitions may intentionally share a recipe key. Item and fluid input arrays are positional: entry 0 belongs in input position 0, entry 1 in position 1, and so on.

With the example's default multipliers, the process lasts 60 ticks and consumes 10 HE per processing tick. It needs one sawdust, 250 mB of water at pressure 0, and room for six paper. Power the machine and provide the required inputs after assembling the listed cells.

## 3. Controller crafting recipe

File: `data/example/recipe/custom_machine_paper_press.json`

```json
{
  "type": "minecraft:crafting_shaped",
  "key": {
    "C": "minecraft:paper",
    "I": "#c:ingots/steel",
    "P": "#c:plates/steel"
  },
  "pattern": [
    "IPI",
    "PCP",
    "IPI"
  ],
  "result": {
    "components": {
      "hbm:custom_machine_type": "example:paper_press"
    },
    "id": "hbm:custom_machine"
  }
}
```

The controller's `hbm:custom_machine_type` component stores the **definition ID**.
