# ModContainerHelper

`com.jsmacrosce.jsmacros.api.helper.ModContainerHelper`

**Since:** 1.8.4

A loaded mod's metadata exposed to scripts. Obtain wrappers from
[getMod()](../../../../../../libraries/com/jsmacrosce/jsmacros/client/api/library/impl/FClient.md#com.jsmacrosce.jsmacros.client.api.library.impl.FClient_getMod-String-)
for a single mod, or from
[getLoadedMods()](../../../../../../libraries/com/jsmacrosce/jsmacros/client/api/library/impl/FClient.md#com.jsmacrosce.jsmacros.client.api.library.impl.FClient_getLoadedMods-).  
Values come from loader metadata; use [getId()](#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getId-) to identify a mod rather than
its display name. Loader differences include [getAuthors()](#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getAuthors-) returning `null` and
[getEnv()](#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getEnv-) returning `"UNKNOWN"`.  
```js
// List loaded mods and their ids and versions
const mods = Client.getLoadedMods();  
let i = 0;  
while (i !== mods.size()) {
  Chat.log(`${mods.get(i).getId()} ${mods.get(i).getVersion()}`);  
  i += 1;  
}

// Look up a mod by id
const sodium = Client.getMod("sodium");  
if (sodium !== null) {
  Chat.log(sodium.getName());  
}
```

## Type Parameters

- `T`: the loader-specific mod container wrapped by this helper

## Methods

### getAuthors {#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getAuthors-}

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

Returns the author names from metadata on Fabric; NeoForge returns `null`.

**Returns:** a list of all authors, or `null` on NeoForge where it is not reported

**Since:** 1.8.4

### getDependencies {#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getDependencies-}

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

Returns ids from the mod's declared dependency metadata, including non-required entries
exposed by the loader; this is not a list of resolved required mods.

**Returns:** a list of all dependencies.

**Since:** 1.8.4

### getDescription {#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getDescription-}

```js
getDescription(): String
```

Returns the mod's description from loader metadata.

**Returns:** the mod's description.

**Since:** 1.8.4

### getEnv {#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getEnv-}

```js
getEnv(): String
```

Returns the mod's declared environment: `"CLIENT"`, `"SERVER"`, or
`"BOTH"`; NeoForge may also return `"UNKNOWN"` for an absent or unrecognized
side value.

**Returns:** the environment this mod is intended for.

**Since:** 1.8.4

### getId {#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getId-}

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

Returns the mod's loader-defined id (for example, `"sodium"`), used to look it up with
[getMod()](../../../../../../libraries/com/jsmacrosce/jsmacros/client/api/library/impl/FClient.md#com.jsmacrosce.jsmacros.client.api.library.impl.FClient_getMod-String-).

**Returns:** the loader-defined id used by `Client.getMod(id)`

**Since:** 1.8.4

### getName {#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getName-}

```js
getName(): String
```

Returns the mod's display name; it need not match [getId()](#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getId-).

**Returns:** the mod's name.

**Since:** 1.8.4

### getVersion {#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getVersion-}

```js
getVersion(): String
```

Returns the mod's loader-reported version string; its format is loader- and mod-defined.

**Returns:** the mod's version.

**Since:** 1.8.4

### toString {#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_toString-}

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

Returns a diagnostic label containing the values from [getId()](#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getId-), [getName()](#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getName-),  
and [getVersion()](#com.jsmacrosce.jsmacros.api.helper.ModContainerHelper_getVersion-) at call time. The values are inserted with `%s` formatting
and are not JSON-escaped.

**Returns:** a label with the mod id, name, and version
