# Experience per tick

Experience per tick requirement is used to define per-tick xp inputs and outputs for a custom machine recipe.

To use it you just need to provide the amount of xp you want the recipe to consume/produce.

This requirement is available in both `input` and `output` modes.

In input mode : When starting to craft the recipe, the machine will consume the specified amount of xp each tick from the machine [experience component](https://frinn.gitbook.io/custom-machinery-1.19/creating-custom-machines/machine-components/experience-component).

In output mode : When starting to craft the recipe, the machine will produce the specified amount of xp each tick and put it in the machine [experience component](https://frinn.gitbook.io/custom-machinery-1.19/creating-custom-machines/machine-components/experience-component).

The requirement type of experience per tick requirement is : "`custommachinery:experience_per_tick"`.

### Properties

The experience per tick requirement has 3 mandatory properties and 2 optional properties.

#### Mandatory properties

```json
"type": "custommachinery:experience_per_tick" //Mandatory to define an experience per tick requirement.
```

<details>

<summary>Mode</summary>

#### Name : `mode`

#### Description :

Define the I/O mode of the requirement.

* `input` The requirement will consume xp at the start of the crafting process.
* `output` The requirement will produce xp at the end of the crafting process.

#### Example :

```json
"mode": "input"
```

The requirement will consume xp at the start of the crafting process.

</details>

<details>

<summary>Amount</summary>

#### Name : `amount`

#### Description :&#x20;

A positive integer value that define the amount of xp the recipe will consume/produce each tick.&#x20;

It can be any positive number but remember that the machine [experience component](https://frinn.gitbook.io/custom-machinery-1.19/creating-custom-machines/machine-components/experience-component) must be able to store at least this amount of xp.

#### Example :&#x20;

```json
"amount": 1000
```

The recipe will consume/produce 1000xp per tick.

</details>

#### Optional properties

<details>

<summary>Form</summary>

#### Name : `form`

#### Description :&#x20;

The type of xp the recipe will consume/produce, must be either `level` or `point`.

If set to `level` remember that in Minecraft xp levels are exponentials, if the machine produce 1 level for each recipe completed that mean it can output the equivalent amount of xp to go from level 0 to 1 or to go from level 999 to 1000 (which is a lot more) depending on if the machine currently has 0 or 999 levels worth of xp stored.

#### Default : `point`

#### Example :&#x20;

The machine will consume/produce 1 level worth of xp.

```json
"form": "level"
```

</details>

<details>

<summary>Chance</summary>

#### Name : `chance`

#### Description :

A double between 0.0 and 1.0 that define the chance of the requirement to be processed.

#### Default : 1

The requirement will always be processed.

#### Example :

```json
"chance": 0.7
```

The requirement will have 70% chance to be processed.

</details>

### Example

An experience requirement that will make the recipe produce 2672xp points each tick:

```json
{
    "type": "custommachinery:experience_per_tick",
    "mode": "output",
    "amount": 2672
}
```

An experience requirement that will make the recipe consume 10xp levels each tick with 80% chance:

```json
{
    "type": "custommachinery:experience_per_tick",
    "mode": "input",
    "amount": 10,
    "form": "level",
    "chance": 0.8
}
```
