# NBTElementHelper.NBTNumberHelper

`com.jsmacrosce.jsmacros.client.api.helper.NBTElementHelper.NBTNumberHelper`

**Since:** 1.5.1

Wraps a numeric tag and provides conversions to primitive numeric types.  
 ```js
const player = Player.getPlayer();  
if (player !== null) {
  const nbt = player.getMainHand().getComponents().get("minecraft:damage");  
  if (nbt instanceof NBTHelpers.Number) {
    Chat.log(`as int ${nbt.asInt()}, as double ${nbt.asDouble()}`);  
  }
}
 ```

Available in scripts as `NBTHelpers.Number`.

Nested type declared in [NBTElementHelper](NBTElementHelper.md).

## Constructors

### new NBTElementHelper.NBTNumberHelper {#com.jsmacrosce.jsmacros.client.api.helper.NBTElementHelper.NBTNumberHelper_constructor-NumericTag-}

```js
new NBTElementHelper.NBTNumberHelper(NumericTag base)
```

Wraps the supplied numeric tag without copying it.

**Parameters:**
- `base`: the numeric tag to wrap

## Methods

### asByte {#com.jsmacrosce.jsmacros.client.api.helper.NBTElementHelper.NBTNumberHelper_asByte-}

```js
asByte(): byte
```

Returns this numeric tag converted to a `byte`.

**Returns:** the value converted to `byte`

**Since:** 1.5.1

### asDouble {#com.jsmacrosce.jsmacros.client.api.helper.NBTElementHelper.NBTNumberHelper_asDouble-}

```js
asDouble(): double
```

Returns this numeric tag converted to a `double`.

**Returns:** the value converted to `double`

**Since:** 1.5.1

### asFloat {#com.jsmacrosce.jsmacros.client.api.helper.NBTElementHelper.NBTNumberHelper_asFloat-}

```js
asFloat(): float
```

Returns this numeric tag converted to a `float`.

**Returns:** the value converted to `float`

**Since:** 1.5.1

### asInt {#com.jsmacrosce.jsmacros.client.api.helper.NBTElementHelper.NBTNumberHelper_asInt-}

```js
asInt(): int
```

Returns this numeric tag converted to an `int`.

**Returns:** the value converted to `int`

**Since:** 1.5.1

### asLong {#com.jsmacrosce.jsmacros.client.api.helper.NBTElementHelper.NBTNumberHelper_asLong-}

```js
asLong(): long
```

Returns this numeric tag converted to a `long`.

**Returns:** the value converted to `long`

**Since:** 1.5.1

### asNumber {#com.jsmacrosce.jsmacros.client.api.helper.NBTElementHelper.NBTNumberHelper_asNumber-}

```js
asNumber(): Number
```

Returns the boxed value in this tag's original numeric type.

**Returns:** the boxed numeric value in its original type

**Since:** 1.5.1

### asShort {#com.jsmacrosce.jsmacros.client.api.helper.NBTElementHelper.NBTNumberHelper_asShort-}

```js
asShort(): short
```

Returns this numeric tag converted to a `short`.

**Returns:** the value converted to `short`

**Since:** 1.5.1
