public static Inventory deserialize(byte[] bytes) {
        NbtTagCompound root = NbtFactory.toCompound(NbtSerializer.toTag(bytes));

        if (root.getInt(VERSION_KEY) != NBT_VERSION)
            throw new IllegalArgumentException("Incompatible NBT-version!");

        NbtTagList<NbtTagCompound> items = root.getList(ITEMS_KEY);
        Inventory inventory = Bukkit.getServer().createInventory(null, items.size());

        for (int i = 0; i < items.size(); i++) {
            NbtTagCompound compound = items.getValue(i);
            inventory.setItem(i, NbtFactory.loadItemStack(compound));
        }

        return inventory;
    }