From ca3cbd7f37374a4e00ecdd9539122462217f63c4 Mon Sep 17 00:00:00 2001 From: jgaribsin Date: Tue, 20 Feb 2024 15:48:34 -0700 Subject: [PATCH] added configuration page, option shader installation, credits list - version bump to 0.4.0 - added full credits list to project readme - credits list is now linked to on post install page - added client/server configuration page for common options and settings (eg. server motd) - added optional shader install and configuration -- using enhanced default, doesn't break, and fits game aesthetic - cleaned up install complete page code - fixed text overflow on mod downloads --- README.md | 33 +++++++ package.json | 2 +- src/components/ClientConfiguration.vue | 67 ++++++++++++++ src/components/MultiplayerInstall.vue | 7 +- src/components/ServerConfiguration.vue | 123 +++++++++++++++++++++++++ src/components/SingleplayerInstall.vue | 12 ++- src/css/quasar.variables.scss | 2 +- src/pages/InstallComplete.vue | 82 ++++------------- src/pages/InstallOptions.vue | 21 +++++ src/providers/DownloadFile.ts | 2 +- src/providers/DownloadMods.ts | 49 ++++++++-- src/providers/InstallServer.ts | 14 ++- src/providers/InstallShaders.ts | 54 +++++++++++ src/providers/JavaDownload.ts | 1 - src/router/routes.ts | 15 ++- src/stores/InstallerStore.ts | 15 ++- src/stores/SourcesStore.ts | 16 +++- 17 files changed, 430 insertions(+), 85 deletions(-) create mode 100644 src/components/ClientConfiguration.vue create mode 100644 src/components/ServerConfiguration.vue create mode 100644 src/pages/InstallOptions.vue create mode 100644 src/providers/InstallShaders.ts diff --git a/README.md b/README.md index 562cff8..561c207 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,39 @@ The most helpful part is uploading your log file, so please don't forget to do t Thanks in advance <3 +## Credits + +This project was created using [Quasar](https://quasar.dev/), [Electron](https://www.electronjs.org/), and [Vue](https://vuejs.org/) with HTML, CSS and [TypeScript](https://www.typescriptlang.org/) in [VSCode](https://code.visualstudio.com/). + +### Mods + +Massive thanks to each of the following Minecraft mods for enhancing the experience and immersiveness of the map! + +- [Animatica](https://modrinth.com/mod/animatica) +- [CIT Resewn](https://modrinth.com/mod/cit-resewn) +- [Cull Leaves](https://modrinth.com/mod/cull-leaves) +- [Dynamic FPS](https://modrinth.com/mod/dynamic-fps) +- [Entity Culling](https://modrinth.com/mod/entity-culling) +- [Fabric API](https://modrinth.com/mod/fabric-api) +- [FabricSkyboxes](https://modrinth.com/mod/fabricskyboxes) +- [Indium](https://modrinth.com/mod/indium) +- [Iris Shaders](https://modrinth.com/mod/iris) +- [LambDynamicLights](https://modrinth.com/mod/lambdynamiclights) +- [Lazy DFU](https://modrinth.com/mod/lazydfu) +- [Lithium](https://modrinth.com/mod/lithium) +- [Starlight](https://modrinth.com/mod/starlight) +- [Sodium](https://modrinth.com/mod/sodium) +- [Sodium Extra](https://modrinth.com/mod/sodium-extra) +- [Reese's Sodium Options](https://modrinth.com/mod/reeses-sodium-options) +- [WI Zoom](https://modrinth.com/mod/wi-zoom) +- [Entity Texture Features](https://modrinth.com/mod/entitytexturefeatures) +- [CEM](https://modrinth.com/mod/cem) + - [Modified Version](https://github.com/YoungSoulluoS/cem_Fork): YoungSoulluoS for creating a modified version with additional compatabilities! + +### Shaders + +Additional thanks goes out to Sildur for creating [Sildur's Enhanced Default](https://sildurs-shaders.github.io/)! + ## Development Created using [Quasar](https://quasar.dev/), [Electron](https://www.electronjs.org/), and [Vue](https://vuejs.org/) with HTML, CSS and [TypeScript](https://www.typescriptlang.org/) in [VSCode](https://code.visualstudio.com/). diff --git a/package.json b/package.json index 23cf6d6..e2c9c87 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "drehmal-installer", - "version": "0.3.1", + "version": "0.4.0", "description": "Drehmal, Minecraft map installer", "productName": "Drehmal Installer", "author": "jgaribsin", diff --git a/src/components/ClientConfiguration.vue b/src/components/ClientConfiguration.vue new file mode 100644 index 0000000..55ce425 --- /dev/null +++ b/src/components/ClientConfiguration.vue @@ -0,0 +1,67 @@ + + + + diff --git a/src/components/MultiplayerInstall.vue b/src/components/MultiplayerInstall.vue index bbaf114..87a3bd1 100644 --- a/src/components/MultiplayerInstall.vue +++ b/src/components/MultiplayerInstall.vue @@ -37,9 +37,11 @@ import { ProgressBox as ProgressBoxType, Shard } from 'src/components/models'; import { downloadMods } from 'src/providers/DownloadMods'; import { downloadResourcePack } from 'src/providers/DownloadResourcePack'; import { installFabric } from 'src/providers/InstallFabric'; +import { useInstallerStore } from 'src/stores/InstallerStore'; import { useSourcesStore } from 'src/stores/SourcesStore'; import { useStateStore } from 'src/stores/StateStore'; import { ref } from 'vue'; + const { map } = storeToRefs(useSourcesStore()); const { processingFabric, @@ -47,6 +49,7 @@ const { processingResourcepack, disableBackNav, } = storeToRefs(useStateStore()); +const { shaders: enableShaders } = storeToRefs(useInstallerStore()); const versionFileName = map.value.versionName .toLowerCase() .split(' ') @@ -78,7 +81,9 @@ const fabricProgress = ref({ img: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAeCAYAAABuUU38AAAACXBIWXMAAAsTAAALEwEAmpwYAAAB50lEQVRYhd2YTU7bYBCGn7GyoF0Eu17EpyARS1hEogeI1IXbs/QAvUpJFogcAESkwhIBvQRUMna9ABaQr4tgk9j5lSd1zLNybI8y7ze/shx3z+j4bfq9gaGCdPy29HsDxBhDvzcwIoLtfCjbr5WIwkeMMXT8tshx98wAWJawbVdLyN/okeFwlEg1AOfTx/Sh69bL8WpFgiBODz68fxgJSUhEbNVrecsN4il+xnXrBEGc3rOyL226CJjuo4WU4Ik2Apa8AyUC1KDY+PD3TiZ+9y4+r9VuFoULouU56fXVbbh2u1kUFvL9aBeAH18uaXlOetKzTtjfO0GApudwfRvSLRiJBPUW1fIcru+iuc9TFMtTTch4ZJoNOxeZb/unDI2h5Tn8/hPx89eB1l8Dkp8jWkycPLDTsNN7yVqhh9FPrWzNfN0/xbxG4uYu4vBcMxJvFBayqLibDTu9Hpp8JBbZL4tK+53WPscjM68mZtmvikqNLGo+L+o1kUelRua5mURm3VhT0rZyGKOUWpaUv3iqrSjZJXAZRISuUjtWmyPZAbgMGt0qQX1FKYu1rSj/m5yQp/i5DD9WYpqPE6kVBDGuW6+EmPEvKPAqJLx/AEbft7IvbDKJ3zBKrfKHQHEkSS0BzLjCCiEA/wAmNq0sQ6WYFQAAAA5lWElmTU0AKgAAAAgAAAAAAAAA0lOTAAAAAElFTkSuQmCC', }); const modsProgress = ref({ - label: 'Mods - Press download button to begin', + label: enableShaders.value + ? 'Mods/Shaders - Press download button to begin' + : 'Mods - Press download button button to begin', percent: 0, progress: 0, img: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAeCAYAAABuUU38AAAACXBIWXMAAAsTAAALEwEAmpwYAAAB50lEQVRYhd2YTU7bYBCGn7GyoF0Eu17EpyARS1hEogeI1IXbs/QAvUpJFogcAESkwhIBvQRUMna9ABaQr4tgk9j5lSd1zLNybI8y7ze/shx3z+j4bfq9gaGCdPy29HsDxBhDvzcwIoLtfCjbr5WIwkeMMXT8tshx98wAWJawbVdLyN/okeFwlEg1AOfTx/Sh69bL8WpFgiBODz68fxgJSUhEbNVrecsN4il+xnXrBEGc3rOyL226CJjuo4WU4Ik2Apa8AyUC1KDY+PD3TiZ+9y4+r9VuFoULouU56fXVbbh2u1kUFvL9aBeAH18uaXlOetKzTtjfO0GApudwfRvSLRiJBPUW1fIcru+iuc9TFMtTTch4ZJoNOxeZb/unDI2h5Tn8/hPx89eB1l8Dkp8jWkycPLDTsNN7yVqhh9FPrWzNfN0/xbxG4uYu4vBcMxJvFBayqLibDTu9Hpp8JBbZL4tK+53WPscjM68mZtmvikqNLGo+L+o1kUelRua5mURm3VhT0rZyGKOUWpaUv3iqrSjZJXAZRISuUjtWmyPZAbgMGt0qQX1FKYu1rSj/m5yQp/i5DD9WYpqPE6kVBDGuW6+EmPEvKPAqJLx/AEbft7IvbDKJ3zBKrfKHQHEkSS0BzLjCCiEA/wAmNq0sQ6WYFQAAAA5lWElmTU0AKgAAAAgAAAAAAAAA0lOTAAAAAElFTkSuQmCC', diff --git a/src/components/ServerConfiguration.vue b/src/components/ServerConfiguration.vue new file mode 100644 index 0000000..49ef965 --- /dev/null +++ b/src/components/ServerConfiguration.vue @@ -0,0 +1,123 @@ + + + + diff --git a/src/components/SingleplayerInstall.vue b/src/components/SingleplayerInstall.vue index b8b5a3b..beaa950 100644 --- a/src/components/SingleplayerInstall.vue +++ b/src/components/SingleplayerInstall.vue @@ -70,8 +70,13 @@ import { ref } from 'vue'; const extract = require('extract-zip'); const fs = require('fs'); const path = require('path'); + const { map } = storeToRefs(useSourcesStore()); -const { drehmalDir, shardsDir } = storeToRefs(useInstallerStore()); +const { + drehmalDir, + shardsDir, + shaders: enableShaders, +} = storeToRefs(useInstallerStore()); const { processingShards, processingFabric, @@ -79,6 +84,7 @@ const { processingResourcepack, disableBackNav, } = storeToRefs(useStateStore()); + const versionFileName = map.value.versionName .toLowerCase() .split(' ') @@ -127,7 +133,9 @@ const fabricProgress = ref({ img: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAeCAYAAABuUU38AAAACXBIWXMAAAsTAAALEwEAmpwYAAAB50lEQVRYhd2YTU7bYBCGn7GyoF0Eu17EpyARS1hEogeI1IXbs/QAvUpJFogcAESkwhIBvQRUMna9ABaQr4tgk9j5lSd1zLNybI8y7ze/shx3z+j4bfq9gaGCdPy29HsDxBhDvzcwIoLtfCjbr5WIwkeMMXT8tshx98wAWJawbVdLyN/okeFwlEg1AOfTx/Sh69bL8WpFgiBODz68fxgJSUhEbNVrecsN4il+xnXrBEGc3rOyL226CJjuo4WU4Ik2Apa8AyUC1KDY+PD3TiZ+9y4+r9VuFoULouU56fXVbbh2u1kUFvL9aBeAH18uaXlOetKzTtjfO0GApudwfRvSLRiJBPUW1fIcru+iuc9TFMtTTch4ZJoNOxeZb/unDI2h5Tn8/hPx89eB1l8Dkp8jWkycPLDTsNN7yVqhh9FPrWzNfN0/xbxG4uYu4vBcMxJvFBayqLibDTu9Hpp8JBbZL4tK+53WPscjM68mZtmvikqNLGo+L+o1kUelRua5mURm3VhT0rZyGKOUWpaUv3iqrSjZJXAZRISuUjtWmyPZAbgMGt0qQX1FKYu1rSj/m5yQp/i5DD9WYpqPE6kVBDGuW6+EmPEvKPAqJLx/AEbft7IvbDKJ3zBKrfKHQHEkSS0BzLjCCiEA/wAmNq0sQ6WYFQAAAA5lWElmTU0AKgAAAAgAAAAAAAAA0lOTAAAAAElFTkSuQmCC', }); const modsProgress = ref({ - label: 'Mods - Press download button', + label: enableShaders.value + ? 'Mods/Shaders - Press download...' + : 'Mods - Press download button', percent: 0, progress: 0, img: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAeCAYAAABuUU38AAAACXBIWXMAAAsTAAALEwEAmpwYAAAB50lEQVRYhd2YTU7bYBCGn7GyoF0Eu17EpyARS1hEogeI1IXbs/QAvUpJFogcAESkwhIBvQRUMna9ABaQr4tgk9j5lSd1zLNybI8y7ze/shx3z+j4bfq9gaGCdPy29HsDxBhDvzcwIoLtfCjbr5WIwkeMMXT8tshx98wAWJawbVdLyN/okeFwlEg1AOfTx/Sh69bL8WpFgiBODz68fxgJSUhEbNVrecsN4il+xnXrBEGc3rOyL226CJjuo4WU4Ik2Apa8AyUC1KDY+PD3TiZ+9y4+r9VuFoULouU56fXVbbh2u1kUFvL9aBeAH18uaXlOetKzTtjfO0GApudwfRvSLRiJBPUW1fIcru+iuc9TFMtTTch4ZJoNOxeZb/unDI2h5Tn8/hPx89eB1l8Dkp8jWkycPLDTsNN7yVqhh9FPrWzNfN0/xbxG4uYu4vBcMxJvFBayqLibDTu9Hpp8JBbZL4tK+53WPscjM68mZtmvikqNLGo+L+o1kUelRua5mURm3VhT0rZyGKOUWpaUv3iqrSjZJXAZRISuUjtWmyPZAbgMGt0qQX1FKYu1rSj/m5yQp/i5DD9WYpqPE6kVBDGuW6+EmPEvKPAqJLx/AEbft7IvbDKJ3zBKrfKHQHEkSS0BzLjCCiEA/wAmNq0sQ6WYFQAAAA5lWElmTU0AKgAAAAgAAAAAAAAA0lOTAAAAAElFTkSuQmCC', diff --git a/src/css/quasar.variables.scss b/src/css/quasar.variables.scss index cd37e24..2eecc05 100644 --- a/src/css/quasar.variables.scss +++ b/src/css/quasar.variables.scss @@ -13,7 +13,7 @@ // Tip: Use the "Theme Builder" on Quasar's documentation website. $primary: #622eaa; -$secondary: #8151c4; +$secondary: #7e57c2; $accent: #ffde00; $dark: #1d1d1d; diff --git a/src/pages/InstallComplete.vue b/src/pages/InstallComplete.vue index a2e8229..30dbb26 100644 --- a/src/pages/InstallComplete.vue +++ b/src/pages/InstallComplete.vue @@ -1,7 +1,7 @@ @@ -62,36 +36,20 @@ diff --git a/src/pages/InstallOptions.vue b/src/pages/InstallOptions.vue new file mode 100644 index 0000000..62e19be --- /dev/null +++ b/src/pages/InstallOptions.vue @@ -0,0 +1,21 @@ + + + + diff --git a/src/providers/DownloadFile.ts b/src/providers/DownloadFile.ts index f33ea59..df27ccb 100644 --- a/src/providers/DownloadFile.ts +++ b/src/providers/DownloadFile.ts @@ -18,7 +18,7 @@ export function downloadFile( // User-Agent: github_username/project_name/1.56.0 (launcher.com) const options = { headers: { - 'User-Agent': 'Drehmal-Team/installer/0.3.1 (drehmal.net)', + 'User-Agent': 'Drehmal-Team/installer/0.4.0 (drehmal.net)', // 'accept-encoding': 'gzip, deflate, br', }, }; diff --git a/src/providers/DownloadMods.ts b/src/providers/DownloadMods.ts index 680af71..4605594 100644 --- a/src/providers/DownloadMods.ts +++ b/src/providers/DownloadMods.ts @@ -5,20 +5,25 @@ import { useStateStore } from 'src/stores/StateStore'; import { Ref } from 'vue'; import { downloadFile } from './DownloadFile'; import { getOldDirName } from './GetOldDirName'; +import { installShaders } from './InstallShaders'; const fs = require('fs'); const path = require('path'); export async function downloadMods(ref: Ref) { const startTime = Date.now(); - const { launcher } = storeToRefs(useSourcesStore()); - const { drehmalDir } = storeToRefs(useInstallerStore()); - const { processingMods } = storeToRefs(useStateStore()); + const { launcher, shaders } = storeToRefs(useSourcesStore()); + const { drehmalDir, shaders: enableShaders } = storeToRefs( + useInstallerStore() + ); + const { processingMods, installType } = storeToRefs(useStateStore()); const modList = launcher.value.modList; const modLoader = launcher.value.fabric.name; const totalMods = modList.length; - let downloaded = 0; + // +2 for cit and shaders, +1 for cit if shaders are not enabled + const progressBar = totalMods + (enableShaders.value ? 2 : 1); + let completed = 0; const modsPath = path.join(drehmalDir.value, 'mods'); @@ -36,22 +41,29 @@ export async function downloadMods(ref: Ref) { console.log(`Downloading "${modName}" to "${modsPath}"`); const modPath = path.join(modsPath, modName); await downloadFile(source, modPath); - downloaded++; - const progress = downloaded / totalMods; + completed++; + const progress = completed / progressBar; const percent = (progress * 100).toFixed(1); ref.value.progress = progress; ref.value.percent = percent; // Note: Roughly 21 character limit, consider truncating mod name - ref.value.label = `Downloading: ${name}`; + // if singleplayer install, trunc mod name + // Downloading: Reese's Sodium Options + const labelStr = `Downloading: ${name}`; + if (installType.value === 'singleplayer' && labelStr.length > 30) + ref.value.label = labelStr.slice(0, 30) + '...'; + else ref.value.label = labelStr; const taken = ((Date.now() - startTime) / 1000).toFixed(2); console.log( - `Downloaded mod ${downloaded}/${totalMods} (${taken}s elapsed)` + `Downloaded mod ${completed}/${totalMods} (${taken}s elapsed)` ); } } await processArray(modList); + ref.value.label = 'Configuring mods'; + const configPath = path.join(drehmalDir.value, 'config'); if (!fs.existsSync(configPath)) fs.mkdirSync(configPath, { recursive: true }); console.log(`Creating CIT config file in "${configPath}"`); @@ -68,8 +80,27 @@ export async function downloadMods(ref: Ref) { JSON.stringify(citJsonConfig), 'utf-8' ); + completed++; + + ref.value.progress = completed / progressBar; + ref.value.percent = (ref.value.progress * 100).toFixed(1); + + if (!enableShaders.value) { + console.log( + 'Shaders not selected, skipping installation, but configuring iris.properties' + ); + await installShaders(); + ref.value.label = 'Mods successfully downloaded!'; + } else if (enableShaders.value) { + console.log('Shaders selected, proceeding to install...'); + ref.value.label = `Downloading: ${shaders.value.name}`; + await installShaders(); + completed++; + ref.value.progress = completed / progressBar; + ref.value.percent = (ref.value.progress * 100).toFixed(1); + ref.value.label = 'Mods and shaders successfully downloaded!'; + } - ref.value.label = 'Mods successfully downloaded!'; ref.value.img = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAeCAYAAABuUU38AAAACXBIWXMAAAsTAAALEwEAmpwYAAACqElEQVRYhdVYzY7SUBT+Tu1CTWRaG4UncKMOxOWMhhg37khYwBgT43P4ADyIiSawMLBzA0LUWRLGv4VPwMwECjVhiJYeF6W1pTBD7+2Mw7e67b0993733HvOd0r1ahuFUh6NWoexgSiU8tSodUDMjEatw0QETb/2v9cVCyPzBMyMQilPVK+2GQAUhbClbRaR8egEjuMeJBUA9JvX/U7DSElP8OJp59T+1+/z0nMMBpa/8eZw4hLx4JG4mlKjX8ZALqOv7Ov1TWn7U8uGYaQwGFj+u4hFkUnKO02/zQBq+09OHb+324LDDFpz/LI1Ti079E4FxbKxFPfSGq6Qa+jn8NeZ47fTmt/u9U35BRCgkgST8m4TzPF39NW7B6HnZw9bmDkc244HAqC4zhVDNq1DIXmX3r+tQVXk7Ciyi0jgZCYCKSIOMxTJnfRAkp4VioOVYhffjsZ4++mx0KSlQJQjANX53agUu+j1TaG7IhzQbccR/TSUZw4OE4haIHEiIijvtsDMyGV0KY9GwRdLJBvIHw4nK7YTIbI332lvaYtnPOiJ78djvPmYlCf+IREiwUz95XAU6c+mNZ/kzDmfsicRIl6mrhS72E5roagEuES/Ho1Q/SyWudeBMBFVWZ2CglGJ4YZYGSm0DqhebbNXjxhGKpb6fZnvYPLHjtyJSrHrtw/6pp8nVqG00wQRYnlsatm+jDeHE7nMfse4kYjWymV0Xz2L4lzC76K6vQjIi8ZLohqlPOLtvFeXeDhLKy1GNdE6JIhEjlY2HdBOa1R8yWutJUSmlh27bl+8E88ffcDM4YgMUYjgsHglGFzjIkIrHgwsGEZq6cA4uHtra+n737MZfhxb0vYBhP6gAPM84j0E/29tAszhxG8ruDzVqgzIO1oEgIMMNwgEAH8Bhif2yStQayoAAAAOZVhJZk1NACoAAAAIAAAAAAAAANJTkwAAAABJRU5ErkJggg=='; processingMods.value = false; diff --git a/src/providers/InstallServer.ts b/src/providers/InstallServer.ts index 5ba6bc3..727031c 100644 --- a/src/providers/InstallServer.ts +++ b/src/providers/InstallServer.ts @@ -10,7 +10,9 @@ const path = require('path'); export async function installServer(ref: Ref) { const { server } = storeToRefs(useSourcesStore()); - const { serverDir, memory, javawExePath } = storeToRefs(useInstallerStore()); + const { serverDir, memory, javawExePath, serverOpts } = storeToRefs( + useInstallerStore() + ); const serverPath = path.join(serverDir.value, 'server.jar'); console.log(`Downloading server jar to "${serverPath}"`); @@ -39,9 +41,17 @@ export async function installServer(ref: Ref) { ref.value.label = 'Updating server properties'; console.log(`Creating server.properties with ${server.value.properties}`); + const serverProperties = server.value.properties.map( + (property) => property + ); + for (const key in serverOpts.value) + serverProperties.push( + `${key}=${serverOpts.value[key as keyof typeof serverOpts.value]}` + ); + fs.writeFileSync( path.join(serverDir.value, 'server.properties'), - server.value.properties, + serverProperties.join('\n'), 'utf-8' ); await new Promise((resolve) => setTimeout(resolve, 100)); diff --git a/src/providers/InstallShaders.ts b/src/providers/InstallShaders.ts new file mode 100644 index 0000000..7f6acdd --- /dev/null +++ b/src/providers/InstallShaders.ts @@ -0,0 +1,54 @@ +const fs = require('fs'); +import { storeToRefs } from 'pinia'; +import { useInstallerStore } from 'src/stores/InstallerStore'; +import { useSourcesStore } from 'src/stores/SourcesStore'; +import { downloadFile } from './DownloadFile'; +const path = require('path'); + +export async function installShaders() { + const { drehmalDir, shaders: enableShaders } = storeToRefs( + useInstallerStore() + ); + const { shaders } = storeToRefs(useSourcesStore()); + + const shadersDir = path.join(drehmalDir.value, 'shaderpacks'); + const shadersName = + shaders.value.name + ' v' + shaders.value.version + '.zip'; + + // If user has selected shaders, then download them + if (enableShaders.value) { + console.log(`Downloading shaders to "${shadersDir}"`); + + if (!fs.existsSync(shadersDir)) + fs.mkdirSync(shadersDir, { recursive: true }); + await downloadFile( + shaders.value.source, + path.join(shadersDir, shadersName) + ); + + const shadersConfigPath = path.join(shadersDir, `${shadersName}.txt`); + const shadersConfigValues = ['Crossprocess=true', 'sunPathRotation=-0.15f']; + console.log(`Writing shaders.txt to "${shadersConfigPath}"`); + fs.writeFileSync(shadersConfigPath, shadersConfigValues.join('\n')); + } + + // Even if shaders aren't selected, configure Iris shaders but in the case of no, then mark as disabled + // This allows someone to rerun the installer to disable shaders + const irisConfigPath = path.join( + drehmalDir.value, + 'config', + 'iris.properties' + ); + const irisConfigValues = [ + 'disableUpdateMessage=false', + 'enableDebugOptions=false', + 'maxShadowRenderDistance=32', + `shaderPack=${shadersName}`, + `enableShaders=${enableShaders.value ? 'true' : 'false'}`, + ]; + + console.log(`Writing iris.properties to "${irisConfigPath}"`); + fs.writeFileSync(irisConfigPath, irisConfigValues.join('\n')); + + return; +} diff --git a/src/providers/JavaDownload.ts b/src/providers/JavaDownload.ts index b1213c9..79b1595 100644 --- a/src/providers/JavaDownload.ts +++ b/src/providers/JavaDownload.ts @@ -7,7 +7,6 @@ const { ipcRenderer } = require('electron'); const os = require('os'); const path = require('path'); const fs = require('fs'); -const https = require('https'); const tar = require('tar'); /* diff --git a/src/router/routes.ts b/src/router/routes.ts index 2ceebeb..1df7720 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -34,7 +34,7 @@ const routes: RouteRecordRaw[] = [ title: 'Single Player Installation', socials: false, back: '/select/', - next: '/install/', + next: '/configure/', }, }, { @@ -44,7 +44,7 @@ const routes: RouteRecordRaw[] = [ title: 'Multi-Player Installation', socials: false, back: '/select/', - next: '/install/', + next: '/configure/', }, }, { @@ -55,6 +55,17 @@ const routes: RouteRecordRaw[] = [ title: 'Server Installation', socials: false, back: '/select/', + next: '/configure/', + }, + }, + // Install configuration + { + path: '/configure/', + component: () => import('src/pages/InstallOptions.vue'), + meta: { + title: 'Configure Installation', + socials: false, + back: '/select/', next: '/install/', }, }, diff --git a/src/stores/InstallerStore.ts b/src/stores/InstallerStore.ts index f4e2969..c3c3e0a 100644 --- a/src/stores/InstallerStore.ts +++ b/src/stores/InstallerStore.ts @@ -1,8 +1,10 @@ -import { defineStore } from 'pinia'; +import { defineStore, storeToRefs } from 'pinia'; import { ref } from 'vue'; +import { useSourcesStore } from './SourcesStore'; const path = require('path'); export const useInstallerStore = defineStore('installer', () => { + const { map } = storeToRefs(useSourcesStore()); // Use empty values for now, this will be overwritten with *actual* defaults on app launch using electron const homeDir = ref(''); const appDir = ref(''); @@ -19,6 +21,15 @@ export const useInstallerStore = defineStore('installer', () => { parseInt(process.env.MINECRAFT_MEMORY ? process.env.MINECRAFT_MEMORY : '4') ); + const shaders = ref(false); + const serverOpts = ref({ + motd: map.value.versionName, + pvp: false, + difficulty: 'normal', + hardcore: false, + maxPlayers: 10, + }); + return { homeDir, appDir, @@ -29,5 +40,7 @@ export const useInstallerStore = defineStore('installer', () => { memory, javaExePath, javawExePath, + shaders, + serverOpts, }; }); diff --git a/src/stores/SourcesStore.ts b/src/stores/SourcesStore.ts index 1b0d805..e10ef11 100644 --- a/src/stores/SourcesStore.ts +++ b/src/stores/SourcesStore.ts @@ -190,22 +190,34 @@ export const useSourcesStore = defineStore('sources', () => { mod_version: '0.7.1', }, ], + launcher_icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAHoklEQVR4Xr2by24dRRCG52RhoySABSGwQUiAiLxAQmzZsGOBeAJehEfIi+QRsuEhQGITISE2LBA3yUCIYi98UI2n2n//U7ee4+Ss7HN6uru+rkt3dc3uqwdf7Kfg8+/zp6tfz87/MZ94dvEs6qr9dnb+d6mdNjo5ft1sf/votvn9yfFrq+9ffeWu2XYXAagI//2vP0wP3vwwFGhUYKszD4K0PQTECoAltAxirboIrx+BkAn6+39/Dq38/Tv3wvYWFA+GdISaoRrRAIwILp2puv/410/T23ffahMdFbJKpApD5sMayVAQxO7z9z4zfYBn5yo8r/YWwc8fTdN0eoXg6P1bjcXu5DLkksG4Wu2137BAdAAyoXFWCiAS/Py75Ykn03T8tS3TD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/SuUbAGwOErHaO8NZq/OyQMjYEZeea++qzgKhtvj1bz+9j/yiDyyPT87LgAAAA5lWElmTU0AKgAAAAgAAAAAAAAA0lOTAAAAAElFTkSuQmCC', }); + const shaders = ref({ + name: 'Sildurs Enhanced Default', + version: '1.16', + source: + 'https://mediafilez.forgecdn.net/files/4688/998/Sildur%27s%20Enhanced%20Default%20v1.16%20Fancy.zip', + }); + const server = ref({ // per https://minecraft.wiki/w/Java_Edition_1.17.1 source: 'https://piston-data.mojang.com/v1/objects/a16d67e5807f57fc4e550299cf20226194497dc2/server.jar', - properties: - 'enable-command-block=true\nview-distance=16\nspawn-protection=0\nview-distance=12\n', + properties: [ + 'enable-command-block=true', + 'view-distance=16', + 'spawn-protection=0', + ], }); return { map, resourcePack, launcher, + shaders, server, }; });