Wurst7
Wurst7 copied to clipboard
Autocraft
Description
Autocraft crafts items automatically and recursively with the goal of considering all possible crafting pathways and choosing one which is satisfied by the available ingredients in the user's inventory. Currently only the user's inventory is indexed for ingredients.
Crafting is done via the command .craft <id:count ...> which adds the corresponding items to the crafting queue. For example, .craft wooden_pickaxe:10 wooden_sword:5 will queue 10 wooden pickaxes to be crafted followed by 5 wooden swords. The count option can also be omitted to only craft one item, such as .craft diamond_pickaxe.
Items queued for crafting will be crafted as soon as the player opens a crafting table. If the player exits the crafting table while crafting is taking place, the crafting task will pause and resume when the player reopens a crafting table. If the player's inventory does not contain sufficient ingredients to craft the item when the crafting table is opened, nothing will happen and the crafting task will be ejected from the queue.
I have plans to expand this feature further. I am putting this PR here in case anyone wants some basic autocrafting functionality, as I was unable to find any existing mods on this client or elsewhere which did the same thing. Some ideas for future expansion include, in order of priority:
- Interfacing with netcode to deal with network latency (currently crafting tasks run on a timer with ~100ms between actions, which doesn't compensate for poor connections)
- More efficient crafting of large quantities of an item (currently recipes are crafted one at a time, but shift-clicking can be added to speed this up)
- Addition of "all" crafting mode as an alternative to specifying a count, crafts as many of the given item as possible given the ingredients
- Addition of other recipe types (smelting, stonecutting, ...) and corresponding code for switching between workbenches
- Automatic crafting and usage of relevant workbenches, instead of having the player manually create/use them
- System for indexing and remembering the contents of chests in the world, so that crafting ingredients can be retrieved from other places than the user's inventory
- System for indexing blocks in the world, similar to above, with the ability to understand and autocraft the required tool(s) to harvest blocks
- Interfacing with baritone to navigate between chests and workbenches and mine blocks needed for recipes
- Use of efficiency heuristics to determine the fastest crafting route (this becomes useful if the player has to walk some distance to a chest or to blocks in the world)
Any suggestions are welcome.
Why does this PR change AutoSteal's mixins? This seems unrelated to AutoCrafting. Please remove this change if it isn't necessary for AutoCraft to work.
It is likely that I will eventually change this part of the code when I allow autocraft to fetch items from chests. I noticed that autosteal has some code duplication that could be avoided, so I factored it out into a common class. Since there is a recent PR #505 which specifically deals with autosteal, I'll remove this change to avoid conflicts. But #505 should probably do something similar, since currently it doesn't affect shulker boxes.
@cropbob Is this ready to merge now?
@cropbob Is this ready to merge now?
I'm in the process of porting baritone to wurst, since it will be needed for storage container pathfinding. The autocrafting itself seems to be working well even under slow network conditions, but I still have plans to add more features such as searching in storage containers. Do you think integrating baritone at an API level would be a worthwhile addition to wurst? It will certainly be useful for autocrafting, but will probably need to be re-ported following updates to baritone.
Do you think integrating baritone at an API level would be a worthwhile addition to wurst?
No. As you already mentioned, adding Baritone would complicate future Wurst updates. It would also make it difficult if not impossible to port the AutoCraft feature to older MC versions.
Besides, Wurst already includes its own pathfinder that is perfectly capable of walking/flying to a nearby chest/workbench/furnace/etc. while also being much more lightweight than Baritone and already compatible with older Wurst versions.
I'll design it such that it is loosely coupled with Wurst's pathfinder and can be easily modified to work with another pathfinding engine. Wurst's pathfinder seems incapable of pathfinding over large distances, mining into enclosed spaces, or mining anything at all. It will work fine in situations in which someone wants to gather resources from storage containers within their own base, but will have trouble with anything else.
ppl still use wurst?
This pull request has been open for a while with no recent activity. If you're still working on this or waiting for a review, please add a comment or commit within the next 7 days to keep it open. Otherwise, the pull request will be automatically closed to free up time for other tasks.
Pull requests should be closed if:
- They have been superseded by another pull request
- They are out of scope or don't align with the project
- They have become obsolete due to other changes
- They have bugs or conflicts that won't be resolved