From ef2eaf4eb23ecfaf00074da40b65b4cd1f77559a Mon Sep 17 00:00:00 2001 From: PrototypeTrousers Date: Thu, 3 Nov 2022 14:17:12 -0300 Subject: [PATCH] fix ct ingredient size mismatch causing recipe lookup failure (#1256) --- .../ingredients/CraftTweakerItemInputWrapper.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/gregtech/api/recipes/ingredients/CraftTweakerItemInputWrapper.java b/src/main/java/gregtech/api/recipes/ingredients/CraftTweakerItemInputWrapper.java index d9d3306fb..ecc56a2c7 100644 --- a/src/main/java/gregtech/api/recipes/ingredients/CraftTweakerItemInputWrapper.java +++ b/src/main/java/gregtech/api/recipes/ingredients/CraftTweakerItemInputWrapper.java @@ -62,7 +62,14 @@ public boolean acceptsStack(@Nullable ItemStack itemStack) { IItemStack[] itemArray = this.ingredient.getItemArray(); if (itemArray.length == 0) return true; - return ingredient.getItems().stream().anyMatch(ii -> ii.matches(CraftTweakerMC.getIItemStackForMatching(itemStack, ii.getMetadata() == GTValues.W))); + return ingredient.getItems().stream().anyMatch(ii -> { + if (ii.getAmount() > itemStack.getCount()) { + final ItemStack is = itemStack.copy(); + is.setCount(ii.getAmount()); + return ii.matches(CraftTweakerMC.getIItemStackForMatching(is, ii.getMetadata() == GTValues.W)); + } + return ii.matches(CraftTweakerMC.getIItemStackForMatching(itemStack, ii.getMetadata() == GTValues.W)); + }); } @Override