// Path: src/main/java/com/dta/extracarts/othermodcode/railcraft/common/util/inventory/InvTools.java
// public class InvTools {
// 	public static boolean isWildcard(ItemStack stack) {
// 		return isWildcard(stack.getItemDamage());
// 	}
// 
// 	public static boolean isWildcard(int damage) {
// 		return damage == -1 || damage == OreDictionary.WILDCARD_VALUE;
// 	}
// 
// 	/**
// 	 * A more robust item comparison function. Supports items with damage = -1
// 	 * matching any sub-type.
// 	 *
// 	 * @param a An ItemStack
// 	 * @param b An ItemStack
// 	 * @return True if equal
// 	 */
// 	public static boolean isItemEqual(ItemStack a, ItemStack b) {
// 		return isItemEqual(a, b, true, true);
// 	}
// 
// 	public static boolean isItemEqual(final ItemStack a, final ItemStack b, final boolean matchDamage, final boolean matchNBT) {
// 		if (a == null || b == null)
// 			return false;
// 		if (a.getItem() != b.getItem())
// 			return false;
// 		if (matchNBT && !ItemStack.areItemStackTagsEqual(a, b))
// 			return false;
// 		if (matchDamage && a.getHasSubtypes()) {
// 			if (isWildcard(a) || isWildcard(b))
// 				return true;
// 			if (a.getItemDamage() != b.getItemDamage())
// 				return false;
// 		}
// 		return true;
// 	}
// 
// 	/**
// 	 * Returns true if the item is equal to any one of several possible matches.
// 	 *
// 	 * @param stack
// 	 * @param matches
// 	 * @return
// 	 */
// 	public static boolean isItemEqual(ItemStack stack, ItemStack... matches) {
// 		for (ItemStack match : matches) {
// 			if (isItemEqual(stack, match))
// 				return true;
// 		}
// 		return false;
// 	}
// }


import com.dta.extracarts.othermodcode.railcraft.common.util.inventory.InvTools;
import mods.railcraft.api.core.items.IStackFilter;
import net.minecraft.item.ItemStack;
/*
 * Copyright (c) CovertJaguar, 2014 http://railcraft.info
 *
 * This code is the property of CovertJaguar
 * and may only be used with explicit written
 * permission unless otherwise specified on the
 * license page at http://railcraft.info/wiki/info:license.
 */
package com.dta.extracarts.othermodcode.railcraft.common.util.inventory.filters;


/**
 *
 * @author CovertJaguar <http://www.railcraft.info>
 */
public class ArrayStackFilter implements IStackFilter {

	private final ItemStack[] stacks;

	public ArrayStackFilter(ItemStack... stacks) {
		this.stacks = stacks;
	}

	@Override
	public boolean matches(ItemStack stack) {
		if (stacks.length == 0 || !hasFilter()) {
			return true;
		}
// Path: src/main/java/com/dta/extracarts/othermodcode/railcraft/common/util/inventory/InvTools.java
// public class InvTools {
// 	public static boolean isWildcard(ItemStack stack) {
// 		return isWildcard(stack.getItemDamage());
// 	}
// 
// 	public static boolean isWildcard(int damage) {
// 		return damage == -1 || damage == OreDictionary.WILDCARD_VALUE;
// 	}
// 
// 	/**
// 	 * A more robust item comparison function. Supports items with damage = -1
// 	 * matching any sub-type.
// 	 *
// 	 * @param a An ItemStack
// 	 * @param b An ItemStack
// 	 * @return True if equal
// 	 */
// 	public static boolean isItemEqual(ItemStack a, ItemStack b) {
// 		return isItemEqual(a, b, true, true);
// 	}
// 
// 	public static boolean isItemEqual(final ItemStack a, final ItemStack b, final boolean matchDamage, final boolean matchNBT) {
// 		if (a == null || b == null)
// 			return false;
// 		if (a.getItem() != b.getItem())
// 			return false;
// 		if (matchNBT && !ItemStack.areItemStackTagsEqual(a, b))
// 			return false;
// 		if (matchDamage && a.getHasSubtypes()) {
// 			if (isWildcard(a) || isWildcard(b))
// 				return true;
// 			if (a.getItemDamage() != b.getItemDamage())
// 				return false;
// 		}
// 		return true;
// 	}
// 
// 	/**
// 	 * Returns true if the item is equal to any one of several possible matches.
// 	 *
// 	 * @param stack
// 	 * @param matches
// 	 * @return
// 	 */
// 	public static boolean isItemEqual(ItemStack stack, ItemStack... matches) {
// 		for (ItemStack match : matches) {
// 			if (isItemEqual(stack, match))
// 				return true;
// 		}
// 		return false;
// 	}
// }


// Path: src/main/java/com/dta/extracarts/othermodcode/railcraft/common/util/inventory/filters/ArrayStackFilter.java
import com.dta.extracarts.othermodcode.railcraft.common.util.inventory.InvTools;
import mods.railcraft.api.core.items.IStackFilter;
import net.minecraft.item.ItemStack;

/*
 * Copyright (c) CovertJaguar, 2014 http://railcraft.info
 *
 * This code is the property of CovertJaguar
 * and may only be used with explicit written
 * permission unless otherwise specified on the
 * license page at http://railcraft.info/wiki/info:license.
 */
package com.dta.extracarts.othermodcode.railcraft.common.util.inventory.filters;


/**
 *
 * @author CovertJaguar <http://www.railcraft.info>
 */
public class ArrayStackFilter implements IStackFilter {

	private final ItemStack[] stacks;

	public ArrayStackFilter(ItemStack... stacks) {
		this.stacks = stacks;
	}

	@Override
	public boolean matches(ItemStack stack) {
		if (stacks.length == 0 || !hasFilter()) {
			return true;
		}
		return InvTools.isItemEqual(stack, stacks);