Skip to content

shueppin/AutoCrafter-Datapack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 

Repository files navigation

AutoCrafter

This is a minecraft datapack which creates a block, that automatically crafts a selected item.
This is for Minecraft Java Edition and it can be used in every gamemode without turning on cheats.

The AutoCrafter is very useful for an automated farm.

Note: At the moment it isn't possible to craft every item. More items will be added. Go here for a list of all craftable items.

Content

Installation

Click on "Releases" and then open the latest release. Download the "AutoCrafter-1.x-v.x.x.zip" using the link "Download Datapack".
Open this ZIP file and put the downloaded ZIP-File into the datapacks folder of your minecraft world. Tutorial for installing a datapack

Using the AutoCrafter

Put a crafting table, a dropper and a chest into the crafting slots of your inventory or a crafting table.
As a result you will get a spawn egg.
Place this spawn egg, where you want your AutoCrafter to be. Note: the AutoCrafter is 2 blocks tall and 1 by 1 block wide. It can't be placed on slabs or other blocks which are smaller than a full block.

You can configure the AutoCrafter by sneaking and rightclicking on the chest of the AutoCrafter.
Then an inventory will open, in which you can put the item, it should craft into the top slot.
It will then tell you, if that item is craftable or not (Open the file AutoCrafter/craftable_items in your datapack or go here to see a list of all craftable items.)

The input materials can then be put into the dropper (the top block of the AutoCrafter) using hoppers or by hand.
The output can then be collected from the chest (the bottom block of the AutoCrafter) using a hopper or a hopper minecart, but not by hand.
Note: The AutoCrafter will only craft items, as long as the chest is empty. This means, the chest has to be emptied (as mentioned above) all the time or the AutoCrafter won't work.

Add a crafting recipe

First, download the datapack.


Creation of the crafting recipe file

  1. Go to AutoCrafter/data/autocrafter/functions/crafting/templates.
  2. Count the number of different input materials (items) your crafting recipe needs.
  3. Copy the needed template. (For example if you have 2 different materials, then use the file template_for_2_materials.txt)

It should look someting like this (this is the template of the crafting recipe which uses only one material):

scoreboard players set @s material_1_count_needed input_count_#
data modify storage autocrafter:crafting material_1_id set value "minecraft:input_item_#"


data modify storage autocrafter:crafting output_material set value {id:"minecraft:output_item", Count:output_count}
  1. Replace the following things:
  • Replace all minecraft:input_item_# (where # is the index of the material) with the exact name of the item.
    Attention: The minecraft: in front of the item name is very important!

  • Replace all input_count_# (where # is the index of the material) with the count of the needed material.

  • Replace the minecraft:output_item with the exact name of the item it should craft.
    Attention: The minecraft: in front of the item name is very important!

  • Replace the output_count with the number of items it should craft.
    Attention: It is very important to add a b after the number.

At the end it should look something like this (Here it is the crafting recipe of the goldblock, therefore it uses only one material.):

scoreboard players set @s material_1_count_needed 9
data modify storage autocrafter:crafting material_1_id set value "minecraft:gold_ingot"


data modify storage autocrafter:crafting output_material set value {id:"minecraft:gold_block", Count:1b}

Note for crafting recipes using items from mods
Instead of the minecraft: in front of the item names the name of the mod should be added instead: modname:input_item_#


  1. Save this file in the folder AutoCrafter/data/autocrafter/functions/crafting/recipes. It is recommended to use the name of the output item as filename. The suffix of the file is .mcfunction.


Adding the file to the AutoCrafter

  1. Open the file AutoCrafter/data/autocrafter/functions/get_item_to_craft.mcfunction.
  2. Copy the following line into the opened file.
execute if entity @s[nbt={Items:[{Slot:2b, id:"minecraft:output_item"}]}] store success score @s can_craft_item run function autocrafter:crafting/recipes/filename
  1. Replace in the pasted line minecraft:output_item with the exact name of the output item of the created crafting recipe.
    Attention: The minecraft: in front of the item name is very important!

  2. Replace in the pasted line filename with the filename of the created crafting recipe. This should be the output item name.
    Attention: Do not put the suffix .mcfunction there.

At the end it should look something like this:

execute if entity @s[nbt={Items:[{Slot:2b, id:"minecraft:gold_block"}]}] store success score @s can_craft_item run function autocrafter:crafting/recipes/gold_block

About

A Minecraft Datapack to create an AutoCrafter which automatically crafts items.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published