# JsMacros

`com.jsmacrosce.jsmacros.client.JsMacros`

Shared bootstrap constants, loader access, and integer-array utilities.  
Class initialization requests `ConfigFolder` and `ModLoader` service providers;  
at least one provider of each must be available.  
```js
const JsMacros = Java.type('com.jsmacrosce.jsmacros.client.JsMacros');  
const values = JsMacros.range(3);  
Chat.log(values[2]);  
```

## Constructors

### new JsMacros {#com.jsmacrosce.jsmacros.client.JsMacros_constructor-}

```js
new JsMacros()
```

## Fields

### LOGGER {#com.jsmacrosce.jsmacros.client.JsMacros_LOGGER}

```js
static LOGGER: Logger
```

Logger named with `MOD_ID`.

### MOD_ID {#com.jsmacrosce.jsmacros.client.JsMacros_MOD_ID}

```js
static MOD_ID: String
```

The mod identifier `jsmacrosce`.

## Methods

### getModLoader {#com.jsmacrosce.jsmacros.client.JsMacros_getModLoader-}

```js
static getModLoader(): ModLoader
```

Returns the first `ModLoader` service provider selected during class initialization.

**Returns:** the selected loader

### onInitialize {#com.jsmacrosce.jsmacros.client.JsMacros_onInitialize-}

```js
static onInitialize(): void
```

Common initialization hook; currently performs no initialization.

### range {#com.jsmacrosce.jsmacros.client.JsMacros_range-int-}

```js
static range(int end): int[]
```

Returns consecutive integers from zero up to, but not including, `end`. The array length is `end`.

**Parameters:**
- `end`: exclusive upper bound; must be nonnegative and representable as an array length

**Returns:** the consecutive values from zero to `end - 1`

### range {#com.jsmacrosce.jsmacros.client.JsMacros_range-int-int-}

```js
static range(int start, int end): int[]
```

Returns consecutive integers from `start` up to, but not including, `end`. The array length is `end - start`, which must be nonnegative and representable as an array length.

**Parameters:**
- `start`: inclusive first value
- `end`: exclusive upper bound, at least `start`

**Returns:** the consecutive values from `start` to `end - 1`

### range {#com.jsmacrosce.jsmacros.client.JsMacros_range-int-int-int-}

```js
static range(int start, int end, int iter): int[]
```

Allocates an array of length `end - start`; values reached by repeatedly adding `iter` from `start` are stored at their offset from `start`. Unvisited offsets remain zero; for example, `range(2, 7, 2)` returns `[2, 0, 4, 0, 6]`. A positive step advances toward `end` only if integer addition does not overflow; zero does not advance and the loop does not terminate when `start < end`, and a negative step is not a descending-range mode. The difference must produce a nonnegative array length; integer overflow and invalid steps are not checked.

**Parameters:**
- `start`: inclusive first value
- `end`: exclusive upper bound
- `iter`: step added after each value; use a positive step that does not overflow when added to advance toward `end`

**Returns:** the allocated array with reached values at their corresponding offsets
