baritone icon indicating copy to clipboard operation
baritone copied to clipboard

Add Crafting command

Open rycbar0 opened this issue 1 year ago • 8 comments

I want to be honest, as it is, its unusable. Maybe someone has a idea how to salvage it. My main problem is that items from blocks like oak planks and spruce planks or stone and granite, are the same item and i dont know how to handle them. Also some items have recipes that allow different ingredients (example chests) and i havnt yet figured out how to pick whats available instead of a fixed ingredient. If this problems cant be solved i cant see this ever working. some problems like checking if we have the resources to craft are related to this, others like placing a crafting table when non is available arnt a priority aslong as first one exist.

Whats missing (list not complete):

  • place crafting table if non is available
  • cancel operation and inform player if low on resources
  • proper way to get a item from a string
  • proper way to get a recipe from a item

What it can do:

  • walk to a crafting table and craft. (only works with some items, example #craft stick 200, #craft stone_axe)

PS: deconstructing recipies is not planed. if you want a wooden_pickaxe but you only have log's it wont automaticly craft planks and sticks.

rycbar0 avatar May 28 '23 23:05 rycbar0

This is looking really nice! I'll test it out tomorrow.

You're a real coding wizard!

strubium avatar Jun 02 '23 03:06 strubium

Forgot to include in my review: The scope looks simple and small. That's good. Not sure what that autoCraft setting is supposed to be though. So far you don't seem to plan on automatically starting crafting (I think that's good) and from it's documentation it seems to be a setting to disable #craft?

ZacSharp avatar Jun 07 '23 22:06 ZacSharp

Forgot to include in my review: The scope looks simple and small. That's good. Not sure what that autoCraft setting is supposed to be though. So far you don't seem to plan on automatically starting crafting (I think that's good) and from it's documentation it seems to be a setting to disable #craft?

I kinda just threw that in. It was meant to make baritone walk over to a crafting table and then open it, letting the user craft their own thing. It probably will be removed.

Nevermind its been removed

strubium avatar Jun 08 '23 20:06 strubium

altoclef is gonna be obsolete soon

UltraBlackLinux avatar Jun 08 '23 20:06 UltraBlackLinux

this is what it can do at the moment. i will need help with coding the "placing crafting tables" part. i thought about adding something similar for furnaces but they are extremely slow and idk how i could split the smelting on multiple furnaces. i dont think brewing, smithing, enchanting or trading are needed. https://youtu.be/W6w_uHJijzw

rycbar0 avatar Jun 12 '23 20:06 rycbar0

For placing I know brute force is inefficient (very limited range if you don't want to cause a lagspike) so I'd suggest just doing something like what BuilderProcess uses to determine placeable positions and if that fails just walk away a bit. This covers fewer positions but is much lighter on performance and I can't really imagine why it would do much worse. In most cases the first scan will find a position and that's it, in most other cases it will be able to place were it was standing or after breaking a block for tunneling.

Two problems with current error handling:

  1. If an unexpected screen or no screen is open, either fail with a clear error message or wait a couple seconds and then close it and attempt to open the crafting screen again. If the unexpected screen is chat then log a single message instead of closing it and wait until it is closed. That way the user has time to cancel the task and also knows this is intentional. Canceling while Baritone is opening 10+ GUIs per second is basically impossible without alt + f4.
  2. If it can't click the table despite being next to it, log a message and fail. Don't crash the game for no reason.

ZacSharp avatar Jun 12 '23 23:06 ZacSharp

How should i resolve the merge conflict? upstream merge with master?

rycbar0 avatar Jun 17 '23 23:06 rycbar0

Merging master into your branch again is probably the easiest way, yes.

ZacSharp avatar Jun 18 '23 00:06 ZacSharp