From 3d1f842c70a25f1bd1adb9ff1117e5a7d5ba2828 Mon Sep 17 00:00:00 2001 From: clawdbot-silly-waddle Date: Sat, 7 Mar 2026 00:13:05 +0100 Subject: [PATCH] Fix magnet filter only checking first configured slot The isItemFiltered method returned the comparison result on the first non-null filter slot, exiting the loop even on non-match. Items in slots beyond the first were never checked. Store the comparison in a local variable and only return true on match, allowing the loop to continue to subsequent filter slots. Fixes GTNewHorizons/GT-New-Horizons-Modpack#23776 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- .../item/WirelessMagnetCardFilterInventory.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/glodblock/github/inventory/item/WirelessMagnetCardFilterInventory.java b/src/main/java/com/glodblock/github/inventory/item/WirelessMagnetCardFilterInventory.java index f650e62af..d04e20eed 100644 --- a/src/main/java/com/glodblock/github/inventory/item/WirelessMagnetCardFilterInventory.java +++ b/src/main/java/com/glodblock/github/inventory/item/WirelessMagnetCardFilterInventory.java @@ -231,21 +231,19 @@ public boolean isItemFiltered(ItemStack inputItemStack) { .sameOre(OreHelper.INSTANCE.isOre(is), OreHelper.INSTANCE.isOre(inputItemStack))) return true; } + boolean match; if (ignoreMeta && ignoreNbt) { - // ignore meta & nbt - return is.getItem().equals(inputItemStack.getItem()); + match = is.getItem().equals(inputItemStack.getItem()); } else if (ignoreMeta) { - // ignore meta only - return ItemStack.areItemStackTagsEqual(is, inputItemStack) + match = ItemStack.areItemStackTagsEqual(is, inputItemStack) && is.getItem() == inputItemStack.getItem(); } else if (ignoreNbt) { - // ignore nbt only - return is.getItem() == inputItemStack.getItem() + match = is.getItem() == inputItemStack.getItem() && is.getItemDamage() == inputItemStack.getItemDamage(); } else { - // ignore nothing/don't use oredict--must be exact match - return is.isItemEqual(inputItemStack) && ItemStack.areItemStackTagsEqual(is, inputItemStack); + match = is.isItemEqual(inputItemStack) && ItemStack.areItemStackTagsEqual(is, inputItemStack); } + if (match) return true; } } return false;