diff --git a/src/main/java/forestry/core/utils/ItemStackUtil.java b/src/main/java/forestry/core/utils/ItemStackUtil.java index 662ba56e9..961e60625 100644 --- a/src/main/java/forestry/core/utils/ItemStackUtil.java +++ b/src/main/java/forestry/core/utils/ItemStackUtil.java @@ -141,6 +141,13 @@ public abstract class ItemStackUtil { * Counts how many full sets are contained in the passed stock */ public static int containsSets(ItemStack[] set, ItemStack[] stock, boolean oreDictionary, boolean craftingTools) { + return containsSets(set, stock, oreDictionary, craftingTools, false); + } + + /** + * Counts how many full sets are contained in the passed stock + */ + public static int containsSets(ItemStack[] set, ItemStack[] stock, boolean oreDictionary, boolean craftingTools, boolean matchTags) { int totalSets = 0; ItemStack[] condensedRequired = ItemStackUtil.condenseStacks(set); @@ -150,7 +157,7 @@ public abstract class ItemStackUtil { int reqCount = 0; for (ItemStack offer : condensedOffered) { - if (isCraftingEquivalent(req, offer, oreDictionary, craftingTools)) { + if (isCraftingEquivalent(req, offer, oreDictionary, craftingTools) && (matchTags ? ItemStack.areItemStackTagsEqual(req, offer) : true)) { int stackCount = (int) Math.floor(offer.stackSize / req.stackSize); reqCount = Math.max(reqCount, stackCount); } diff --git a/src/main/java/forestry/mail/TradeStation.java b/src/main/java/forestry/mail/TradeStation.java index b2528e480..43e6c232e 100755 --- a/src/main/java/forestry/mail/TradeStation.java +++ b/src/main/java/forestry/mail/TradeStation.java @@ -176,7 +176,7 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve return EnumStationState.INSUFFICIENT_PAPER; } - int ordersToFillCount = ItemStackUtil.containsSets(InventoryUtil.getStacks(inventory, SLOT_EXCHANGE_1, SLOT_EXCHANGE_COUNT), letter.getAttachments()); + int ordersToFillCount = ItemStackUtil.containsSets(InventoryUtil.getStacks(inventory, SLOT_EXCHANGE_1, SLOT_EXCHANGE_COUNT), letter.getAttachments(), false, false, true); // Not a single match. if (ordersToFillCount <= 0) { @@ -523,6 +523,9 @@ public class TradeStation extends WorldSavedData implements ITradeStation, IInve if (!pol.isItemEqual(req)) { continue; } + if (!ItemStack.areItemStackTagsEqual(req, pol)) { + continue; + } if (req.stackSize >= pol.stackSize) { req.stackSize -= pol.stackSize;