diff --git a/dye-brush/dye-brush.ts b/dye-brush/dye-brush.ts index e0b5850..48cc010 100644 --- a/dye-brush/dye-brush.ts +++ b/dye-brush/dye-brush.ts @@ -3,7 +3,6 @@ import { ActionTypes, ColorPickerPropertyItemVariant, - CursorProperties, CursorTargetMode, IDropdownItem, IModalTool, @@ -139,7 +138,6 @@ interface DyeBrushStorage { currentColor: EntityColor; brushColor: IObservable; brushSize: number; - backedUpCursorProps: CursorProperties | undefined; } type DyeBrushSession = IPlayerUISession; @@ -164,11 +162,12 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) { const pane = uiSession.createPropertyPane({ title: 'sample.dyeBrush.pane.title', - infoTooltip: { description: ['sample.dyebrush.tool.tooltip'] }, }); const entityBrush = makeObservable(EntityColor.White); + onColorUpdated(brushColor.value, uiSession); + pane.addDropdown(entityBrush, { title: 'Brush', entries: Object.values(EntityColor).reduce((list, dye, index) => { @@ -313,15 +312,7 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) { tool.onModalToolActivation.subscribe((evt: ModalToolLifecycleEventPayload) => { if (evt.isActiveTool) { - if (uiSession.scratchStorage && !uiSession.scratchStorage.backedUpCursorProps) { - uiSession.scratchStorage.backedUpCursorProps = uiSession.extensionContext.cursor.getProperties(); - } onColorUpdated(brushColor.value, uiSession); - } else { - if (uiSession.scratchStorage && uiSession.scratchStorage.backedUpCursorProps) { - uiSession.extensionContext.cursor.setProperties(uiSession.scratchStorage.backedUpCursorProps); - uiSession.scratchStorage.backedUpCursorProps = undefined; - } } uiSession.scratchStorage?.previewSelection?.clear(); }); @@ -330,7 +321,7 @@ function addDyeBrushPane(uiSession: DyeBrushSession, tool: IModalTool) { } export function addDyeBrushTool(uiSession: DyeBrushSession) { - const tool = uiSession.toolRail.addTool('editorSample:dyeBrushTool', { + const tool = uiSession.toolRail.addTool({ title: 'sample.dyebrush.tool.title', tooltip: 'sample.dyebrush.tool.tooltip', icon: 'pack://textures/dye-brush.png', @@ -354,7 +345,6 @@ export function registerDyeBrushExtension() { currentColor: EntityColor.White, brushColor: makeObservable({ red: 1, green: 1, blue: 1, alpha: 0.5 }), brushSize: 4, - backedUpCursorProps: undefined, }; uiSession.scratchStorage = storage; diff --git a/editor-samples.mceditoraddon b/editor-samples.mceditoraddon index 9ba989b..dcb5b36 100644 Binary files a/editor-samples.mceditoraddon and b/editor-samples.mceditoraddon differ diff --git a/farm-generator/farm-generator.ts b/farm-generator/farm-generator.ts index 1e35c90..1a31716 100644 --- a/farm-generator/farm-generator.ts +++ b/farm-generator/farm-generator.ts @@ -133,12 +133,6 @@ const buildFarm = ( function addFarmGeneratorSettingsPane(uiSession: IPlayerUISession, tool: IModalTool) { const windowPane = uiSession.createPropertyPane({ title: 'sample.farmgenerator.pane.title', - infoTooltip: { - description: [ - 'sample.farmgenerator.tool.tooltip', - { link: 'https://aka.ms/BedrockEditorFarmGenerator', text: 'resourcePack.editor.help.learnMore' }, - ], - }, }); const cropPane = windowPane.createSubPane({ title: 'sample.farmgenerator.pane.crops.title', @@ -387,12 +381,16 @@ function addFarmGeneratorTool(uiSession: IPlayerUISession) { }, }); - const tool = uiSession.toolRail.addTool('editorSample:farmTool', { - title: 'sample.farmgenerator.tool.title', - icon: 'pack://textures/farm-generator.png', - tooltip: 'sample.farmgenerator.tool.tooltip', - action: toolToggleAction, - }); + const tool = uiSession.toolRail.addTool( + { + title: 'sample.farmgenerator.tool.title', + icon: 'pack://textures/farm-generator.png', + tooltip: 'sample.farmgenerator.tool.tooltip', + inputContextId: 'editorSamples:farmGenerator', + inputContextLabel: 'sample.farmgenerator.tool.title', + }, + toolToggleAction + ); // Register a global shortcut (CTRL + SHIFT + P) to select the tool uiSession.inputManager.registerKeyBinding( diff --git a/goto-mark/goto-mark.ts b/goto-mark/goto-mark.ts index ba0a519..6af62bb 100644 --- a/goto-mark/goto-mark.ts +++ b/goto-mark/goto-mark.ts @@ -9,7 +9,6 @@ import { IObservable, IPlayerUISession, IPropertyPane, - IRootPropertyPane, UserDefinedTransactionHandle, bindDataSource, makeObservable, @@ -117,7 +116,7 @@ function teleportTo(uiSession: IPlayerUISession, destination: // Add the extension to the tool rail and give it an icon function addExtensionTool(uiSession: IPlayerUISession): IModalTool { - const tool = uiSession.toolRail.addTool('editorSample:goToMarkTool', { + const tool = uiSession.toolRail.addTool({ title: 'sample.gotomark.tool.title', icon: 'pack://textures/goto-mark.png', tooltip: 'Set or Jump to a stored location', @@ -125,7 +124,7 @@ function addExtensionTool(uiSession: IPlayerUISession): IModal return tool; } -function buildParentPane(uiSession: IPlayerUISession, storage: ExtensionStorage): IRootPropertyPane { +function buildParentPane(uiSession: IPlayerUISession, storage: ExtensionStorage): IPropertyPane { const parentPane = uiSession.createPropertyPane({ title: 'sample.gotomark.pane.title', }); diff --git a/portal-generator/portal-generator.ts b/portal-generator/portal-generator.ts index e1509bc..bd62424 100644 --- a/portal-generator/portal-generator.ts +++ b/portal-generator/portal-generator.ts @@ -6,7 +6,6 @@ import { IDisposable, ImageResourceType, IObservable, - IRootPropertyPane, makeObservable, NumberPropertyItemVariant, Ray, @@ -64,7 +63,7 @@ class PortalGenerator implements IDisposable { private _endPortal: EndPortal; private _activePortal?: IPortalGenerator; - private _pane?: IRootPropertyPane; + private _pane?: IPropertyPane; private _settings: PaneSettingsType = { portalType: makeObservable(PortalType.Nether), shouldReplaceFloor: makeObservable(true), @@ -75,7 +74,7 @@ class PortalGenerator implements IDisposable { this._endPortal = new EndPortal(); } - public toolPane(uiSession: PortalGeneratorSession): IRootPropertyPane | undefined { + public toolPane(uiSession: PortalGeneratorSession): IPropertyPane | undefined { if (!this._pane) { uiSession.log.error('Tool pane not initialized'); return undefined; @@ -93,12 +92,14 @@ class PortalGenerator implements IDisposable { }); // Add the extension to the tool rail and give it an icon - const tool = uiSession.toolRail.addTool('editorSample:portalTool', { - title: 'sample.portalgenerator.title', - icon: 'pack://textures/portal-generator.png', - tooltip: 'sample.portalgenerator.tooltip', - action: toolToggleAction, - }); + const tool = uiSession.toolRail.addTool( + { + title: 'sample.portalgenerator.title', + icon: 'pack://textures/portal-generator.png', + tooltip: 'sample.portalgenerator.tooltip', + }, + toolToggleAction + ); // Register a global shortcut (CTRL + SHIFT + P) to select the tool uiSession.inputManager.registerKeyBinding( diff --git a/simple-empty/SimpleEmptyTool.ts b/simple-empty/SimpleEmptyTool.ts index a7eda01..0fd91e9 100644 --- a/simple-empty/SimpleEmptyTool.ts +++ b/simple-empty/SimpleEmptyTool.ts @@ -235,7 +235,6 @@ export class SimpleEmptyTool extends SimpleToolWrapper { // additional components as needed (in this case, a status bar, a tool rail, and a property pane) // YOu can also specify an activation key binding and some functions to be called during the lifecycle of the tool const options: ISimpleToolOptions = { - id: 'sample:simpleEmptyTool', name: 'Simple Empty Tool', onFinalize: tool => { tool.logDebug('onFinalize(ISimpleTool)'); diff --git a/simple-locate/SimpleLocateBiome.ts b/simple-locate/SimpleLocateBiome.ts index 4852dab..ef8a264 100644 --- a/simple-locate/SimpleLocateBiome.ts +++ b/simple-locate/SimpleLocateBiome.ts @@ -216,7 +216,6 @@ export class SimpleLocate extends SimpleToolWrapper { super(); const toolOptions: ISimpleToolOptions = { - id: 'editor:simpleLocateBiome', name: 'Simple Locate Biome', activationKeyBinding: { binding: { diff --git a/tree-generator/tree-generator.ts b/tree-generator/tree-generator.ts index f8168c7..bc2d29f 100644 --- a/tree-generator/tree-generator.ts +++ b/tree-generator/tree-generator.ts @@ -220,49 +220,43 @@ export class SimpleTree implements ITree { } } +function createLeaf1Block(leafType: string): BlockPermutation { + return BlockPermutation.resolve(MinecraftBlockTypes.Leaves, { + old_leaf_type: leafType, + }); +} + +function createLeaf2Block(leafType: string): BlockPermutation { + return BlockPermutation.resolve(MinecraftBlockTypes.Leaves2, { + new_leaf_type: leafType, + }); +} + const TreeTypes = [ { name: 'Oak', - type: new SimpleTree( - BlockPermutation.resolve(MinecraftBlockTypes.OakLog), - BlockPermutation.resolve(MinecraftBlockTypes.OakLeaves) - ), + type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.OakLog), createLeaf1Block('oak')), }, { name: 'Spruce', - type: new SimpleTree( - BlockPermutation.resolve(MinecraftBlockTypes.SpruceLog), - BlockPermutation.resolve(MinecraftBlockTypes.SpruceLeaves) - ), + type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.SpruceLog), createLeaf1Block('spruce')), }, { name: 'Birch', - type: new SimpleTree( - BlockPermutation.resolve(MinecraftBlockTypes.BirchLog), - BlockPermutation.resolve(MinecraftBlockTypes.BirchLeaves) - ), + type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.BirchLog), createLeaf1Block('birch')), }, { name: 'Jungle', - type: new SimpleTree( - BlockPermutation.resolve(MinecraftBlockTypes.JungleLog), - BlockPermutation.resolve(MinecraftBlockTypes.JungleLeaves) - ), + type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.JungleLog), createLeaf1Block('jungle')), }, { name: 'Acacia', - type: new SimpleTree( - BlockPermutation.resolve(MinecraftBlockTypes.AcaciaLog), - BlockPermutation.resolve(MinecraftBlockTypes.AcaciaLeaves) - ), + type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.AcaciaLog), createLeaf2Block('acacia')), }, { name: 'Dark Oak', - type: new SimpleTree( - BlockPermutation.resolve(MinecraftBlockTypes.DarkOakLog), - BlockPermutation.resolve(MinecraftBlockTypes.DarkOakLeaves) - ), + type: new SimpleTree(BlockPermutation.resolve(MinecraftBlockTypes.DarkOakLog), createLeaf2Block('dark_oak')), }, ]; @@ -270,12 +264,6 @@ function addToolSettingsPane(uiSession: IPlayerUISession, tool: IModalTool) { // Create a pane that will be shown when the tool is selected const pane = uiSession.createPropertyPane({ title: 'sample.treegenerator.pane.title', - infoTooltip: { - description: [ - 'sample.treegenerator.tool.tooltip', - { link: 'https://aka.ms/BedrockEditorTreeGenerator', text: 'resourcePack.editor.help.learnMore' }, - ], - }, }); // Settings @@ -408,12 +396,16 @@ function addTool(uiSession: IPlayerUISession) { }, }); - const tool = uiSession.toolRail.addTool('editorSample:treeGeneratorTool', { - title: 'sample.treegenerator.tool.title', - icon: 'pack://textures/tree-generator.png', - tooltip: 'sample.treegenerator.tool.tooltip', - action: toolToggleAction, - }); + const tool = uiSession.toolRail.addTool( + { + title: 'sample.treegenerator.tool.title', + icon: 'pack://textures/tree-generator.png', + tooltip: 'sample.treegenerator.tool.tooltip', + inputContextId: 'editorSamples:treeGenerator', + inputContextLabel: 'sample.treegenerator.tool.title', + }, + toolToggleAction + ); // Register a global shortcut to select the tool uiSession.inputManager.registerKeyBinding(