Skip to main content

Overview

The CreatorTools class (also exported as CreatorToolsHost) is the central application class that manages projects, storage, Minecraft connections, and overall application state for Minecraft Creator Tools.

Constructor

Creates a new CreatorTools instance with the required storage backends.
settingsStorage
IStorage
required
Storage backend for application preferences and settings
projectsStorage
IStorage
required
Storage backend for project data
deploymentsStorage
IStorage[]
required
Array of storage backends for deployment targets (Bedrock, Education, etc.)
worldStorage
IStorage | null
required
Storage backend for Minecraft worlds, or null if not available
packStorage
IStorage | null
required
Storage backend for behavior/resource packs, or null if not available
workingStorage
IStorage | null
required
Storage backend for temporary working files, or null if not available
contentRoot
string | null
required
Root path for application content and assets
import { CreatorTools } from '@minecraft/creator-tools';

const creatorTools = new CreatorTools(
  prefsStorage,
  projectsStorage,
  [bedrockStorage, educationStorage],
  worldStorage,
  packStorage,
  workingStorage,
  '/content'
);

Properties

projects

projects
Project[]
Array of all loaded projects in the application

status

status
IStatus[]
Array of status messages and operations from the application

activeOperations

activeOperations
IStatus[]
Array of currently running operations

creator

creator
string | undefined
The default creator/author name for new projects

formatBeforeSave

formatBeforeSave
boolean
default:"true"
Whether to automatically format JSON files before saving

preferredTextSize

preferredTextSize
number
default:"16"
Preferred text size for the UI in pixels

editPreference

editPreference
CreatorToolsEditPreference | undefined
Default edit preference (raw JSON vs. visual editors)

track

track
MinecraftTrack | undefined
Minecraft release track (main, preview, beta, etc.)

defaultDeploymentTargetType

defaultDeploymentTargetType
DeploymentTargetType
Default deployment target (Bedrock, Education, etc.)

Methods

load

Loads application settings and project list from storage.
force
boolean
default:"false"
Force reload even if already loaded
await creatorTools.load();

save

Saves application settings to storage.
await creatorTools.save();

createNewProject

Creates a new project with the specified configuration.
newProjectName
string
required
Name for the new project
newProjectPath
string | undefined
Local file system path for the project
newProjectFolder
IFolder | undefined
Folder object for the project
newProjectFolderTitle
string | undefined
Display title for the project folder
focus
ProjectFocus
required
Project focus type (general, world, gameplay, etc.)
includeDefaultItems
boolean
required
Whether to include default starter files
projectLanguage
ProjectScriptLanguage
Preferred scripting language (TypeScript or JavaScript)
return
Promise<Project>
The newly created project
const project = await creatorTools.createNewProject(
  'My Add-on',
  undefined,
  undefined,
  undefined,
  ProjectFocus.general,
  true,
  ProjectScriptLanguage.typeScript
);

createProjectFromFolder

Creates a project from an existing folder.
folder
IFolder
required
Folder containing the project files
return
Promise<Project>
The created project
const project = await creatorTools.createProjectFromFolder(myFolder);

getProjectByName

Retrieves a project by its name.
projectName
string
required
Name of the project to find
return
Project | undefined
The project, or undefined if not found
const project = creatorTools.getProjectByName('My Add-on');

deleteProjectByName

Deletes a project and all its files.
projectName
string
required
Name of the project to delete
await creatorTools.deleteProjectByName('Old Project');

notifyStatusUpdate

Adds a status message to the application log.
message
string
required
The status message
topic
StatusTopic
Topic category for the message
await creatorTools.notifyStatusUpdate(
  'Project saved successfully',
  StatusTopic.general
);

notifyOperationStarted

Notifies that a long-running operation has started.
message
string
required
Description of the operation
topic
StatusTopic
Topic category for the operation
return
Promise<number>
Operation ID for tracking
const opId = await creatorTools.notifyOperationStarted(
  'Building project...',
  StatusTopic.projectBuild
);

notifyOperationEnded

Notifies that a long-running operation has completed.
operationId
number
required
ID returned from notifyOperationStarted
message
string
Completion message
topic
StatusTopic
Topic category
endedWithErrors
boolean
Whether the operation failed
await creatorTools.notifyOperationEnded(
  opId,
  'Build completed',
  StatusTopic.projectBuild,
  false
);

runCommand

Executes a command in the application context.
command
string
required
The command to execute
project
Project
Project context for the command
await creatorTools.runCommand('/help', myProject);

loadGallery

Loads the gallery of sample projects and templates.
return
Promise<IGallery | undefined>
The loaded gallery data
const gallery = await creatorTools.loadGallery();

Events

onLoaded

Fired when the CreatorTools instance has loaded its configuration.
creatorTools.onLoaded.subscribe((ct) => {
  console.log('CreatorTools loaded');
});

onPropertyChanged

Fired when a property changes.
creatorTools.onPropertyChanged.subscribe((ct, propertyName) => {
  console.log(`Property changed: ${propertyName}`);
});

onStatusAdded

Fired when a new status message is added.
creatorTools.onStatusAdded.subscribe((ct, status) => {
  console.log(status.message);
});

onOperationCompleted

Fired when an operation completes.
creatorTools.onOperationCompleted.subscribe((ct, operationId) => {
  console.log(`Operation ${operationId} completed`);
});

Types

MinecraftTrack

enum MinecraftTrack {
  main = 0,
  preview = 1,
  beta = 2
}

DeploymentTargetType

enum DeploymentTargetType {
  bedrock = 0,
  education = 1,
  preview = 2
}

CreatorToolsEditPreference

enum CreatorToolsEditPreference {
  summarized = 0,
  raw = 1,
  editors = 2
}

See Also

Build docs developers (and LLMs) love