Skip to content

Commit

Permalink
Update autocraft documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dthigpen committed Jul 5, 2021
1 parent bc6b1e0 commit a94e830
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 10 deletions.
42 changes: 36 additions & 6 deletions autocraft/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,54 @@ Automate the crafting process with a redstone enabled crafting table.

## Usage

You can create an autocrafter for nearly any item in the game with the following recipe formula, `crafting_table + dropper + <item-of-choice> = autocrafter`. Since it is a shapeless recipe any positioning of the ingredients with work.
Create an autocrafter for nearly any item in the game with the following recipe formula, `crafting_table + dropper + <item-of-choice> = autocrafter`. Since it is a shapeless recipe any positioning of the ingredients with work. See the [Guide](#Guide) section for more details.

<img src="docs/recipe.png" width=200>
<img src="docs/autocrafter.png" width=200>
<img src="docs/iron_block_autocrafter_recipe.jpg" width=200>
<img src="docs/iron_block_autocrafter_opened.jpg" width=200>


The autocrafter will only work when there is a `hopper` below it. Lock the `hopper` and fill in the items for the recipe, then unlock the `hopper` to craft the item. Items filled into the autocrafter will **not** stack if there are spaces available. For example if three iron ingots are fed into the slot, they will spread to take up three slots as opposed to one.
The autocrafter will only work when there is a `hopper` (or `hopper_minecart`) below it. Lock the `hopper` and fill in the items for the recipe, then unlock the `hopper` to craft the item. Items filled into the autocrafter will **not** stack if there are spaces available. For example if three iron ingots are fed into the slot, they will spread to take up three slots as opposed to one.

<img src="docs/autocrafter2.png" width=200>

While the hopper under the autocrafter is powered (locked) it will not attempt to craft any items. When unlocked (unpowered) the item will attempt to be crafted then pulled by the hopper.

Crafting items is straightforward for blocks such as an `iron_block` composed of nine ingots, but more complicated for shaped recipes like a `hopper`, requiring slots of air between some items. This can be accomplished my using placeholder items that get filtered out after.

## Guide
<details>
<summary>Single Ingredient Recipes </summary>
Crafting recipes with a single ingredient do not require any additional redstone components to operate the autocrafter besided the hopper below. Items fed into the autocrafter will automatically be crafted and sent below immediately.

<img src="docs/single_ingredient_recipe_crafting.png" width=200>

</details>

<details>
<summary>Multiple Ingredient Recipes </summary>
Crafting recipes with multiple ingredients require locking the hopper for all ticks that the autocrafter is being loaded with the ingredients so that they do not fall through before the recipe is completed. Once loaded, the hopper can be unlocked and the item will be crafted.

<img src="docs/locked_autocrafter.png" width=190>
<img src="docs/iron_block_autocrafter_opened.jpg" width=200>

</details>

<details>
<summary>Shaped Recipe Crafting </summary>
Shaped recipes require placeholder items to be fed into slots that would be empty. These items must then be filtered out so that only the recipe ingredients remain. Depending on the recipe, this can require a fairly complex redstone setup.

<img src="docs/redstone_torch_autocrafter_recipe.png" width=200>
<img src="docs/redstone_torch_autocrafter_opened.png" width=200>

</details>

---
## Caveats and Limitations
- Currently only single item stacks are supported in the autocraft. For example, it will not craft when there are 2+ ingredients in a stack
- Non-item specific crafting is possible but not recommended as it is a very resource intensive operation to perform every tick and causes **significant** lag.

## TODO
- Item specific custom models to indicate autocrafter type
- Speed optimizations
- Speed optimizations
- Support for item stacks
- Support for mutliple recipe result items
- Interaction with hopper cooldown
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,11 @@ execute if data storage call_stack: this.recipe_result.result.id run data modify
execute if data storage call_stack: this.recipe_result.result.id run function dt.crafting:internal/recipe/result_to_item
execute if data storage call_stack: this.recipe_result.result.id run data modify storage call_stack: this.items set value []
execute if data storage call_stack: this.recipe_result.result.id run data modify storage call_stack: this.items append from storage call_stack: call.result
# execute if data storage call_stack: this.recipe_result.result.id run data modify storage call_stack: this.items[0].Slot set value 0b
# execute if data storage call_stack: this.recipe_result.result.id run data modify storage call_stack: call.arg0 set from storage call_stack: this.items
# execute if data storage call_stack: this.recipe_result.result.id run function dt.autocraft:internal/blocks/autocrafter/set_items_for_block_or_entity
execute if data storage call_stack: this.recipe_result.result.id run data modify block ~ ~ ~ Items set value []
# try looting to the hopper in case there are free spots or spots with the result already
execute if data storage call_stack: this.recipe_result.result.id run data modify storage call_stack: call.arg0 set from storage call_stack: this.items[0]
execute if data storage call_stack: this.recipe_result.result.id positioned ~ ~-1 ~ run function dt.inventory:api/loot_to_block
execute if data storage call_stack: this.recipe_result.result.id run data modify storage call_stack: this.successful set from storage call_stack: call.result

execute if data storage call_stack: this.recipe_result.result.id if data storage call_stack: {this:{successful:false}} run data modify block ~ ~ ~ Items set from storage call_stack: this.items


Expand Down
Binary file added autocraft/docs/iron_block_autocrafter_opened.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added autocraft/docs/iron_block_autocrafter_recipe.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added autocraft/docs/locked_autocrafter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a94e830

Please sign in to comment.