Skip to content
This repository was archived by the owner on Jun 8, 2022. It is now read-only.

Custom Crafting Table

ImCoolYeah105 edited this page Jul 21, 2018 · 17 revisions

The Datapack Utils custom crafting table API has a few advantages over others of its kind:

  • Accepts any item, including NBT data
  • Configurable cost amounts for each item
  • Output quantity is dynamically set proportional to amount of ingredients for fast crafting

How to Set Up a Custom Table

Datapack utils does not add its own table block- mostly because it doesn't have a resourcepack. In order to create one, summon an entity with the tag du_crafter at the location of a trapped chest. You can modify this entity however you like, for example having it wear a custom model. You can also modify the trapped chest. Any slots not used for crafting will be filled with gray stained glass panes, however you can change these items to whatever you like, for example if you want to set up a custom GUI.

The next step is to create the function tag du:recipes and add your recipe function(s) to it. Note: do to this implementation, any table that extends this API will be able to craft all recipes added by all datapacks that also extends this API.

Creating recipes is roughly the same as dropper based crafting with a one key differences: leave out the Count NBT tag, and instead use provided scoreboard values for checking count when needed. If the check is successful, replaceitem your output in slot 16.

Example recipe: execute if score in_4 du_data matches 0 if block ~ ~ ~ trapped_chest{Items:[{Slot:2b,id:"minecraft:cobblestone"},{Slot:3b,id:"minecraft:cobblestone"},{Slot:4b,id:"minecraft:cobblestone"},{Slot:11b,id:"minecraft:cobblestone"},{Slot:13b,id:"minecraft:cobblestone"},{Slot:20b,id:"minecraft:cobblestone"},{Slot:21b,id:"minecraft:cobblestone"},{Slot:22b,id:"minecraft:cobblestone"}]} run replaceitem block ~ ~ ~ container.16 furnace 1

Note the check for in_4 du_data being 0. This verifies that the center slot is empty.

In order to make a slot consume multiple ingredients, first check that the slot has enough using scoreboards.

For example: execute if score in_0 du_data matches 2.. if block...

Then set the out_X du_data score to the needed amount, where x is the slot number.

Example of whole recipe:


replaceitem block ~ ~ ~ container.16 minecraft:armor_stand 2
scoreboard players set out_3 du_data 2
scoreboard players set out_5 du_data 2```

Clone this wiki locally