Package de.eydamos.backpack.inventory

Examples of de.eydamos.backpack.inventory.InventoryPickup


        if(BackpackUtil.isServerSide()) {
            inventorySlot = new InventoryBackpackSlot(player);
        } else {
            inventorySlot = new InventoryBasic(Localizations.INVENTORY_PERSONAL, false, 1);
        }
        InventoryPickup inventoryPickup = new InventoryPickup();
        ContainerAdvanced container = new ContainerPersonalSlot(inventorySlot, inventoryPickup);

        int maxWidth = 160;

        // set container width (needed for gui)
        container.setWidth(maxWidth + 2 * X_SPACING);

        int x = (int) Math.round(maxWidth / 2. - SLOT / 2.) + 1;
        int y = 17; // initial space for label

        container.addBoundary(Boundaries.BACKPACK);

        // backpack slot
        container.addSlot(new SlotBackpackOnly(inventorySlot, 0, x, y));

        container.addBoundary(Boundaries.BACKPACK_END);

        x = X_SPACING;
        y += 15 + SLOT;
        // pickup inventory
        for(int i = 0; i < inventoryPickup.getSizeInventory(); i++) {
            container.addSlot(new SlotPhantom(inventoryPickup, i, x, y));
            x += SLOT;
        }

        container.addBoundary(Boundaries.INVENTORY);
View Full Code Here


    public static void pickupItem(EntityPlayer entityPlayer, ItemStack itemStack) {
        PlayerSave playerSave = new PlayerSave(entityPlayer);
        ItemStack backpack = playerSave.getPersonalBackpack();
        if(backpack != null) {
            InventoryPickup inventoryPickup = new InventoryPickup();
            inventoryPickup.setInventoryContent(backpack);

            ContainerPickup container = new ContainerPickup(ItemBackpackBase.getInventory(backpack, entityPlayer), new BackpackSave(backpack));
            boolean hasPickedUp = false;
            for(int i = 0; i < inventoryPickup.getSizeInventory(); i++) {
                ItemStack pickupItemStack = inventoryPickup.getStackInSlot(i);
                if(areStacksEqual(pickupItemStack, itemStack, true)) {
                    hasPickedUp = container.pickupItem(itemStack) || hasPickedUp;
                }
            }
View Full Code Here

TOP

Related Classes of de.eydamos.backpack.inventory.InventoryPickup

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.