Loot table

Make the recipe output the result of a 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.

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

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

Name : table

Description :

Define the path of the loot table file to use.

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

Example :

"table": "custommachinery:my_loot_table"

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

Optional property

Luck

Name : luck

Description :

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

See vanilla wiki for more info about loot tables.

Default : 0

Example :

"luck": 1.0

Example

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

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

In data/custommachinery/loot_tables/test_loot_table.json

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
	        }
	    ]
	}
    ]
}

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.