Refactor recipe validation logic in StaliniumPressBlockEntity

This commit is contained in:
IM23a-spirgif
2025-05-15 11:36:20 +02:00
parent 51fa5f6f34
commit ffcc7e1ca9
@@ -146,9 +146,15 @@ public class StaliniumPressBlockEntity extends BlockEntity implements MenuProvid
} }
private boolean hasRecipe() { private boolean hasRecipe() {
ItemStack output = new ItemStack(ModItems.STALINIUM_INGOT.get(), 1); if (itemHandler.getStackInSlot(INPUT_SLOT).getCount() < 9) {
return itemHandler.getStackInSlot(INPUT_SLOT).is(ModItems.STALINIUM_NUGGET) && return false;
canInsertAmountIntoOutputSlot(output.getCount()) && canInsertItemIntoOutputSlot(output); }
if (itemHandler.getStackInSlot(INPUT_SLOT).getItem() != ModItems.STALINIUM_NUGGET.get()) {
return false;
}
ItemStack result = new ItemStack(ModItems.STALINIUM_INGOT.get(), 1);
return canInsertItemIntoOutputSlot(result) &&
canInsertAmountIntoOutputSlot(result.getCount());
} }
private boolean canInsertItemIntoOutputSlot(ItemStack output) { private boolean canInsertItemIntoOutputSlot(ItemStack output) {