Fixed behavior of Filter Cubes not filtering same types of material.

This commit is contained in:
sigonasr2 2016-12-12 23:31:35 -06:00
parent bdd45d404c
commit 8752760670
3 changed files with 9 additions and 1 deletions

Binary file not shown.

View File

@ -84,4 +84,12 @@ public class InventoryUtils {
} }
return remaining; return remaining;
} }
public static boolean InventoryContainSameMaterial(Inventory inv, ItemStack item) {
for (ItemStack i : inv.getContents()) {
if (i!=null && item!=null && i.getType()==item.getType()) {
return true;
}
}
return false;
}
} }

View File

@ -46,7 +46,7 @@ public class ItemCubeUtils {
HashMap<Integer,ItemStack> reject_items = new HashMap<Integer,ItemStack>(); HashMap<Integer,ItemStack> reject_items = new HashMap<Integer,ItemStack>();
for (ItemStack it : remaining) { for (ItemStack it : remaining) {
if (it!=null) { if (it!=null) {
if (inv.containsAtLeast(it, 1)) { if (InventoryUtils.InventoryContainSameMaterial(inv, it)) {
HashMap<Integer,ItemStack> extras = cube_inv.addItem(it); HashMap<Integer,ItemStack> extras = cube_inv.addItem(it);
if (extras.size()==0) { if (extras.size()==0) {
List<ItemStack> itemslist = new ArrayList<ItemStack>(); List<ItemStack> itemslist = new ArrayList<ItemStack>();