# Drop

Drop requirement is used to check/consume/drop items on ground near the machine.

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

The requirement type of drop requirement is : `"custommachinery:drop"`.

### Properties

The drop requirement has 3 mandatory properties and 7 optional properties.

#### Mandatory properties

```json
"type": "custommachinery:drop" //Mandatory to define a drop requirement.
```

<details>

<summary>Mode</summary>

#### Name : `mode`

#### Description :

Define when the requirement will be processed.

* `input` The requirement will be processed at the start of the crafting process.
* `output` The requirement will be processed at the end of the crafting process.

#### Example :

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

The requirement will be processed at the start of the crafting process.

</details>

<details>

<summary>Action</summary>

#### Name : `action`

#### Description :

Define what will the requirement do. Available actions are:

* `check` Will only check for items that match the list defined in the `input` property.
* `consume` Will consume items that match the list defined in the `input` property.
* `produce` Will drop the item specified in the `output` property near the machine.

`check` will check for the required items each tick of the recipe and stop the processing if it can't find the items.

`consume` and `produce` will do their actions on start of the processing if the `mode` property is "input" or on end of the processing if "output".

#### Example :

```json
"action": "consume"
```

The machine will consume items on ground.

</details>

#### Optional properties

<details>

<summary>Output</summary>

#### Name : `output`

#### Description :

An item to drop if the `action` property is set to `produce`

#### Default :

```json
"output": "minecraft:air"
```

An air item, meaning nothing will be dropped.

#### Example :

```json
"output": "minecraft:diamond"
```

The requirement will drop a vanilla diamond on ground.

#### Note :

This property is optional for `check` and `consume` actions, but mandatory for `produce` action.

</details>

<details>

<summary>Input</summary>

#### Name : `input`

#### Description :

A list of items or items tags (can be both) that will be checked or consumed by the machine.

#### Default : `em`pty

The machine will not be able to check or consume any items.

#### Example :

```json
"input": ["minecraft:cobblestone", "#forge:stone"]
```

The machine will check or consume only vanilla cobblestone or items in the #forge:stone tag.

</details>

<details>

<summary>Whitelist</summary>

#### Name : `whitelist`

#### Description :

A boolean, if false the `input` property list will be used as a blacklist of items instead of a whitelist.

#### Default : `true`

The `input` property will act as a whitelist.

#### Example :

```json
"whitelist": false
```

The `input` property will act as a blacklist.

</details>

<details>

<summary>Amount</summary>

#### Name : `amount`

#### Description :

The amount of items to check/consume or produce.

#### Default : 1

The requirement will check, consume or produce 1 item.

#### Example :

```json
"amount": 9
```

The recipe will check/consume 9 items matching the list defined in the `input` property (if whitelist), the crafting process will be stopped if the required amount of items are not found.\
If `action` property is `produce` this property defines the amount of items produced.

</details>

<details>

<summary>NBT</summary>

#### Name : `nbt`

#### Description :

A string that represent a nbt tag that will be required on the checked/consumed items, or added to the produced items.\
If the drop requirement is in `check` or `consume` action it will search for items around the machine that have AT LEAST those nbt tag, if the item have more tag it's fine as long as it have all the tags specified in this property.\
The nbt tag must be defined the same way you use it in the /give command.

You can see the nbt tag of an item using `/data get entity @s SelectedItem` and then copy the part after `tag:` inside {}.

#### Default :

Nothing (no nbt tags)

#### Example :

```json
"nbt": "{'test1': true, 'Amount': 10}"
```

The item requirement will search for items with nbt tag "test1" with value true and tag "Amount" with value 10.

</details>

<details>

<summary>Radius</summary>

#### Name : `radius`

#### Description :

An integer defining the maximal range from the center of the machine that the items will be searched. This does not affect produced items.

#### Default : 1

1 block radius, in a sphere shape around the center of the machine.

#### Example :

```json
"radius": 3
```

The radius is set to 3 blocks around the machine.

</details>

<details>

<summary>Delay</summary>

#### Name : `delay`

#### Description :

A double value, between 0.0 and 1.0 that represents at which time of the recipe the requirement action must be executed.\
A delay of 0.5 represent half of the recipe, 0.25 a quarter etc...

#### Default : 0

The requirement action will be executed on start if mode is input or on end if mode is output.

#### Example :

```json
"delay": 0.33
```

The requirement action will be executed when the recipe progress time is at (approximatively) a third of the recipe total duration.

#### Note :

If delay is specified the requirement will be only executed at the specified delay, independently of the mode property.\
This property have no effect if the `action` is set to `check` as this action is executed each tick of the recipe.

</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

A Drop Requirement that will make the recipe drop 3 diamonds on the ground at the end of the crafting process with a 33% chance.

```json
{
    "type": "custommachinery:drop",
    "mode": "output",
    "action": "produce",
    "output": "minecraft:diamond",
    "chance": 0.33
}
```

A drop requirement that will make the recipe check for 5 items in the `#forge:stone` tag in a 5 blocks radius during all the crafting process.

```json
{
    "type": "custommachinery:drop",
    "mode": "input",
    "action": "check",
    "input": "#forge:stone",
    "amount": 5,
    "radius": 5
}
```
