Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ If you don't, then the samples won't be visible to the `Minecraft Bedrock Previe
| Farm Generator | Adds a dialog that allows you to place a selection of randomized farms containing different combinations of crops and animals, as well as adding irrigation to help grow plants.<br><br>This extension demonstrates the use of UI components, block placement and mouse input.<br><br>**Notes**: Activate using CTRL+SHIFT+F or from the tool rail.<br>**Author**: Molly |
| Goto Mark | Adds a dialog that allows you to modify the players current position in the world by directly typing coordinates. In addition, you can set the players default spawn position (and jump to it at any time during editing).<br>The extension also allows you to set up to 9 custom world locations as named bookmarks, and jump to them at any time during editing.<br><br> This extension demonstrates dynamic UI component updates, text input, and persistent storage using entity dynamic properties.<br><br>**Notes**: No input required, activated from tool rail.<br>**Author**: Chloe, Eser & Dave |
| Portal Generator | Adds a dialog that allows you to place either Nether or End portals (in various states of completion).<br><br>This extension demonstrates dynamic UI component updates, and block placement.<br><br>**Notes**: Activated using CTRL+SHIFT+P or from tool rail.<br>**Author**: Andrew. |
| Simple Empty | Adds an extension which as a very basic set of barely functional components designed to demonstrate setting up a new Editor tool using the Simple Tool wrapper. The extension demonstrates how to set up the data definitions that will ultimately direct how the tool registers itself with the Editor, and sets up the visual layouts - ready for the creator to fill in the functionality.<br> **Author**: Dave |
| Simple Locate Biome | Adds an extension which demonstrates the use of sub-panes to group together UI controls, and uses the visibility of those sub-panes to create different views of data. The extension also demonstrates the use of the mutually exclusive visibility properties of sub-panes, and some use of the Biome API.<br> **Author**: Dave & Mitch |
| Tree Generator | Adds a dialog that allows you to place a selection of randomized trees of certain types wherever you click in the world.<br><br>This extension demonstrates the use of UI components, block placement and mouse input.<br><br>**Notes**: Activated using CTRL+SHIFT+T or through the tool rail.<br>**Author**: Jake || | |


Expand Down
14 changes: 11 additions & 3 deletions camera-grapple/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
##
## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a
## comment on the same line, use TABs.
sample.cameragrapple.title=Camera Base Grapple
sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor
sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection
sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000}
sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000}
sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000}
sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000}
5 changes: 3 additions & 2 deletions dye-brush/dye-brush.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) {
title: 'sample.dyeBrush.pane.title',
infoTooltip: { description: ['sample.dyebrush.tool.tooltip'] },
});
pane.beginConstruct();

const entityBrush = makeObservable(EntityColor.White);

Expand Down Expand Up @@ -311,6 +312,8 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) {
},
});

pane.endConstruct();

tool.bindPropertyPane(pane);

const onExecuteBrush = () => {
Expand Down Expand Up @@ -437,8 +440,6 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) {
}
uiSession.scratchStorage?.previewSelection?.clearVolume();
});

pane.hide();
}

export function addDyeBrushTool(uiSession: DyeBrushSession) {
Expand Down
14 changes: 12 additions & 2 deletions dye-brush/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
##
## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a
## comment on the same line, use TABs.
sample.dyebrush.tool.title=Dye Brush
sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000}
sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000}
sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000}
sample.dyebrush.tool.tooltip=Change the color of entity color components. The updated color is applied when entity simulation resumes.
sample.dyebrush.pane.colordropdown.title=Color
sample.dyebrush.pane.colordropdown.title=Color
sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000}
Binary file modified editor-samples.mceditoraddon
Binary file not shown.
13 changes: 12 additions & 1 deletion empty/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,15 @@
##
## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a
## comment on the same line, use TABs.
sample.empty.title=Empty Template
sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000}
sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000}
sample.empty.title=Empty Template
sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000}
sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000}
15 changes: 12 additions & 3 deletions farm-generator/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@
##
## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a
## comment on the same line, use TABs.
sample.farmgenerator.tool.title=Farm Generator
sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000}
sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000}
sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000}
sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.farmgenerator.tool.tooltip=Quickly create a custom farm
sample.farmgenerator.pane.title=Farm Generator
sample.farmgenerator.pane.length=Length
Expand All @@ -20,5 +25,9 @@ sample.farmgenerator.pane.animals.title=Animals
sample.farmgenerator.pane.animals.cow=Cow
sample.farmgenerator.pane.animals.sheep=Sheep
sample.farmgenerator.pane.animals.pig=Pig
sample.farmgenerator.keyBinding.toggleTool=Toggle Farm Generator Tool
sample.farmgenerator.keyBinding.place=Place Farm At Cursor
sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.farmgenerator.keyBinding.place=Place Farm At Cursor
sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000}
2 changes: 1 addition & 1 deletion farm-generator/farm-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ function addFarmGeneratorTool(uiSession: IPlayerUISession) {
uiSession.inputManager.registerKeyBinding(
EditorInputContext.GlobalToolMode,
toolToggleAction,
{ key: KeyboardKey.KEY_F, modifier: InputModifier.Control | InputModifier.Shift },
{ key: KeyboardKey.KEY_F, modifier: InputModifier.Control | InputModifier.Shift | InputModifier.Alt },
{
uniqueId: 'editorSamples:farmGenerator:toggleTool',
label: 'sample.farmgenerator.keyBinding.toggleTool',
Expand Down
14 changes: 12 additions & 2 deletions goto-mark/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
##
## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a
## comment on the same line, use TABs.
sample.gotomark.tool.title=Goto Mark
sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000}
sample.gotomark.tool.tooltip=Set or Jump to a stored location
sample.gotomark.pane.title=Goto Mark
sample.gotomark.pane.location=Player Location
Expand All @@ -14,4 +14,14 @@ sample.gotomark.pane.locationpane.button.teleport=Teleport to Stored Location %1
sample.gotomark.pane.locationpane.button.delete=Delete Stored Location
sample.gotomark.pane.locationpane.input.name=New Name
sample.gotomark.pane.locationpane.button.store=Store Current Location As...
sample.gotomark.pane.locationpane.dropdownLabel=Stored Location
sample.gotomark.pane.locationpane.dropdownLabel=Stored Location
sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000}
sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000}
sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000}
3 changes: 2 additions & 1 deletion goto-mark/goto-mark.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function addExtensionTool(uiSession: IPlayerUISession<ExtensionStorage>): IModal
function buildParentPane(uiSession: IPlayerUISession<ExtensionStorage>, storage: ExtensionStorage): IRootPropertyPane {
const parentPane = uiSession.createPropertyPane({
title: 'sample.gotomark.pane.title',
uniqueId: 'editorSamples:pane:goToMark',
});

const playerLocation = makeObservable<Vector3>(vector3Truncate(uiSession.extensionContext.player.location));
Expand Down Expand Up @@ -420,7 +421,7 @@ export function registerGotoMarkExtension() {
`Found ${storage.storedLocations.length} stored locations during initialization`
);
}
} catch (e) {
} catch (_e) {
uiSession.log.info('No stored locations found during initialization');
}

Expand Down
13 changes: 12 additions & 1 deletion minimal/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
##
## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a
## comment on the same line, use TABs.
sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000}
sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000}
sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000}
sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.minimal.pane.title=Minimal Extension Pane
sample.minimal.pane.button.clickme=Click Me!
sample.minimal.menu.title=Minimal Extension
sample.minimal.menu.showpane=Show my property pane
sample.minimal.menu.showpane=Show my property pane
sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000}
1 change: 1 addition & 0 deletions minimal/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export function registerMinimalExtension() {
// when you adjust the slider, you can inspect the binding object property 'mySlider' for the current value.
const extensionPane = uiSession.createPropertyPane({
title: 'sample.minimal.pane.title',
uniqueId: 'editorSamples:pane:minimal',
});

// Creating UI elements like buttons and sliders require a couple of simple steps.
Expand Down
13 changes: 11 additions & 2 deletions portal-generator/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
##
## Note, trailing spaces will NOT be trimmed. If you want room between the end of the string and the start of a
## comment on the same line, use TABs.
sample.portalgenerator.title=Portal Generator
sample.gotomark.tool.title=Sample Goto Mark ### Sample Text. {MaxLength=1000}
sample.cameragrapple.title=Sample Camera Base Grapple ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToCursor=Fly To Cursor (Sample) ### Sample Text. {MaxLength=1000}
sample.cameragrapple.keyBinding.flyToSelection=Fly To Selection (Sample) ### Sample Text. {MaxLength=1000}
sample.dyebrush.tool.title=Sample Dye Brush ### Sample Text. {MaxLength=1000}
sample.farmgenerator.tool.title=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.farmgenerator.keyBinding.toggleTool=Sample Farm Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.title=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.portalgenerator.tooltip=Create Portals with a single click
sample.portalgenerator.pane.title=Portal Generator
sample.portalgenerator.pane.replacefloor=Replace Floor
Expand All @@ -20,4 +27,6 @@ sample.portalgenerator.pane.nether.pane.corners.tooltip=Adds corner blocks to th
sample.portalgenerator.pane.nether.pane.percentage=Percentage Complete
sample.portalgenerator.pane.end.pane.title=End Portal
sample.portalgenerator.pane.end.pane.filledcount=Filled 'Eye of Ender' count
sample.portalgenerator.keyBinding.toggleTool=Toggle Portal Generator Tool
sample.portalgenerator.keyBinding.toggleTool=Sample Portal Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.tool.title=Sample Tree Generator ### Sample Text. {MaxLength=1000}
sample.treegenerator.keyBinding.toggleTool=Sample Tree Generator ### Sample Text. {MaxLength=1000}
21 changes: 9 additions & 12 deletions portal-generator/portal-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class PortalGenerator implements IDisposable {
uiSession.inputManager.registerKeyBinding(
EditorInputContext.GlobalToolMode,
toolToggleAction,
{ key: KeyboardKey.KEY_P, modifier: InputModifier.Control | InputModifier.Shift },
{ key: KeyboardKey.KEY_P, modifier: InputModifier.Control | InputModifier.Shift | InputModifier.Alt },
{
uniqueId: 'editorSamples:portalGenerator:toggleTool',
label: 'sample.portalgenerator.keyBinding.toggleTool',
Expand Down Expand Up @@ -178,8 +178,6 @@ class PortalGenerator implements IDisposable {
}

activatePortalGenerator(uiSession: PortalGeneratorSession, portalType: PortalType): void {
this._pane?.hide();

if (this._activePortal) {
this._activePortal.deactivatePane();
}
Expand All @@ -191,8 +189,6 @@ class PortalGenerator implements IDisposable {
}

this._activePortal.activatePane(uiSession);

this._pane?.show();
}
}

Expand Down Expand Up @@ -227,15 +223,12 @@ class NetherPortal implements IPortalGenerator {
}

this._pane = this.buildSubPane(uiSession);
this._pane?.show();
}

deactivatePane(): void {
if (this._pane) {
this._pane.hide();
this._parentPane?.removeSubPane(this._pane);
}

this._pane = undefined;
}

Expand All @@ -250,6 +243,8 @@ class NetherPortal implements IPortalGenerator {
title: 'sample.portalgenerator.pane.nether.pane.title',
});

subPane.beginConstruct();

subPane.addDropdown(this._orientation, {
title: 'sample.portalgenerator.pane.nether.pane.orientation',
entries: [
Expand Down Expand Up @@ -290,6 +285,8 @@ class NetherPortal implements IPortalGenerator {
variant: NumberPropertyItemVariant.InputFieldAndSlider,
});

subPane.endConstruct();

return subPane;
}

Expand Down Expand Up @@ -429,17 +426,13 @@ class EndPortal implements IPortalGenerator {
if (this._pane) {
this.deactivatePane();
}

this._pane = this.buildSubPane(uiSession);
this._pane?.show();
}

deactivatePane(): void {
if (this._pane) {
this._pane.hide();
this._parentPane?.removeSubPane(this._pane);
}

this._pane = undefined;
}

Expand All @@ -454,6 +447,8 @@ class EndPortal implements IPortalGenerator {
title: 'sample.portalgenerator.pane.end.pane.title',
});

subPane.beginConstruct();

subPane.addNumber(this._filledEyeCount, {
title: 'sample.portalgenerator.pane.end.pane.filledcount',
min: 0,
Expand All @@ -462,6 +457,8 @@ class EndPortal implements IPortalGenerator {
isInteger: true,
});

subPane.endConstruct();

return subPane;
}

Expand Down
Loading