# Loot table

Loot table requirement is used to generate item outputs based on a vanilla, modded or custom loot table.

This requirement is OUTPUT only, you don't have to specify a `mode` property.&#x20;

This requirement will block the end of the recipe if the generated items can't be put in a slot (because all slots are full for example).

The requirement type of loot table requirement is : "`custommachinery:loot_table"`.

### Properties

The loot table requirement has 2 mandatory properties and 1 optional property.

#### Mandatory properties

```json
"type": "custommachinery:loot_table" //Mandatory to define a loot table requirement.
```

<details>

<summary>Table</summary>

#### Name : `table`

#### Description :&#x20;

Define the path of the loot table file to use.&#x20;

The path must be of the format: `namespace:path/from/the/loot_tables/folder`.

#### Example :&#x20;

```json
"table": "custommachinery:my_loot_table"
```

The requirement will use a loot table located in `data/custommachinery/loot_tables/my_loot_table.json`.

</details>

#### Optional property

<details>

<summary>Luck</summary>

#### Name : `luck`

#### Description :&#x20;

A float that can be used in the loot table to affect the number of generated items.&#x20;

See [vanilla wiki](https://minecraft.fandom.com/wiki/Loot_table) for more info about loot tables.

#### Default : `0`

#### Example :&#x20;

```json
"luck": 1.0
```

</details>

### Example

A loot table requirement that will make the recipe output either 28 diamonds or a stone in the #forge:stones tag.

```json
{
    "type": "custommachinery:loot_table",
    "table": "custommachinery:text_loot_table"
}
```

In `data/custommachinery/loot_tables/test_loot_table.json`

{% code title="test\_loot\_table.json" %}

```
{
    "type": "custommahinery:custom_machine",
    "pools": [
	{
	    "rolls": 1,
	    "entries": [
		{
		    "functions": [
			{
			    "function": "set_count",
			    "count": 25
		        }
		    ],
		    "type": "minecraft:item",
		    "name": "minecraft:diamond"
		},
		{
		    "type": "tag",
		    "name": "forge:stone",
		    "expand": true
	        }
	    ]
	}
    ]
}
```

{% endcode %}

### Notes

Minecraft loot tables are a very complex system, which is made to be used in many ways (block and mobs drops, dungeon chests, plant harvest etc...) and that would be a hell to support and test all possibilities of loot tables. So some things may break, other may not work.

Loot tables have a `type` property, when possible use `"type": "custommachinery:custom_machine"`. It may not be needed thought.

If you have any issues with the loot table requirement and you seek support in the github issues or in the discord, please include the loot table file and describe the most precisely possible what it should do. I am not a loot tables expert and I can't spend hours on the wiki just to understand what your loot table does.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://frinn.gitbook.io/custom-machinery-1.16/recipes/requirements/loot-table.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
