From 1ff1bb22862f4083ced2c7cc57bd0c9497b6313b Mon Sep 17 00:00:00 2001 From: Mike Ammerlaan Date: Thu, 17 Oct 2024 13:25:29 -0700 Subject: [PATCH] fix(gallery): Update gallery samples and registrations - Refactor loading in app.tsx --- app/public/data/gallery.json | 44 ++- .../data/snippets/server-admin-beta.json | 39 +-- .../data/snippets/server-gametest-beta.json | 10 +- app/public/data/snippets/server-net-beta.json | 33 +- app/src/UX/App.tsx | 283 +++++++----------- app/src/UX/Home.css | 1 + app/src/app/ProjectUtilities.ts | 32 ++ .../behavior_packs/deployJs/manifest.json | 2 +- 8 files changed, 226 insertions(+), 218 deletions(-) diff --git a/app/public/data/gallery.json b/app/public/data/gallery.json index 90128d59..05b1a4d1 100644 --- a/app/public/data/gallery.json +++ b/app/public/data/gallery.json @@ -730,10 +730,50 @@ "id": "cubeGenerator", "type": 3 }, + { + "title": "Phantoms should fly from cats", + "topics": ["Test.spawn", "Test.assertEntityPresentInArea", "register"], + "sampleSet": "server-gametest-beta", + "localLogo": "blocks/cobblestone.png", + "id": "phantomsShouldFlyFromCats", + "type": 3 + }, + { + "title": "Tests a roller coaster obstacle course.", + "topics": ["Test.spawn", "Test.assertEntityPresentInArea", "register"], + "sampleSet": "server-gametest-beta", + "localLogo": "blocks/cobblestone.png", + "id": "minibiomes", + "type": 3 + }, + { + "title": "A simple mob test - the fox should attack the chicken.", + "topics": ["Test.spawn", "Test.assertEntityPresentInArea", "register"], + "sampleSet": "server-gametest-beta", + "localLogo": "blocks/cobblestone.png", + "id": "simpleMobGameTest", + "type": 3 + }, + { + "title": "Get Player Profile", + "topics": ["variables", "secrets"], + "sampleSet": "server-admin-beta", + "localLogo": "blocks/cobblestone.png", + "id": "getPlayerProfile", + "type": 3 + }, + { + "title": "Update score via Http Request", + "topics": ["HttpRequestMethod", "HttpHeader", "HttpResponse"], + "sampleSet": "server-net-beta", + "localLogo": "blocks/cobblestone.png", + "id": "updateScore", + "type": 3 + }, { "title": "Translated Message Form", "topics": ["MessageFormData", "MessageFormResponse", "World.getPlayers"], - "sampleSet": "server", + "sampleSet": "server-ui", "localLogo": "ui/dialog_background_opaque_overlap_bottom.png", "id": "showTranslatedMessageForm", "type": 3 @@ -862,7 +902,7 @@ "topics": ["MessageFormData", "MessageFormResponse", "World.getPlayers"], "sampleSet": "server-ui", "localLogo": "ui/timer.png", - "id": "showBasicMesageForm", + "id": "showBasicMessageForm", "type": 3 }, { diff --git a/app/public/data/snippets/server-admin-beta.json b/app/public/data/snippets/server-admin-beta.json index 77eeed71..3259c18b 100644 --- a/app/public/data/snippets/server-admin-beta.json +++ b/app/public/data/snippets/server-admin-beta.json @@ -1,19 +1,22 @@ { -"getPlayerProfile": { - "description": "Uses secrets and variables from dedicated server configuration files to further parameterize web requests. See https://learn.microsoft.com/minecraft/creator/scriptapi/minecraft/server-admin/serversecrets", - "prefix": ["mc"], - "body": [" const serverUrl = mcsa.variables.get('serverEndpoint');", -" const req = new HttpRequest(serverUrl + 'getPlayerProfile');", -" req.body = JSON.stringify({", -" playerId: 'johndoe',", -" });", -" const authTokenSec = mcsa.secrets.get('authtoken');", -" if (!authTokenSec) {", -" log('authtoken secret not defined.', -1);", -" return;", -" }", -" req.method = HttpRequestMethod.Post;", -" req.headers = [new HttpHeader('Content-Type', 'application/json'), new HttpHeader('auth', authTokenSec)];", -" await http.request(req);" -]} -} \ No newline at end of file + "getPlayerProfile": { + "description": "Uses secrets and variables from dedicated server configuration files to further parameterize web requests. See https://learn.microsoft.com/minecraft/creator/scriptapi/minecraft/server-admin/serversecrets", + "prefix": ["mc"], + "body": [ + "// Note this code will only run on Bedrock Dedicated Server.", + " const serverUrl = mcsa.variables.get('serverEndpoint');", + " const req = new HttpRequest(serverUrl + 'getPlayerProfile');", + " req.body = JSON.stringify({", + " playerId: 'johndoe',", + " });", + " const authTokenSec = mcsa.secrets.get('authtoken');", + " if (!authTokenSec) {", + " log('authtoken secret not defined.', -1);", + " return;", + " }", + " req.method = HttpRequestMethod.Post;", + " req.headers = [new HttpHeader('Content-Type', 'application/json'), new HttpHeader('auth', authTokenSec)];", + " await http.request(req);" + ] + } +} diff --git a/app/public/data/snippets/server-gametest-beta.json b/app/public/data/snippets/server-gametest-beta.json index 595f9c58..6b4d2862 100644 --- a/app/public/data/snippets/server-gametest-beta.json +++ b/app/public/data/snippets/server-gametest-beta.json @@ -3,8 +3,7 @@ "description": "A simple mob test - the fox should attack the chicken. See https://learn.microsoft.com/minecraft/creator/scriptapi/minecraft/server-gametest/minecraft-server-gametest/register", "prefix": ["mc"], "body": [ - "import { Test, register } from '@minecraft/server-gametest';", - "import { MinecraftEntityTypes } from '@minecraft/vanilla-data';", + "// Note this code will run in experimental worlds with the Beta APIs experiment, and supporting GameTest structures.", "function simpleMobGameTest(test: Test) {", " const attackerId = MinecraftEntityTypes.Fox;", " const victimId = MinecraftEntityTypes.Chicken;", @@ -23,8 +22,7 @@ "description": "Tests a failure case - phantoms should fly away from cats, but get captured by them. See https://learn.microsoft.com/minecraft/creator/scriptapi/minecraft/server-gametest/minecraft-server-gametest/register", "prefix": ["mc"], "body": [ - "import { Test, register } from '@minecraft/server-gametest';", - "import { MinecraftEntityTypes } from '@minecraft/vanilla-data';", + "// Note this code will run in experimental worlds with the Beta APIs experiment, and supporting GameTest structures.", "function phantomsShouldFlyFromCats(test: Test) {", " test.spawn(MinecraftEntityTypes.Cat, { x: 4, y: 3, z: 3 });", " test.spawn(MinecraftEntityTypes.Phantom, { x: 4, y: 3, z: 3 });", @@ -39,9 +37,7 @@ "description": "Tests a roller coaster obstacle course. See https://learn.microsoft.com/minecraft/creator/scriptapi/minecraft/server-gametest/minecraft-server-gametest/register", "prefix": ["mc"], "body": [ - "import { EntityComponentTypes } from '@minecraft/server';", - "import { Test, register } from '@minecraft/server-gametest';", - "import { MinecraftBlockTypes, MinecraftEntityTypes } from '@minecraft/vanilla-data';", + "// Note this code will run in experimental worlds with the Beta APIs experiment, and supporting GameTest structures.", "function minibiomes(test: Test) {", " const minecart = test.spawn(MinecraftEntityTypes.Minecart, { x: 9, y: 7, z: 7 });", " const pig = test.spawn(MinecraftEntityTypes.Pig, { x: 9, y: 7, z: 7 });", diff --git a/app/public/data/snippets/server-net-beta.json b/app/public/data/snippets/server-net-beta.json index 95f119fe..c1e1bd56 100644 --- a/app/public/data/snippets/server-net-beta.json +++ b/app/public/data/snippets/server-net-beta.json @@ -1,16 +1,19 @@ { -"updateScore": { - "description": "Updates score on a local server. See https://learn.microsoft.com/minecraft/creator/scriptapi/minecraft/server-net/httprequest", - "prefix": ["mc"], - "body": [" const req = new HttpRequest('http://localhost:3000/updateScore');", -" req.body = JSON.stringify({", -" score: 22,", -" });", -" req.method = HttpRequestMethod.Post;", -" req.headers = [", -" new HttpHeader('Content-Type', 'application/json'),", -" new HttpHeader('auth', 'my-auth-token'),", -" ];", -" await http.request(req);" -]} -} \ No newline at end of file + "updateScore": { + "description": "Updates score on a local server. See https://learn.microsoft.com/minecraft/creator/scriptapi/minecraft/server-net/httprequest", + "prefix": ["mc"], + "body": [ + "// Note this code will only run on Bedrock Dedicated Server.", + " const req = new HttpRequest('http://localhost:3000/updateScore');", + " req.body = JSON.stringify({", + " score: 22,", + " });", + " req.method = HttpRequestMethod.Post;", + " req.headers = [", + " new HttpHeader('Content-Type', 'application/json'),", + " new HttpHeader('auth', 'my-auth-token'),", + " ];", + " await http.request(req);" + ] + } +} diff --git a/app/src/UX/App.tsx b/app/src/UX/App.tsx index aa0619b3..81e44425 100644 --- a/app/src/UX/App.tsx +++ b/app/src/UX/App.tsx @@ -13,7 +13,6 @@ import CartoApp from "../app/CartoApp"; import StorageUtilities from "../storage/StorageUtilities"; import { ThemeInput } from "@fluentui/react-northstar"; import { CartoEditorViewMode } from "../app/ICartoData"; -import MCWorld from "../minecraft/MCWorld"; import ProjectItem from "../app/ProjectItem"; import ZipStorage from "../storage/ZipStorage"; import ProjectUtilities from "../app/ProjectUtilities"; @@ -44,7 +43,6 @@ interface AppProps { } interface AppState { - carto?: Carto; mode: AppMode; isPersisted?: boolean; errorMessage?: string; @@ -87,75 +85,10 @@ export default class App extends Component { this._tick = this._tick.bind(this); - if (this.props.fileContentRetriever) { - this.props.fileContentRetriever(this._getFileContent); - } - - if (this.props.saveAllRetriever) { - this.props.saveAllRetriever(this._saveAll); - } - - if (CartoApp.carto === undefined) { - this.state = { - carto: undefined, - mode: AppMode.loading, - activeProject: null, - }; - - CartoApp.onInitialized.subscribe(this._handleCartoInit); - - // for a potential race condition where carto gets set right in between - // initting of the state and registering the event. - if (CartoApp.carto !== undefined) { - this.state = { - carto: CartoApp.carto, - mode: AppMode.home, - activeProject: null, - }; - } - } else { - const stateFromUrl = this._getStateFromUrl(); - let initialAppMode = AppMode.home; - - if (stateFromUrl) { - initialAppMode = stateFromUrl.mode; - } else if (CartoApp.initialMode) { - const mode = this._getModeFromString(CartoApp.initialMode); - - if (mode) { - initialAppMode = mode; - } - } - - let selectedItem = undefined; - - if (CartoApp.modeParameter && CartoApp.modeParameter.startsWith("project/")) { - const segments = CartoApp.modeParameter.split("/"); - - if (segments.length === 2) { - this._handleNewProject("Project", NewProjectTemplateType.gameTest); - - selectedItem = segments[1]; - } - } else if ( - CartoApp.initialMode && - (CartoApp.modeParameter || CartoApp.initialMode === "info") && - CartoApp.projectPath - ) { - this._loadLocalStorageProject(); - } - - this.state = { - carto: CartoApp.carto, - mode: initialAppMode, - selectedItem: selectedItem, - activeProject: null, - }; - - if (!CartoApp.carto.isLoaded) { - this.loadCarto(CartoApp.carto); - } - } + this.state = { + mode: AppMode.loading, + activeProject: null, + }; } public async _saveAll() { @@ -169,19 +102,13 @@ export default class App extends Component { } public async _loadLocalStorageProject() { - let carto = this.state?.carto; - - if (!carto) { - carto = CartoApp.carto; - } - - if (!carto) { + if (CartoApp.carto === undefined || !CartoApp.carto.isLoaded) { return; } let newProject = undefined; - newProject = await carto.ensureProjectFromLocalStoragePath(CartoApp.projectPath); + newProject = await CartoApp.carto.ensureProjectFromLocalStoragePath(CartoApp.projectPath); if (newProject) { let mode = this._getModeFromString(CartoApp.initialMode); @@ -202,7 +129,6 @@ export default class App extends Component { if (this.state) { const newState = { - carto: carto, mode: mode, isPersisted: this.state.isPersisted, activeProject: newProject, @@ -261,7 +187,6 @@ export default class App extends Component { } this.setState({ - carto: this.state.carto, mode: this.state.mode, isPersisted: this.state.isPersisted, loadingMessage: this.state.loadingMessage, @@ -275,11 +200,10 @@ export default class App extends Component { } private _handleHashChange() { - const result = this._getStateFromUrl(); + const result = this._getStateFromUrlWithSideEffects(false); if (result && this._isMountedInternal) { this.setState({ - carto: this.state.carto, mode: result.mode, isPersisted: this.state.isPersisted, loadingMessage: this.state.loadingMessage, @@ -306,7 +230,8 @@ export default class App extends Component { const isPersisted = await WebUtilities.getIsPersisted(); - const newState = this._getStateFromUrl(); + const newState = this._getStateFromUrlWithSideEffects(); + let nextMode = this.state.mode; if (newState) { @@ -317,23 +242,16 @@ export default class App extends Component { this._updateWindowTitle(nextMode, this.state.activeProject); - const newComponentState = { - carto: CartoApp.carto, + this.setState({ mode: nextMode, isPersisted: isPersisted, activeProject: this.state.activeProject, hasBanner: this.state.hasBanner, visualSeed: this.state.visualSeed, - }; - - if (this._isMountedInternal) { - this.setState(newComponentState); - } else { - this.state = newComponentState; - } + }); } - private _getStateFromUrl(): AppState | undefined { + private _getStateFromUrlWithSideEffects(dontProcessQueryStrings?: boolean): AppState | undefined { const hash = window.location.hash; const query = window.location.search; const queryVals: { [path: string]: string } = {}; @@ -357,7 +275,7 @@ export default class App extends Component { } } - if (queryVals["open"] !== undefined || queryVals["view"] !== undefined) { + if (!dontProcessQueryStrings && (queryVals["open"] !== undefined || queryVals["view"] !== undefined)) { let openQuery = queryVals["view"]; const updateContent = queryVals["updates"]; @@ -443,7 +361,6 @@ export default class App extends Component { setHomeWithError(errorMessage: string) { this.setState({ - carto: CartoApp.carto, mode: AppMode.home, activeProject: null, isPersisted: this.state.isPersisted, @@ -455,10 +372,64 @@ export default class App extends Component { } componentDidMount() { - if (typeof window !== "undefined") { - window.addEventListener("hashchange", this._handleHashChange, false); - window.addEventListener("resize", this._incrementVisualSeed, false); - this._intervalId = window.setInterval(this._tick, 50); + if (!this._isMountedInternal) { + if (this.props.fileContentRetriever) { + this.props.fileContentRetriever(this._getFileContent); + } + + if (this.props.saveAllRetriever) { + this.props.saveAllRetriever(this._saveAll); + } + + if (CartoApp.carto && !CartoApp.carto.isLoaded) { + CartoApp.onInitialized.subscribe(this._handleCartoInit); + + this.loadCarto(CartoApp.carto); + } else { + const stateFromUrl = this._getStateFromUrlWithSideEffects(); + + let initialAppMode = AppMode.home; + + if (stateFromUrl) { + initialAppMode = stateFromUrl.mode; + } else if (CartoApp.initialMode) { + const mode = this._getModeFromString(CartoApp.initialMode); + + if (mode) { + initialAppMode = mode; + } + } + + let selectedItem = undefined; + + if (CartoApp.modeParameter && CartoApp.modeParameter.startsWith("project/")) { + const segments = CartoApp.modeParameter.split("/"); + + if (segments.length === 2) { + this._handleNewProject("Project", NewProjectTemplateType.gameTest); + + selectedItem = segments[1]; + } + } else if ( + CartoApp.initialMode && + (CartoApp.modeParameter || CartoApp.initialMode === "info") && + CartoApp.projectPath + ) { + this._loadLocalStorageProject(); + } + + this.setState({ + mode: initialAppMode, + selectedItem: selectedItem, + activeProject: null, + }); + } + + if (typeof window !== "undefined") { + window.addEventListener("hashchange", this._handleHashChange, false); + window.addEventListener("resize", this._incrementVisualSeed, false); + this._intervalId = window.setInterval(this._tick, 50); + } } this._isMountedInternal = true; @@ -474,14 +445,7 @@ export default class App extends Component { } private async _doLog(message: string) { - let carto = this.state?.carto; - - if (!carto) { - carto = CartoApp.carto; - } - this.setState({ - carto: carto, isPersisted: this.state.isPersisted, mode: AppMode.loading, hasBanner: this.state.hasBanner, @@ -501,13 +465,7 @@ export default class App extends Component { editorStartMode?: ProjectEditorMode, startInReadOnly?: boolean ) { - let carto = this.state?.carto; - - if (!carto) { - carto = CartoApp.carto; - } - - if (!carto) { + if (CartoApp.carto === undefined || !CartoApp.carto.isLoaded) { return; } @@ -527,7 +485,7 @@ export default class App extends Component { } if (newProjectPath === undefined) { - newProject = await carto.createNewProject( + newProject = await CartoApp.carto.createNewProject( newProjectName, newProjectPath, focus, @@ -535,7 +493,7 @@ export default class App extends Component { ProjectScriptLanguage.typeScript ); } else { - newProject = await carto.ensureProjectForFolder(newProjectPath, newProjectName, false); + newProject = await CartoApp.carto.ensureProjectForFolder(newProjectPath, newProjectName, false); await newProject.ensureProjectFolder(); @@ -549,7 +507,7 @@ export default class App extends Component { } await newProject.save(true); - await carto.save(); + await CartoApp.carto.save(); this._updateWindowTitle(AppMode.project, newProject); @@ -567,7 +525,6 @@ export default class App extends Component { if (this.state && this._isMountedInternal) { this.setState({ - carto: carto, mode: nextMode, isPersisted: this.state.isPersisted, activeProject: newProject, @@ -580,14 +537,15 @@ export default class App extends Component { } private async _handleNewProjectFromFolder(folderPath: string) { - if (this.state.carto === undefined) { + if (CartoApp.carto === undefined || !CartoApp.carto.isLoaded) { return; } - const newProject = await this.state.carto.ensureProjectForFolder(folderPath); + const newProject = await CartoApp.carto.ensureProjectForFolder(folderPath); newProject.save(); - this.state.carto.save(); + + CartoApp.carto.save(); this._setProject(newProject); } @@ -606,11 +564,11 @@ export default class App extends Component { } private async _handleNewProjectFromFolderInstance(folder: IFolder, name?: string, isDocumentationProject?: boolean) { - if (this.state.carto === undefined) { + if (CartoApp.carto === undefined || !CartoApp.carto.isLoaded) { return; } - const newProject = new Project(this.state.carto, name ? name : folder.name, null); + const newProject = new Project(CartoApp.carto, name ? name : folder.name, null); newProject.setProjectFolder(folder); @@ -621,20 +579,20 @@ export default class App extends Component { await newProject.inferProjectItemsFromFiles(); newProject.save(); - this.state.carto.save(); + CartoApp.carto.save(); this._setProject(newProject); } private async _ensureProjectFromGalleryId(galleryId: string, updateContent?: string) { - if (this.state.carto === undefined) { + if (CartoApp.carto === undefined || !CartoApp.carto.isLoaded) { return; } - const gp = await this.state.carto.getGalleryProjectById(galleryId); + const gp = await CartoApp.carto.getGalleryProjectById(galleryId); if (gp === undefined) { - this.setHomeWithError("We could not find a gallery project with an identifier of '" + galleryId + "' to open."); + this.setHomeWithError("We could not find a starter/sample named '" + galleryId + "' that could be opened."); return; } @@ -642,7 +600,7 @@ export default class App extends Component { } private async _ensureProjectFromGallery(project: IGalleryItem, updateContent?: string) { - if (this.state === null || this.state.carto === undefined) { + if (CartoApp.carto === undefined || !CartoApp.carto.isLoaded) { return; } @@ -677,7 +635,12 @@ export default class App extends Component { ) { const carto = CartoApp.carto; - if (this.state === null || carto === undefined) { + if ( + this.state === null || + carto === undefined || + this._loadingMessage !== undefined || + (window.document.title && window.document.title.indexOf("Loading") >= 0) + ) { return; } @@ -759,7 +722,7 @@ export default class App extends Component { shortName?: string, description?: string ) { - if (this.state === null || this.state.carto === undefined) { + if (CartoApp.carto === undefined || !CartoApp.carto.isLoaded) { return; } @@ -892,7 +855,6 @@ export default class App extends Component { ); } catch (e: any) { this.setState({ - carto: this.state.carto, mode: AppMode.home, activeProject: this.state.activeProject, selectedItem: this.state.selectedItem, @@ -983,7 +945,6 @@ export default class App extends Component { private async _handlePersistenceUpgraded() { this.setState({ mode: this.state.mode, - carto: this.state.carto, isPersisted: true, activeProject: this.state.activeProject, selectedItem: this.state.selectedItem, @@ -1003,7 +964,6 @@ export default class App extends Component { this.setState({ mode: this.state.mode, - carto: this.state.carto, isPersisted: this.state.isPersisted, activeProject: this.state.activeProject, selectedItem: this.state.selectedItem, @@ -1014,35 +974,6 @@ export default class App extends Component { }); } - private async _newProjectFromMinecraftFolder(folderType: LocalFolderType, folder: IFolder) { - if (this.state === null || this.state.carto === undefined) { - return; - } - - let proposedProjectName = StorageUtilities.getBaseFromName(folder.fullPath); - const mcw = await MCWorld.ensureMCWorldOnFolder(folder); - - if (mcw && mcw.name) { - proposedProjectName = mcw.name; - } - - const newProject = await this.state.carto.ensureProjectForFolder(folder.fullPath, proposedProjectName); - - newProject.save(); - this.state.carto.save(); - - this._updateWindowTitle(AppMode.project, newProject); - this.initProject(newProject); - - this.setState({ - mode: AppMode.project, - isPersisted: this.state.isPersisted, - hasBanner: this.state.hasBanner, - visualSeed: this.state.visualSeed, - activeProject: newProject, - }); - } - private async _ensureProjectFromMinecraftFolder(folderType: LocalFolderType, folder: IFolder, isReadOnly: boolean) { const carto = CartoApp.carto; @@ -1192,7 +1123,6 @@ export default class App extends Component { if (cbElt?.hasChildNodes()) { if (this.state && !this.state.hasBanner) { this.setState({ - carto: this.state.carto, mode: this.state.mode, isPersisted: this.state.isPersisted, loadingMessage: this.state.loadingMessage, @@ -1206,7 +1136,6 @@ export default class App extends Component { } } else if (this.state && this.state.hasBanner) { this.setState({ - carto: this.state.carto, mode: this.state.mode, isPersisted: this.state.isPersisted, loadingMessage: this.state.loadingMessage, @@ -1273,10 +1202,6 @@ export default class App extends Component { render() { let interior = <>; - if (this.state.carto === undefined) { - return
Loading...
; - } - let isReadOnly = false; if (this.state.mode === AppMode.projectReadOnly) { @@ -1299,7 +1224,15 @@ export default class App extends Component { heightOffset = bannerHeight; } - if (this.state.mode === AppMode.loading) { + if (CartoApp.carto === undefined || !CartoApp.carto.isLoaded) { + interior = ( +
+
+ Loading... +
+
+ ); + } else if (this.state.mode === AppMode.loading) { let message = "loading..."; let additionalLoadingMessage = ""; @@ -1325,8 +1258,8 @@ export default class App extends Component { } else if (this.state.mode === AppMode.home) { interior = ( { } else if (this.state.activeProject !== null && CartoApp.initialMode === "projectitem") { interior = ( { } else if (this.state.activeProject !== null && CartoApp.initialMode === "info") { interior = ( { interior = ( { // show main view (no sidebar) if it's a code sample. interior = ( { } else { interior = ( = 0 && fileContent.indexOf(" as mcnet") <= 0) { + sampleContent = sampleContent.replace(/mcnet./gi, ""); + } + + if (sampleContent.indexOf(" mcsa.") >= 0 && fileContent.indexOf(" as mcsa") <= 0) { + sampleContent = sampleContent.replace(/mcsa./gi, ""); + } + return sampleContent; } @@ -1162,6 +1173,27 @@ export default class ProjectUtilities { this.ImportTypes.vanilla ); + introContent = ProjectUtilities.ensureImportLines( + introContent, + restOfContent, + "@minecraft/server-admin", + this.ImportTypes.mcsa + ); + + introContent = ProjectUtilities.ensureImportLines( + introContent, + restOfContent, + "@minecraft/server-net", + this.ImportTypes.mcnet + ); + + introContent = ProjectUtilities.ensureImportLines( + introContent, + restOfContent, + "@minecraft/server-gametest", + this.ImportTypes.mcgt + ); + introContent = ProjectUtilities.ensureImportLines( introContent, restOfContent, diff --git a/samplecontent/deployJs/behavior_packs/deployJs/manifest.json b/samplecontent/deployJs/behavior_packs/deployJs/manifest.json index 9117ac12..70196a71 100644 --- a/samplecontent/deployJs/behavior_packs/deployJs/manifest.json +++ b/samplecontent/deployJs/behavior_packs/deployJs/manifest.json @@ -33,7 +33,7 @@ "dependencies": [ { "module_name": "@minecraft/server", - "version": "1.15.0-beta" + "version": "1.17.0-beta" }, { "module_name": "@minecraft/server-gametest",