More Peripherals

More Peripherals

219k Downloads

Crafting does not require all crafting components

HarlanJ opened this issue ยท 4 comments

commented

Description

The crafting API can create a furnace from a single cobblestone, another crafting table from a single plank, a stone sword from a single stick and a single cobble, etc. If supplied with the material to craft the item correctly, it does use the correct amount of materials, but, as stated, it is not required.

Reproduction

My setup looks like this from the top:

[       ] [ CRAFT ] [       ]
[ CHEST ] [ COMP  ] [ CHEST ]

With the computer facing away from the crafting table.
Put a single cobble block in the left-hand chest

in the lua environment enter

ct = periperals.wrap("back")
ct.craft("left", "right", {1,1,1, 1,0,1, 1,1,1})

You now have a furnace in the right-hand chest that cost one cobblestone.

Version Information

SW Version
MC 1.20.1
forge 47.2.0
MorePeripherals 1.21.1
commented

I have a vague plan to look into this myself if it's not addressed before I get around to it. Not sure if you're accepting PRs, but at the very least it'll get my hands into modding finally.

commented

Thanks for opening the issue, probably a oversight in my part, gonna look into it, and yes, PRs welcome

commented

Managed to fix the issue by storing the slots and keeping a counter for each time the slot is referenced, and after doing this mapping it checks if the slots referenced do have the minimum for the recipe

Ex .:

local recipeForm = {
 1,1,1,
 1,0,1,
 1,1,1
}

if you don't have at least 8 items in the first slot it will not be able to craft returning false and Not enough resources on slot Y to craft being Y the slot expected to have the items

commented

Wow, thanks! I'm blown away by the speed at which you've responded!