# ItemStackHelper

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

A script-facing view of an item stack, including its count and components. Use
[RegistryHelper.getItemStack(String)](../../classes/RegistryHelper.md#com.jsmacrosce.jsmacros.client.api.classes.RegistryHelper_getItemStack-String-) to obtain
one from the registry, or get one from an entity with
[LivingEntityHelper.getMainHand()](../world/entity/LivingEntityHelper.md#com.jsmacrosce.jsmacros.client.api.helper.world.entity.LivingEntityHelper_getMainHand-).  
[getCreative()](#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getCreative-) exposes setters that modify this same stack; use [copy()](#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_copy-) first to
preserve the original.  
```js
// a stack, and the things worth knowing about it
const stack = Client.getRegistryManager().getItemStack("minecraft:diamond_sword", `[{id:"minecraft:sharpness",lvl:5}]`);  
Chat.log(`${stack.getCount()} of ${stack.getName().getString()}`);  
Chat.log(`${stack.getItemId()}, ${stack.getDurability()} of ${stack.getMaxDurability()} durability`);  

// the enchantments on it, with their levels
for (const ench of stack.getEnchantments()) {
  Chat.log(ench.getRomanLevelName().getString());  
}

// and the two ways of asking whether two stacks match
const fresh = Client.getRegistryManager().getItemStack("minecraft:diamond_sword");  
Chat.log(`same item: ${stack.isItemEqual(fresh)}`);  
Chat.log(`same everything: ${stack.isNBTEqual(fresh)}`);  
```

## Constructors

### new ItemStackHelper {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_constructor-String-int-}

```js
new ItemStackHelper(String id, int count)
```

Wraps a newly constructed stack for the item registry entry identified by `id`.

**Parameters:**
- `id`: item identifier; if it has no namespace, `minecraft` is used
- `count`: requested stack count passed to the native stack constructor

### new ItemStackHelper {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_constructor-ItemStack-}

```js
new ItemStackHelper(ItemStack i)
```

Wraps the supplied stack reference without copying it.

**Parameters:**
- `i`: stack to wrap

## Methods

### areEnchantmentsHidden {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_areEnchantmentsHidden-}

```js
areEnchantmentsHidden(): boolean
```

Returns whether the enchantments component is marked hidden in this stack's tooltip display.

**Returns:** `true` if enchantments are hidden, `false` otherwise.

**Since:** 1.8.4

### areModifiersHidden {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_areModifiersHidden-}

```js
areModifiersHidden(): boolean
```

Returns whether the attribute modifiers component is marked hidden in this stack's tooltip display.

**Returns:** `true` if modifiers are hidden, `false` otherwise.

**Since:** 1.8.4

### canBeApplied {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_canBeApplied-EnchantmentHelper-}

```js
canBeApplied(EnchantmentHelper enchantment): boolean
```

Whether this enchantment supports this stack's item type and is compatible with all
enchantments already on it. Unlike [EnchantmentHelper.canBeApplied(ItemHelper)](EnchantmentHelper.md#com.jsmacrosce.jsmacros.client.api.helper.inventory.EnchantmentHelper_canBeApplied-ItemHelper-), this
checks the stack's current enchantments too.  
```js
// whether an enchantment still fits on a stack that already has things on it
const reg = Client.getRegistryManager();  
const stack = reg.getItemStack("minecraft:diamond_sword", `[{id:"minecraft:sharpness",lvl:5}]`);  
const unbreaking = reg.getEnchantment("minecraft:unbreaking");  
const looting = reg.getEnchantment("minecraft:looting");  
Chat.log(`unbreaking fits: ${unbreaking.canBeApplied(stack)}`);  
Chat.log(`looting fits: ${looting.canBeApplied(stack)}`);  
```

**Parameters:**
- `enchantment`: the enchantment to check

**Returns:** `true` if the specified enchantment can be applied to this item, `false`
otherwise.

**Since:** 1.8.4

### copy {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_copy-}

```js
copy(): ItemStackHelper
```

Returns an independent copy of this stack, including its count and components.

**Returns:** a copy of this stack, with everything on it.

**Since:** 1.2.0

### equals {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_equals-ItemStackHelper-}

```js
equals(ItemStackHelper ish): boolean
```

Compares item and components with another helper, ignoring count.

**Parameters:**
- `ish`: the other stack to compare against.

**Returns:** `true` if the two stacks have the same item and components, ignoring count

**Since:** 1.2.0

### equals {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_equals-ItemStack-}

```js
equals(ItemStack is): boolean
```

Compares item and components with a raw stack, ignoring count. A `null` raw stack
causes a null-pointer exception.

**Parameters:**
- `is`: the raw stack to compare against.

**Returns:** `true` if the two stacks have the same item and components, ignoring count

**Since:** 1.2.0

### equals {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_equals-Object-}

```js
equals(Object obj): boolean
```

Compares wrapped values when `obj` is a `BaseHelper`; otherwise compares the wrapped value directly with `obj`.  
 This delegates to the stored value's `equals` and throws [NullPointerException](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/NullPointerException.html) if that value is `null`.

**Parameters:**
- `obj`: object to compare

**Returns:** whether the delegated comparison reports equality

### getAttackDamage {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getAttackDamage-}

```js
getAttackDamage(): double
```

Computes this stack's main-hand attack damage using its attribute modifiers and the local
player's base attack-damage attribute value. Requires a local player.

**Returns:** the computed main-hand attack damage.

**Since:** 1.8.4

### getCooldownProgress {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getCooldownProgress-}

```js
getCooldownProgress(): float
```

Returns this stack's cooldown progress: `1` at the start, decreasing to `0` at
expiry; it is `0` when no cooldown exists. The result uses the current partial tick.  
Cooldowns are keyed by group, normally item identity but possibly overridden by the stack's
use-cooldown component.

**Returns:** the remaining cooldown fraction, from zero to one

**Since:** 1.6.5

### getCount {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getCount-}

```js
getCount(): int
```

Returns the number of items in this stack. It can exceed [getMaxCount()](#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getMaxCount-) when set
through [CreativeItemStackHelper.setCount(int)](CreativeItemStackHelper.md#com.jsmacrosce.jsmacros.client.api.helper.inventory.CreativeItemStackHelper_setCount-int-).

**Returns:** this stack's item count.

### getCreative {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getCreative-}

```js
getCreative(): CreativeItemStackHelper
```

Returns a mutable helper around the same stack, not a copy. Its setters mutate this stack;  
call [copy()](#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_copy-) first to preserve the original. This is a client-side stack operation,  
not a direct inventory or server update.

**Returns:** a [CreativeItemStackHelper](CreativeItemStackHelper.md) instance for this item.

**Since:** 1.8.4

### getCreativeTab {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getCreativeTab-}

```js
getCreativeTab(): List<TextHelper>
```

Returns the display names of creative tabs containing an item equal to this stack. Tabs
aligned to the right are excluded; an item in no included tab produces an empty list.

**Returns:** included creative-tab display names.

**Since:** 1.1.3

### getDamage {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getDamage-}

```js
getDamage(): int
```

The damage value stored on this stack.

**Returns:** the damage taken by this item.

**Since:** 1.8.4

### getDefaultName {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getDefaultName-}

```js
getDefaultName(): TextHelper
```

Returns the item's name, regardless of any custom name set on this stack.

**Returns:** the item's default name.

**Since:** 1.2.0

### getDestroyRestrictions {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getDestroyRestrictions-}

```js
getDestroyRestrictions(): List<BlockPredicateHelper>
```

Returns the block predicates in this stack's can-destroy restriction, or an empty list if
the component is absent. Predicates can include block, state, and block-entity NBT criteria.

**Returns:** a list of all filters set for the can destroy flag.

**Since:** 1.8.4

### getDurability {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getDurability-}

```js
getDurability(): int
```

The stack's effective maximum damage value minus the damage it has taken.

**Returns:** the current durability of this item.

**Since:** 1.8.4

### getEnchantment {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getEnchantment-String-}

```js
getEnchantment(String id): EnchantmentHelper
```

Returns the matching enchantment and its level, or `null` if the stack does not carry
it. Accepts a namespaced or unnamespaced id, or the enchantment's translated name.

**Parameters:**
- `id`: the id of the enchantment to check for

**Returns:** the enchantment instance, containing the level, or `null` if the item is not
enchanted with the specified enchantment.

**Since:** 1.8.4

### getEnchantments {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getEnchantments-}

```js
getEnchantments(): List<EnchantmentHelper>
```

Returns each enchantment on this stack with its level. No enchantments produces an empty
list; each call creates a new list.

**Returns:** a list of all enchantments on this item.

**Since:** 1.8.4

### getItem {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getItem-}

```js
getItem(): ItemHelper
```

Returns a helper for the item type, without this stack's count or components.

**Returns:** the item this stack is made of.

**Since:** 1.8.4

### getItemId {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getItemId-}

```js
getItemId(): String
```

Returns this item's full registry id.

**Returns:** the item's full registry id.

**Since:** 1.6.4

### getLore {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getLore-}

```js
getLore(): List<TextHelper>
```

Returns this stack's lore lines wrapped as text. An absent lore component produces an empty
list; changing the returned list does not change the stack. Use [getCreative()](#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getCreative-) to
edit the stack's lore.

**Returns:** a list of all lines of lore on this item.

**Since:** 1.8.4

### getMaxCount {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getMaxCount-}

```js
getMaxCount(): int
```

Returns the maximum stack size for this stack's item; the current count may exceed it.

**Returns:** the item's maximum stack size.

### getMaxDamage {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getMaxDamage-}

```js
getMaxDamage(): int
```

The maximum damage value for this stack; unlike [getMaxDurability()](#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getMaxDurability-), this comes from
the stack's item.

**Returns:** the maximum damage value for the stack's item.

**Since:** 1.8.4

### getMaxDurability {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getMaxDurability-}

```js
getMaxDurability(): int
```

The stack's effective maximum damage value.  
[getDamage()](#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getDamage-) is what this stack has already taken,  
and [getDurability()](#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getDurability-) is what is left of this number.  
```js
// the item's limit against what this stack has used
const stack = Client.getRegistryManager().getItemStack("minecraft:diamond_pickaxe").getCreative();  
stack.setDamage(1000);  
Chat.log(`${stack.getDamage()} of ${stack.getMaxDurability()}, ${stack.getDurability()} left`);  

// an item that cannot be damaged gives zero
Chat.log(Client.getRegistryManager().getItemStack("minecraft:stone").getMaxDurability());  
```

**Returns:** the maximum durability of this item.

**Since:** 1.8.4

### getName {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getName-}

```js
getName(): TextHelper
```

Returns the name shown for this stack, including any custom name.

**Returns:** the stack's displayed name.

**Since:** 1.2.0

### getNBT {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getNBT-}

```js
getNBT(): NBTElementHelper<?>
```

Returns this stack's component changes encoded as an NBT compound, or `null` when the
component patch is empty. The returned data uses Minecraft's component names.

**Returns:** the components on this stack, or `null` if it has none.

**Since:** 1.1.6

**Note:** was a [String](https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/String.html) until 1.5.1

### getPlaceRestrictions {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getPlaceRestrictions-}

```js
getPlaceRestrictions(): List<BlockPredicateHelper>
```

Returns the block predicates in this stack's can-place-on restriction, or an empty list if
the component is absent. Predicates can include block, state, and block-entity NBT criteria.

**Returns:** a list of all filters set for the can place on flag.

**Since:** 1.8.4

### getPossibleEnchantments {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getPossibleEnchantments-}

```js
getPossibleEnchantments(): List<EnchantmentHelper>
```

Enchantments in the registry whose item-type criteria accept this stack. Existing
enchantments and their compatibility are not considered.

**Returns:** a list of all enchantments that can be applied to this item.

**Since:** 1.8.4

### getPossibleEnchantmentsFromTable {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getPossibleEnchantmentsFromTable-}

```js
getPossibleEnchantmentsFromTable(): List<EnchantmentHelper>
```

The subset of [getPossibleEnchantments()](#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getPossibleEnchantments-) whose enchantments are in the game's
`IN_ENCHANTING_TABLE` tag and can be applied to this stack.  
```js
// what an enchanting table would offer for this item
const stack = Client.getRegistryManager().getItemStack("minecraft:diamond_sword");  
const fromTable = stack.getPossibleEnchantmentsFromTable();  
const all = stack.getPossibleEnchantments();  
Chat.log(`${fromTable.size()} from a table out of ${all.size()} in total`);  
for (const ench of fromTable) {
  Chat.log(`  ${ench.getId()}, treasure ${ench.isTreasure()}, cursed ${ench.isCursed()}`);  
}
```

**Returns:** a list of all enchantments that can be applied to this item through an enchanting table.

**Since:** 1.8.4

### getRepairCost {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getRepairCost-}

```js
getRepairCost(): int
```

The stack's repair-cost component, or `0` if it is absent. This is not necessarily
the experience-level cost of a particular repair operation.

**Returns:** the current repair cost of this item.

**Since:** 1.8.4

### getTags {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_getTags-}

```js
getTags(): List<String>
```

Returns the full registry ids of the tags containing this stack's item.

**Returns:** a list of the item tags this item is in.

**Since:** 1.8.2

### hasDestroyRestrictions {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_hasDestroyRestrictions-}

```js
hasDestroyRestrictions(): boolean
```

Returns whether this stack has a can-destroy restriction component.

**Returns:** `true` if the can destroy flag is set, `false` otherwise.

**Since:** 1.8.4

### hasEnchantment {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_hasEnchantment-EnchantmentHelper-}

```js
hasEnchantment(EnchantmentHelper enchantment): boolean
```

Whether this stack carries the given enchantment. A helper without a level matches any level;  
two helpers with levels match only when their levels are equal.  
```js
// the same enchantment, asked about at a level and without one
const reg = Client.getRegistryManager();  
const stack = reg.getItemStack("minecraft:diamond_sword", `[{id:"minecraft:sharpness",lvl:5}]`);  
const anyLevel = reg.getEnchantment("minecraft:sharpness");  
const levelFive = reg.getEnchantment("minecraft:sharpness", 5);  
const levelThree = reg.getEnchantment("minecraft:sharpness", 3);  
Chat.log(`any level: ${stack.hasEnchantment(anyLevel)}`);  
Chat.log(`level five: ${stack.hasEnchantment(levelFive)}`);  
Chat.log(`level three: ${stack.hasEnchantment(levelThree)}`);  
```

**Parameters:**
- `enchantment`: the enchantment to check for

**Returns:** `true` if the item is enchanted with the specified enchantment, `false`
otherwise.

**Since:** 1.8.4

### hasEnchantment {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_hasEnchantment-String-}

```js
hasEnchantment(String enchantment): boolean
```

Whether this stack carries the enchantment with the given id, regardless of its level.

**Parameters:**
- `enchantment`: the id of the enchantment to check for

**Returns:** `true` if the item is enchanted with the given enchantment, `false`
otherwise.

**Since:** 1.8.4

### hasPlaceRestrictions {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_hasPlaceRestrictions-}

```js
hasPlaceRestrictions(): boolean
```

Returns whether this stack has a can-place-on restriction component.

**Returns:** `true` if the can place on flag is set, `false` otherwise.

**Since:** 1.8.4

### isCanDestroyHidden {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isCanDestroyHidden-}

```js
isCanDestroyHidden(): boolean
```

Returns whether the can-destroy component is marked hidden in this stack's tooltip display,  
independently of whether that restriction component is present.

**Returns:** `true` if the can destroy flag is hidden, `false` otherwise.

**Since:** 1.8.4

### isCanPlaceHidden {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isCanPlaceHidden-}

```js
isCanPlaceHidden(): boolean
```

Returns whether the can-place-on component is marked hidden in this stack's tooltip display.

**Returns:** `true` if the component is marked hidden, or `false` if it is not or no tooltip display is set.

**Since:** 1.8.4

### isDamageable {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isDamageable-}

```js
isDamageable(): boolean
```

Whether this stack can take damage. Returns `false` if it is unbreakable or lacks any
of the max-damage and damage components.

**Returns:** `true` if this stack can take damage, `false` otherwise.

**Since:** 1.2.0

### isDyeHidden {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isDyeHidden-}

```js
isDyeHidden(): boolean
```

Returns whether the dyed-color component is marked hidden in this stack's tooltip display.

**Returns:** `true` if the component is marked hidden, or `false` if it is not or no tooltip display is set.

**Since:** 1.8.4

### isEmpty {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isEmpty-}

```js
isEmpty(): boolean
```

Returns whether this stack has no contents. Air stacks and stacks with a non-positive count
are empty.

**Returns:** `true` if this stack holds nothing, `false` otherwise.

### isEnchantable {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isEnchantable-}

```js
isEnchantable(): boolean
```

Whether this stack has the enchantable component and has no enchantments yet.

**Returns:** `true` if this item can be enchanted, `false` otherwise.

**Since:** 1.2.0

### isEnchanted {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isEnchanted-}

```js
isEnchanted(): boolean
```

Whether this stack has any enchantments, regardless of whether its item is enchantable.

**Returns:** `true` if the item is enchanted, `false` otherwise.

**Since:** 1.8.4

### isFood {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isFood-}

```js
isFood(): boolean
```

Returns whether this stack has a food component.

**Returns:** `true` if this item can be eaten, `false` otherwise.

**Since:** 1.8.2

### isItemEqual {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isItemEqual-ItemStackHelper-}

```js
isItemEqual(ItemStackHelper ish): boolean
```

Compares item identity and damage with another helper; other components are ignored.

**Parameters:**
- `ish`: the other stack to compare against.

**Returns:** `true` if the two stacks are the same item at the same damage.

**Since:** 1.2.0

### isItemEqual {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isItemEqual-ItemStack-}

```js
isItemEqual(ItemStack is): boolean
```

Compares item identity and damage with a raw stack; other components are ignored.

**Parameters:**
- `is`: the raw stack to compare against.

**Returns:** `true` if the two stacks are the same item at the same damage.

**Since:** 1.2.0

### isItemEqualIgnoreDamage {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isItemEqualIgnoreDamage-ItemStackHelper-}

```js
isItemEqualIgnoreDamage(ItemStackHelper ish): boolean
```

Compares item identity with another helper, ignoring damage and all components.

**Parameters:**
- `ish`: the other stack to compare against.

**Returns:** `true` if the two stacks are the same item, whatever else differs.

**Since:** 1.2.0

### isItemEqualIgnoreDamage {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isItemEqualIgnoreDamage-ItemStack-}

```js
isItemEqualIgnoreDamage(ItemStack is): boolean
```

Compares item identity with a raw stack, ignoring damage and all components.

**Parameters:**
- `is`: the raw stack to compare against.

**Returns:** `true` if the two stacks are the same item, whatever else differs.

**Since:** 1.2.0

### isNBTEqual {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isNBTEqual-ItemStackHelper-}

```js
isNBTEqual(ItemStackHelper ish): boolean
```

Compares component maps with another helper; item identity and count are not checked
separately, and the maps include item component defaults.  
```js
// count is ignored, but damage is part of the component state
const reg = Client.getRegistryManager();  
const sword = reg.getItemStack("minecraft:diamond_sword", `[{id:"minecraft:sharpness",lvl:5}]`);  
const sameItem = reg.getItemStack("minecraft:diamond_sword", `[{id:"minecraft:sharpness",lvl:5}]`)
  .getCreative().setCount(2);  
Chat.log(`same components: ${sword.isNBTEqual(sameItem)}`);  
const worn = sword.copy().getCreative().setDamage(1);  
Chat.log(`damage differs: ${sword.isNBTEqual(worn)}`);  

// and against a stack with something else on it
const named = sword.getCreative().setName("Excalibur");  
Chat.log(`after naming: ${sword.isNBTEqual(named)}`);  
```

**Parameters:**
- `ish`: the other stack to compare against.

**Returns:** `true` if the component maps are equal.

**Since:** 1.2.0

### isNBTEqual {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isNBTEqual-ItemStack-}

```js
isNBTEqual(ItemStack is): boolean
```

Compares component maps with a raw stack; item identity and count are not checked
separately, and the maps include item component defaults.

**Parameters:**
- `is`: the raw stack to compare against.

**Returns:** `true` if the component maps are equal.

**Since:** 1.2.0

### isOnCooldown {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isOnCooldown-}

```js
isOnCooldown(): boolean
```

Checks whether the local player's cooldown manager has a cooldown for this stack's cooldown group.

**Returns:** `true` if the item is on cooldown, `false` otherwise.

**Since:** 1.6.5

### isSuitableFor {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isSuitableFor-BlockHelper-}

```js
isSuitableFor(BlockHelper block): boolean
```

Checks whether this stack's tool component is correct for the block's default state.

**Parameters:**
- `block`: the block to check

**Returns:** `true` if the given block can be mined and drops when broken with this item,  
`false` otherwise.

**Since:** 1.8.4

### isSuitableFor {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isSuitableFor-BlockStateHelper-}

```js
isSuitableFor(BlockStateHelper block): boolean
```

Checks whether this stack's tool component is correct for the given block state.

**Parameters:**
- `block`: the block to check

**Returns:** `true` if the given block can be mined and drops when broken with this item,  
`false` otherwise.

**Since:** 1.8.4

### isTool {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isTool-}

```js
isTool(): boolean
```

Returns whether this stack has a tool component.

**Returns:** `true` if this item is a tool, `false` otherwise.

**Since:** 1.8.2

### isUnbreakable {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isUnbreakable-}

```js
isUnbreakable(): boolean
```

Whether this stack has the unbreakable component. This is distinct from
[isUnbreakableHidden()](#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isUnbreakableHidden-), which reports tooltip visibility.

**Returns:** `true` if this item is unbreakable, `false` otherwise.

**Since:** 1.8.4

### isUnbreakableHidden {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isUnbreakableHidden-}

```js
isUnbreakableHidden(): boolean
```

Returns whether the unbreakable component is marked hidden in this stack's tooltip display.

**Returns:** `true` if the unbreakable flag is hidden, `false` otherwise.

**Since:** 1.8.4

### isWearable {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_isWearable-}

```js
isWearable(): boolean
```

Returns whether this stack has an equippable component.

**Returns:** `true` if this item can be worn, `false` otherwise.

**Since:** 1.8.2

### toString {#com.jsmacrosce.jsmacros.client.api.helper.inventory.ItemStackHelper_toString-}

```js
toString(): String
```

Returns a diagnostic string containing this stack's item id, damage value, and count.

**Returns:** a formatted diagnostic representation of the stack
