Package de.eydamos.backpack.saves

Examples of de.eydamos.backpack.saves.BackpackSave


    @Override
    public void onCraftMatrixChanged(IInventory changedInventory) {
        if(changedInventory == inventory) {
            inventoryPickup.setInventoryContent(inventory.getStackInSlot(0));
        } else if(changedInventory == inventoryPickup) {
            inventoryPickup.writeToNBT(new BackpackSave(inventory.getStackInSlot(0)));
        }
        super.onCraftMatrixChanged(changedInventory);
    }
View Full Code Here


    @SubscribeEvent
    public void itemCrafted(ItemCraftedEvent event) {
        ItemStack craftedItem = event.crafting;
        if(craftedItem != null && craftedItem.getItem() == ItemsBackpack.workbenchBackpack) {
            if(NBTItemStackUtil.hasTag(craftedItem, Constants.NBT.INTELLIGENT)) {
                BackpackSave backpackSave = new BackpackSave(craftedItem);
                backpackSave.setIntelligent();
                NBTItemStackUtil.removeTag(craftedItem, Constants.NBT.INTELLIGENT);
            }
        }
    }
View Full Code Here

    @Override
    @SideOnly(Side.CLIENT)
    public void addInformation(ItemStack itemStack, EntityPlayer entityPlayer, List information, boolean advancedTooltip) {
        super.addInformation(itemStack, entityPlayer, information, advancedTooltip);
        BackpackSave backpackSave = new BackpackSave(itemStack);
        if(backpackSave.isIntelligent()) {
            information.add(StatCollector.translateToLocal(Localizations.INTELLIGENT));
        }
    }
View Full Code Here

            return itemStack;
        }

        // when the player is not sneaking
        if(!entityPlayer.isSneaking() && !ConfigurationBackpack.OPEN_ONLY_PERSONAL_BACKPACK) {
            GuiHelper.displayBackpack(new BackpackSave(itemStack), getInventory(itemStack, entityPlayer), (EntityPlayerMP) entityPlayer);
        }
        return itemStack;
    }
View Full Code Here

        return false;
    }

    @Override
    public void onCreated(ItemStack itemStack, World world, EntityPlayer entityPlayer) {
        new BackpackSave(itemStack, true);
    }
View Full Code Here

                        EnumChatFormatting.YELLOW +
                        StatCollector.translateToLocal(Localizations.TIER) +
                        " " +
                        (itemStack.getItemDamage() / 100 + 1)
                );
                BackpackSave backpackSave = new BackpackSave(itemStack);
                NBTTagList itemList = backpackSave.getInventory(Constants.NBT.INVENTORY_BACKPACK);
                int used = itemList.tagCount();
                int size = backpackSave.getSize();
                information.add(used + "/" + size + ' ' + StatCollector.translateToLocal(Localizations.SLOTS_USED));
            }
        } else {
            information.add(StatCollector.translateToLocal(Localizations.MORE_INFORMATION));
        }
View Full Code Here

        switch(message.guiToOpen) {
            case Constants.Guis.OPEN_PERSONAL_BACKPACK:
                PlayerSave playerSave = new PlayerSave(entityPlayer);
                ItemStack backpack = playerSave.getPersonalBackpack();
                if(backpack != null) {
                    BackpackSave backpackSave = new BackpackSave(backpack);
                    playerSave.setPersonalBackpackOpen(backpackSave.getUUID());
                    GuiHelper.displayBackpack(backpackSave, ItemBackpackBase.getInventory(backpack, entityPlayer), entityPlayer);
                }
                break;
            case Constants.Guis.OPEN_PERSONAL_SLOT:
                GuiHelper.displayPersonalSlot(entityPlayer);
View Full Code Here

        NBTUtil.setString(nbtTagCompound, Constants.NBT.UID, message.uuid);
        NBTUtil.setByte(nbtTagCompound, Constants.NBT.TYPE, message.type);
        NBTUtil.setInteger(nbtTagCompound, Constants.NBT.SLOTS_PER_ROW, message.slotsPerRow);
        NBTUtil.setBoolean(nbtTagCompound, Constants.NBT.INTELLIGENT, message.intelligent);

        BackpackSave backpackSave = new BackpackSave(nbtTagCompound);

        Minecraft.getMinecraft().displayGuiScreen(FactoryBackpack.getGuiContainer(backpackSave, new IInventory[] { entityPlayer.inventory, backpackInventory }, entityPlayer));
        entityPlayer.openContainer.windowId = message.windowId;

        return null;
View Full Code Here

        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

    public void setInventoryContent(ItemStack backpack) {
        if(backpack == null) {
            inventoryContent = new ItemStack[9];
            changeable = false;
        } else {
            readFromNBT(new BackpackSave(backpack));
            changeable = true;
        }
    }
View Full Code Here

TOP

Related Classes of de.eydamos.backpack.saves.BackpackSave

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.