Posted January 24, 20187 yr I'm having the following problem, i'm trying to create a Witchery like cauldron and i need to check wether multiple Items (saved in a list) are contained in another list. List<ItemStack> items = new ArrayList<ItemStack>(); for (int i = 0; i < tile.getInventory().getSlots(); i++){ if (tile.getItem().getStackInSlot(i) != new ItemStack(Items.AIR)){ items.add(tile.getItem().getStackInSlot(i)); } } if (items.containsAll(recipe.catalysator)) { // TODO } The recipe.catalysator is a list that contains one item and the same item is also in the inventory.
January 24, 20187 yr 9 minutes ago, BrainFace said: List<ItemStack> items = new ArrayList<ItemStack>(); for (int i = 0; i < tile.getInventory().getSlots(); i++){ if (tile.getItem().getStackInSlot(i) != new ItemStack(Items.AIR)){ items.add(tile.getItem().getStackInSlot(i)); } } if (items.containsAll(recipe.catalysator)) { // TODO } List<ItemStack> items = new ArrayList<ItemStack>(); for (int i = 0; i < tile.getInventory().getSlots(); i++){ if (!tile.getItem().getStackInSlot(i).isEmpty()){ items.add(tile.getItem().getStackInSlot(i)); } } if (items.containsAll(recipe.catalysator)) { // TODO }
January 24, 20187 yr 14 minutes ago, BrainFace said: I'm having the following problem, i'm trying to create a Witchery like cauldron and i need to check wether multiple Items (saved in a list) are contained in another list. List<ItemStack> items = new ArrayList<ItemStack>(); for (int i = 0; i < tile.getInventory().getSlots(); i++){ if (tile.getItem().getStackInSlot(i) != new ItemStack(Items.AIR)){ items.add(tile.getItem().getStackInSlot(i)); } } if (items.containsAll(recipe.catalysator)) { // TODO } The recipe.catalysator is a list that contains one item and the same item is also in the inventory. List<ItemStack> items = new ArrayList<ItemStack>(); for (int i = 0; i < tile.getInventory().getSlots(); ++i) { if (!tile.getItem().getStackInSlot(i).isEmpty()) { items.add(tile.getItem().getStackInSlot(i)); } } if (items.containsAll(recipe.catalysator)) { } Edited January 24, 20187 yr by Differentiation
January 24, 20187 yr 1 minute ago, loordgek said: @Differentiation that code block is a bit hard to read Purge the page (reload)
January 24, 20187 yr Author So i tried this change and my inventory list doesnt contain air anymore but it still doesnt work.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.