# StatusEffectHelper

`com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper`

**Since:** 1.2.4

Describes a status-effect instance, including its type, amplifier, duration, and display flags.  
Amplifiers are zero-based (level I is 0); duration is in ticks, with `-1` indicating
infinite duration. Values are snapshots and do not count down after retrieval. Use an entity's
status-effect list for applied instances, or the registry to inspect an effect type.  
```js
const player = Player.getPlayer();  
if (player !== null) {
  for (const effect of player.getStatusEffects()) {
    // strength is the amplifier, so level II reads as 1
    const level = effect.getStrength() + 1;  
    // the duration is in ticks, and twenty of those is a second
    const remaining = effect.isPermanent() ? "infinite" : `${Math.ceil(effect.getTime() / 20)}s left`;  
    Chat.log(`${effect.getId()} ${effect.getCategory()} level ${level}, ${remaining}`);  
  }
}

// the registry knows about every effect, whether or not anyone has it
const registry = Client.getRegistryManager();  
const speed = registry.getStatusEffect("minecraft:speed");  
if (speed.isBeneficial()) {
  Chat.log(`speed is a beneficial effect, instant: ${speed.isInstant()}`);  
}
```

## Constructors

### new StatusEffectHelper {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_constructor-MobEffectInstance-}

```js
new StatusEffectHelper(MobEffectInstance s)
```

Wraps the supplied status-effect instance.

**Parameters:**
- `s`: raw status-effect instance to wrap

### new StatusEffectHelper {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_constructor-MobEffect-}

```js
new StatusEffectHelper(MobEffect s)
```

Wraps the status-effect type with zero duration.

**Parameters:**
- `s`: the status-effect type to wrap

**Since:** 1.8.4

### new StatusEffectHelper {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_constructor-MobEffect-int-}

```js
new StatusEffectHelper(MobEffect s, int t)
```

Wraps the status-effect type with the supplied duration.

**Parameters:**
- `s`: the status-effect type to wrap
- `t`: the initial duration in ticks, or `-1` for infinite duration

**Since:** 1.8.4

## Methods

### getCategory {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_getCategory-}

```js
getCategory(): String
```

Returns the effect category.

**Returns:** `"HARMFUL"`, `"NEUTRAL"`, or `"BENEFICIAL"`

**Since:** 1.8.4

### getId {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_getId-}

```js
getId(): String
```

Returns the effect's registry identifier.

**Returns:** the identifier

**Since:** 1.2.4

### getStrength {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_getStrength-}

```js
getStrength(): int
```

Returns the zero-based amplifier (level I is `0`).

**Returns:** the amplifier

**Since:** 1.2.4

### getTime {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_getTime-}

```js
getTime(): int
```

Returns the instance's remaining duration snapshot in ticks. Infinite duration is
`-1`; zero is an expired duration. Re-read the entity's effect to observe its
countdown.

**Returns:** remaining ticks, or `-1` for infinite duration

**Since:** 1.2.4

### hasIcon {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_hasIcon-}

```js
hasIcon(): boolean
```

Returns whether the effect display should show an icon.

**Returns:** `true` if the icon is shown; `false` otherwise

**Since:** 1.8.4

### isAmbient {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_isAmbient-}

```js
isAmbient(): boolean
```

Returns the instance's ambient flag. This is a display/state flag and does not reliably
identify how the effect was applied.

**Returns:** `true` if ambient; `false` otherwise

**Since:** 1.8.4

### isBeneficial {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_isBeneficial-}

```js
isBeneficial(): boolean
```

**Returns:** `true` if this effect is considered beneficial, `false` otherwise.

**Since:** 1.8.4

### isHarmful {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_isHarmful-}

```js
isHarmful(): boolean
```

**Returns:** `true` if this effect is considered harmful, `false` otherwise.

**Since:** 1.8.4

### isInstant {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_isInstant-}

```js
isInstant(): boolean
```

Reports whether this effect type applies its effect instantly; this is independent of the
instance's duration.

**Returns:** `true` if this effect should be applied instantly, `false` otherwise.

**Since:** 1.8.4

### isNeutral {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_isNeutral-}

```js
isNeutral(): boolean
```

**Returns:** `true` if this effect is considered neutral, `false` otherwise.

**Since:** 1.8.4

### isPermanent {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_isPermanent-}

```js
isPermanent(): boolean
```

Returns whether this instance has infinite duration.

**Returns:** `true` for infinite duration; `false` otherwise

**Since:** 1.8.4

### isVisible {#com.jsmacrosce.jsmacros.client.api.helper.StatusEffectHelper_isVisible-}

```js
isVisible(): boolean
```

**Returns:** `true` if this effect is shown in the game's effect display; `false` otherwise.

**Since:** 1.8.4

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

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

Returns a diagnostic string containing the effect identifier, strength, and duration.

**Returns:** diagnostic representation of the wrapped status-effect instance
