Custom Dimensions Sample
This sample demonstrates how to create and manage custom dimensions using the Minecraft Bedrock Script API. It registers three custom dimensions, builds procedural platforms inside them, and provides a player-facing travel menu. One of the dimensions hosts an endless runner mini-game with auto-generated terrain and zombie pursuers.
What's Inside
Custom Dimensions
| Dimension | Description |
|---|---|
Void Arena (custom_dim:void_arena) |
A crimson nylium platform floating in the void with a placed structure. |
Sky Lounge (custom_dim:sky_lounge) |
A quartz platform at y=100 with glowstone corner lighting. |
Endless Runner (custom_dim:endless_runner) |
A narrow deepslate ledge that extends as you run. Zombies spawn behind you! |
Key Features
- Dimension registration via
system.beforeEvents.startupanddimensionRegistry.registerCustomDimension() - Procedural platform building with
BlockPermutationandfillBlocks() - Ticking area management to ensure chunks are loaded before placing blocks or teleporting players
- Structure placement using
world.structureManager.place() - Custom command
/custom_dim:dimensionsto open the travel menu (no cheats required) - Action form UI (
ActionFormData) for dimension selection - Endless runner game loop using
system.runInterval()with dynamic ledge generation, zombie spawning with speed effects, and automatic cleanup
Endless Runner
When a player teleports to the Endless Runner dimension:
- A small starting platform is built and the first ledge segment extends forward (+Z direction)
- The player receives Speed II to keep things fast-paced
- A game loop runs 4 times per second and:
- Extends the 3-wide ledge by 30 blocks when the player approaches the frontier
- Adds glass rails and glowstone lighting along the path
- Spawns a Speed II zombie behind the player every ~4 seconds
- Cleans up zombies that fall into the void
- Detects if the player falls off the path (game over)
- Everything is cleaned up automatically when the player leaves the dimension
Prerequisites
Node.js
Visit https://nodejs.org/ and install the LTS version.
Visual Studio Code
Visit the Visual Studio Code website and install Visual Studio Code.
Getting Started
Clone or download this project.
Install dependencies:
npm iOpen the project in Visual Studio Code:
code .Build and deploy to Minecraft using the build task or:
npm run local-deployFor watch mode (auto-recompile on save):
npm run local-deploy -- --watchIn Minecraft, create a new world:
- Select Creative game mode
- Select a Flat world under the Advanced section
- Under Behavior Packs, activate the Custom Dimensions pack
- Create the world
In game, run
/custom_dim:dimensionsto open the dimension travel menu and pick a destination.
Project Structure
| Path | Description |
|---|---|
scripts/main.ts |
All game logic — dimension registration, platform building, travel menu, and endless runner |
behavior_packs/creator_customdi/manifest.json |
Behavior pack manifest with Script API dependencies |
behavior_packs/creator_customdi/structures/turn.mcstructure |
Pre-built structure placed in the Void Arena |
resource_packs/creator_customdi/manifest.json |
Resource pack manifest |