# DimensionChange

`com.jsmacrosce.jsmacros.client.api.event.impl.world.EventDimensionChange`

**Since:** 1.2.7

**Cancellable:** No. Calling `event.cancel()` throws `UnsupportedOperationException`.

Fires when the client begins setting a non-null world, such as when joining or changing
 dimensions. It does not fire when leaving a world; use
 [Disconnect](EventDisconnect.md) instead.  
 ```js
JsMacros.on("DimensionChange", JavaWrapper.methodToJava(function (event) {
  Chat.log(`Dimension changed to ${event.dimension}`);  
}))
 ```

## Constructors

### new EventDimensionChange {#com.jsmacrosce.jsmacros.client.api.event.impl.world.EventDimensionChange_constructor-String-}

```js
new EventDimensionChange(String dimension)
```

Stores the supplied dimension label in this event without validating or normalizing it.

**Parameters:**
- `dimension`: dimension identifier label, conventionally in `namespace:path` form;  
                  may be `null` or any string

## Fields

### dimension {#com.jsmacrosce.jsmacros.client.api.event.impl.world.EventDimensionChange_dimension}

```js
dimension: String
```

The new world's dimension ID in `namespace:path` form; script type definitions narrow
 this value to a `Dimension` union.

## Methods

### toString {#com.jsmacrosce.jsmacros.client.api.event.impl.world.EventDimensionChange_toString-}

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

Returns a diagnostic representation containing the event name and stored dimension label.  
 The label is quoted but not escaped, so this is not guaranteed to be valid JSON; a null
 label appears as the quoted text `"null"`.

**Returns:** the event name followed by `:{"dimension": "label"}`, with the stored
         label substituted verbatim
