First, delay the recipe lookup until after there is confirmed to be a non-null item. Previously the recipe lookup would run before a guaranteed item was found, which means that recipe would always be null, even if the input check found an applicable item.
This change defers the recipe lookup to after finding an item, so that recipe will not be null (for an input item) after the new input item is set.
Secondly, if the input consumption failed due to null recipe or other factor, reset the cached itemstack and the mark state. This part is what addresses the issue in #7.
A couple changes related to #7
First, delay the recipe lookup until after there is confirmed to be a non-null item. Previously the recipe lookup would run before a guaranteed item was found, which means that
recipe
would always be null, even if the input check found an applicable item.This change defers the recipe lookup to after finding an item, so that
recipe
will not be null (for an input item) after the new input item is set.Secondly, if the input consumption failed due to null recipe or other factor, reset the cached itemstack and the mark state. This part is what addresses the issue in #7.
Fixes #7