IntelligenceModding / Advanced-Peripherals-Features

A place for the feature request for Advanced Peripherals
0 stars 1 forks source link

isItemCraftable returns true even if there is not enough materials to craft the items #61

Open michihupf opened 10 months ago

michihupf commented 10 months ago

Describe

isItemCraftable returns true whenever an item can be crafted. Although this works to detect if a crafting pattern is missing it seems to completely disregard the amount of items to be crafted.

Is this by design or is this a bug? Detecting whether or not a crafting job was started but subsequently failed because of material shortage is extremely important in autocrafting and autofarming applications.

Steps to reproduce

The code below will print true even if 10 stone can't be crafted because there isn't enough cobblestone in the system.

me = peripheral.find("meBridge")
print(me.isItemCraftable({name="minecraft:stone", count=10})

Multiplayer?

Yes

Version

1.20.1-0.7.32b (Latest 1.20.1)

Minecraft, Forge and maybe other related mods versions

Minecraft 1.20.1 (forge 47.1.3), cc-tweaked-1.20.1-forge-1.106.1

Screenshots or Videos

No response

Crashlog/log

No response

SirEndii commented 9 months ago

This is more or less intended. isItemCraftable returns true if a pattern exists for the item you want to craft

is extremely important in autocrafting and autofarming applications.

I agree with that, however, we can't currently change this behavior. The reason is because AE2 calculates recipes async, a calculation can take a while and while it calculates, the script would freeze which is not what we want

It is planned that we add a crafting event which can return different states like missing items, no CPU free, calculation successful or crafting finished