Package de.eydamos.backpack.saves

Examples of de.eydamos.backpack.saves.PlayerSave


    @Override
    public void onContainerClosed(EntityPlayer entityPlayer) {
        if(BackpackUtil.isServerSide(entityPlayer.worldObj)) {
            if(inventory instanceof ISaveableInventory) {
                ((ISaveableInventory) inventory).writeToNBT(new PlayerSave(entityPlayer));
            }
        }
        inventory.closeInventory();
        inventoryPickup.closeInventory();
    }
View Full Code Here


        if(ConfigurationBackpack.MAX_BACKPACK_AMOUNT > 0) {
            if(event.side == Side.SERVER) {
                EntityPlayerMP player = (EntityPlayerMP) event.player;

                int counter = 0;
                if(new PlayerSave(player).hasPersonalBackpack()) {
                    counter++;
                }

                ItemStack[] inventory = player.inventory.mainInventory;
                for(int i = 0; i < inventory.length; i++) {
View Full Code Here

    @SubscribeEvent
    public void playerDies(PlayerDropsEvent event) {
        EntityPlayer entityPlayer = event.entityPlayer;

        PlayerSave playerSave = new PlayerSave(entityPlayer);
        ItemStack backpack = playerSave.getPersonalBackpack();
        if(backpack != null) {
            event.drops.add(new EntityItem(entityPlayer.worldObj, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, backpack));
            playerSave.setPersonalBackpack(null);
        }
    }
View Full Code Here

    public boolean canInteractWith(EntityPlayer entityPlayer) {
        if(inventory instanceof InventoryEnderChest) {
            return true;
        }

        PlayerSave playerSave = new PlayerSave(entityPlayer);
        String UUID = null;
        if(playerSave.getPersonalBackpackOpen() != "") {
            UUID = playerSave.getPersonalBackpackOpen();
        } else if(entityPlayer.getCurrentEquippedItem() != null) {
            UUID = BackpackSave.getUUID(entityPlayer.getCurrentEquippedItem());
        }
        if(UUID == null || backpackSave == null) {
            return false;
View Full Code Here

        if(BackpackUtil.isServerSide(entityPlayer.worldObj) && backpackSave != null) {
            if(inventory instanceof ISaveableInventory) {
                ((ISaveableInventory) inventory).writeToNBT(backpackSave);
            }

            new PlayerSave(entityPlayer).unsetPersonalBackpackOpen();
        }
        if(inventory != null) {
            inventory.closeInventory();
        }
        super.onContainerClosed(entityPlayer);
View Full Code Here

            if(recipes instanceof ISaveableInventory) {
                ((ISaveableInventory) recipes).writeToNBT(backpackSave);
            }
            backpackSave.save();

            new PlayerSave(entityPlayer).unsetPersonalBackpackOpen();
        }
        if(inventory != null) {
            inventory.closeInventory();
        }
        super.onContainerClosed(entityPlayer);
View Full Code Here

        Container container = FactoryBackpack.getContainer(backpackSave, new IInventory[] { entityPlayer.inventory, inventory }, entityPlayer);
        openContainer(container, entityPlayer);
    }

    public static void displayPersonalSlot(EntityPlayerMP entityPlayer) {
        PlayerSave playerSave = new PlayerSave(entityPlayer);
        playerSave.setType((byte) -1);

        prepare(entityPlayer);

        MessageOpenPersonalSlot message = new MessageOpenPersonalSlot(entityPlayer.currentWindowId);
        Backpack.packetHandler.networkWrapper.sendTo(message, entityPlayer);
View Full Code Here

    @Override
    @SideOnly(Side.CLIENT)
    public IMessage onMessage(MessageOpenPersonalSlot message, MessageContext ctx) {
        EntityPlayer entityPlayer = Minecraft.getMinecraft().thePlayer;

        PlayerSave playerSave = new PlayerSave(entityPlayer);
        playerSave.setType((byte) -1);

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

        return null;
View Full Code Here

    @Override
    public IMessage onMessage(MessageOpenGui message, MessageContext ctx) {
        EntityPlayerMP entityPlayer = ctx.getServerHandler().playerEntity;
        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

    @Override
    public IMessage onMessage(MessagePersonalBackpack message, MessageContext ctx) {
        IMessage returnMessage = null;
        if(BackpackUtil.isServerSide()) {
            PlayerSave playerSave = new PlayerSave(message.playerUUID);
            ItemStack backpack = playerSave.getPersonalBackpack();
            if(backpack != null) {
                returnMessage = new MessagePersonalBackpack(message.playerUUID, backpack.getItemDamage());
            } else {
                returnMessage = new MessagePersonalBackpack(message.playerUUID);
            }
View Full Code Here

TOP

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

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.