chrrs / camerapture

Fabric mod with cameras that can take pictures!
https://modrinth.com/mod/camerapture
MIT License
4 stars 1 forks source link

PictureCloningRecipe matches empty inventories #30

Closed DaFuqs closed 1 month ago

DaFuqs commented 1 month ago

I got a bug report that Spectrum's Pedestal, which is able to craft vanilla recipes, breaks when Camerapture is also installed.

Checking out both in a dev env, I found that the recipe camerapture:picture_cloning returns a valid recipe on getRecipe when the input inventory is completely empty.

Your loop iterates all non-empty stacks in the inventory (of which there are none) and then returns a Optional.of(new Pair<>(<ItemStack.EMPTY>.copyWithCount(0), remainder)); in this case. It should be accounted for, so empty inventories don't match.

https://github.com/chrrs/camerapture/blob/4d49c45060fabe43e1552cbb969fc325e331324e/src/main/java/me/chrr/camerapture/item/PictureCloningRecipe.java#L82-L108

chrrs commented 1 month ago

Ah yeah you're right, good find! I'll make sure this is fixed in the next release!

DaFuqs commented 1 month ago

Thank you!