Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crafting Supplier takes more materials than single item recipe requires, when recipe specified has more than 1 item per slot #18

Closed
ZenonSeth opened this issue Jul 20, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@ZenonSeth
Copy link
Owner

E.g. if the recipe is like so:
image
Then when requested to craft 1 item the crafting supplier will erroniously:

  1. Require 13 Cobblestone (because there are 6 in one slot), instead of 8 as are needed
  2. Take 13 Cobblestone from the network, and put the leftover 5 into its overflow inventory

Two ways to solve this:

  1. Limit ghost item to 1 item per slot
  2. Make Crafting Supplier check the recipes and take only and exactly what is needed for 1 output.

Created from discussion in #17

@ZenonSeth ZenonSeth added the bug Something isn't working label Jul 20, 2024
@Ocraw
Copy link
Contributor

Ocraw commented Jul 21, 2024

Eh, I should have probably added here instead:

In MCL, creating even stacks, say 8x8, consumes only the 8 needed for one craft, while still crafting 8. The behaviour of requesting all the summed stacks is the same.

Fixed in #19

@ZenonSeth
Copy link
Owner Author

Release 1.2.4 should now fix this, along with improving the crafting inventory usability by allowing moving items within it, and replacement of items.

Limiting the stacksize to 1 would probably have been easier, but instead I made both the Crafting Supplier and Autocrafter (both affected by this bug) take only the minimum required recipes. This was a bit more difficult because of replacements, but it should now work correctly, while keeping replacements accurate.

Also has been published on ContentDB.

@Ocraw
Copy link
Contributor

Ocraw commented Jul 23, 2024

Confirming it works.
Could the same principle (if I got right what you did) be implemented to import the recipe by clicking with an item on the output?
For example clicking on the crafting supplier output holding a furnace automatically sets the ghost items to the recipe for the furnace.

@ZenonSeth
Copy link
Owner Author

Yes, that's possible, minetest provides a function to get the crafting recipes for an item. Two things make it a bit more challenging to implement though:

  1. An item can have multiple crafting recipes - not too difficult to solve, just picking the latest one
  2. Item recipes can use groups, rather than specific items, e.g. "group:wood" rather than any specific wood item. I actually don't know what minetest returns in that case, when looking up the recipe. Either it returns a special ItemStack to represent a group, or it translates it to a real recipe - not sure, and if it returns "group:" then that needs to be translated to a real item. In both cases, the recipe arrived at, may not be what the user wants.

Still, it's possible, and for most items it could work just fine. Will keep it in mind to implement, but want to try and take care of some previous bugs/requests first.

@ZenonSeth
Copy link
Owner Author

Going to close this as done, as it should be now fixed correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants