# BundleContentsHelper

`com.jsmacrosce.jsmacros.client.api.helper.inventory.BundleContentsHelper`

**Since:** 2.3.0

Reads the contents, fullness, and current selection of a bundle.  
 ```js
const bundle = Player.getPlayer()?.getMainHand().getComponents().getBundleContents();  
if (bundle != null) {
  Chat.log(`Bundle is ${Math.round(bundle.getFullness() * 100)}% full`);  
  for (const stack of bundle.getItems()) Chat.log(stack.getItemId());  
}
 ```

## Methods

### getFullness {#com.jsmacrosce.jsmacros.client.api.helper.inventory.BundleContentsHelper_getFullness-}

```js
getFullness(): double
```

Returns how much capacity the contents use. Item stack limits and nested bundles affect this
 value. This throws if Minecraft cannot calculate the weight of invalid contents.

**Returns:** the fraction of capacity used, with 0 for empty and 1 for full; overfilled bundles can exceed 1

### getItems {#com.jsmacrosce.jsmacros.client.api.helper.inventory.BundleContentsHelper_getItems-}

```js
getItems(): List<ItemStackHelper>
```

Returns copies of the bundle's stacks in the order stored by Minecraft.

**Returns:** the stored stacks

### getSelectedIndex {#com.jsmacrosce.jsmacros.client.api.helper.inventory.BundleContentsHelper_getSelectedIndex-}

```js
getSelectedIndex(): int
```

Returns the selection stored on this bundle, used when taking an item out.

**Returns:** the zero-based index into [getItems()](#com.jsmacrosce.jsmacros.client.api.helper.inventory.BundleContentsHelper_getItems-), or -1 if no item is selected
