Wiki 9Minecraft Wiki 9Minecraft

Bootstraps

Minecraft Legends

BSharpReferenceSheet
Official docs

Are a special classification of snippets that execute when the game starts in some way. They are special as they do not require a listener to be executed. Generally the snippet name is used as a listener rule instead.

There are 4 bootstrap snippets, taken from the documentation itself:

/**
 * Logic to perform when the server begins.
 * No listener required. All bootstrap snippets will fire at the beginning of a new game.
 */
declare function SNIPPET_Bootstrap(snippetName: string, callback: BootstrapCallback): void
declare type BootstrapCallback = () => void

/**
 * Logic to perform when the server begins.
 * No listener required. All bootstrap snippets will fire at the beginning of a new game.
 * This snippet runs at the start of EVERY game, even after save-load.
 */
declare function SNIPPET_GameLoadBootstrap(snippetName: string, callback: GameLoadBootstrapCallback): void
declare type GameLoadBootstrapCallback = (isSaveLoaded: boolean) => void

/**
 * Similiar to Bootstrap. The name of the snippet should match the rule that is being reacted to.
 * Passes along the value of the rule as a parameter.
 * No listener required. All rule initialized snippets will fire at the beginning of a new game.
 */
declare function SNIPPET_RuleInitialized(snippetName: string, callback: RuleInitializedCallback): void
declare type RuleInitializedCallback = (ruleValue: VariantData) => void

/**
 * Similiar to Bootstrap. The name of the snippet should match the game mode this is being reacted to.
 * No listener required. All rule initialized snippets will fire at the beginning of a new game.
 */
declare function SNIPPET_InheritsFromGameMode(snippetName: string, callback: RuleInitializedCallback): void
declare type RuleInitializedCallback = () => void

In general, this is when you would use this specific bootstrap:

  • SNIPPET_Bootstrap when you need shared “core” functionality between all game modes. In general this shouldn’t be used.
  • SNIPPET_InheritsFromGameMode when you need behaviour specific to a game mode. This should be your default go to.
  • SNIPPET_RuleInitialized when you want to enable modular behaviour defined by game-rules, the idea being it is functional across multiple game modes.
  • SNIPPET_GameLoadBootstrap used in special circumstances when you need to do something on game reload (from a save file). The intended use for this is for DLC islands, when we need to add content after a world has already been generated.