Package mods.railcraft.common.util.inventory.manipulators

Examples of mods.railcraft.common.util.inventory.manipulators.InventoryManipulator


     * @param dest
     * @param filter an IStackFilter to match against
     * @return null if nothing was moved, the stack moved otherwise
     */
    public static ItemStack moveOneItem(IInventory source, IInventory dest, IStackFilter filter) {
        InventoryManipulator imSource = InventoryManipulator.get(source);
        return imSource.moveItem(dest, filter);
    }
View Full Code Here


     * @param dest  The destination IInventory.
     * @return Null if itemStack was completely moved, a new itemStack with
     *         remaining stackSize if part or none of the stack was moved.
     */
    public static ItemStack moveItemStack(ItemStack stack, IInventory dest) {
        InventoryManipulator im = InventoryManipulator.get(dest);
        return im.addStack(stack);
    }
View Full Code Here

     * @return true if room for stack
     */
    public static boolean isRoomForStack(ItemStack stack, IInventory dest) {
        if (stack == null || dest == null)
            return false;
        InventoryManipulator im = InventoryManipulator.get(dest);
        return im.canAddStack(stack);
    }
View Full Code Here

     * @param inv    The inventory
     * @param filter EnumItemType to match against
     * @return An ItemStack
     */
    public static ItemStack removeOneItem(IInventory inv, IStackFilter filter) {
        InventoryManipulator im = InventoryManipulator.get(inv);
        return im.removeItem(filter);
    }
View Full Code Here

     * @param filter
     * @return true if there are enough items that can be removed, false
     *         otherwise.
     */
    public static boolean removeItemsAbsolute(IInventory inv, int amount, IStackFilter filter) {
        InventoryManipulator im = InventoryManipulator.get(inv);
        if (im.canRemoveItems(filter, amount)) {
            im.removeItems(filter, amount);
            return true;
        }
        return false;
    }
View Full Code Here

                condense(metal);
            }
    }

    private void condense(Metal metal) {
        InventoryManipulator im = InventoryManipulator.get(this);
        if (metal.getIngot() != null && im.canRemoveItems(metal.nuggetFilter, 9) && im.canAddStack(metal.getIngot())) {
            im.removeItems(metal.nuggetFilter, 9);
            InvTools.moveItemStack(metal.getIngot(), this);
        }
        if (metal.getBlock() != null && im.canRemoveItems(metal.ingotFilter, 9) && im.canAddStack(metal.getBlock())) {
            im.removeItems(metal.ingotFilter, 9);
            InvTools.moveItemStack(metal.getBlock(), this);
        }
    }
View Full Code Here

TOP

Related Classes of mods.railcraft.common.util.inventory.manipulators.InventoryManipulator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.