Skip to content

Commit 9a21bd6

Browse files
author
Simeon Kummer
committed
fix some bugs, add resourcepack
1 parent b12a7a4 commit 9a21bd6

File tree

5 files changed

+64
-25
lines changed

5 files changed

+64
-25
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Upload ResourcePack
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
upload-resourcepack:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Upload resourcepack as artifact
18+
uses: actions/upload-artifact@v3
19+
with:
20+
name: resourcepack
21+
path: resourcepack.zip
22+
if-no-files-found: error

resourcepack.zip

23.7 MB
Binary file not shown.

src/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ ipcMain.handle('launch-minecraft', async (event, { uuid, name }) => {
187187
try {
188188
await minecraftStarter.downloadMods();
189189
// Clear the status message after mods have been downloaded
190-
mainWindow.webContents.send('minecraft-status', { message: '' });
190+
mainWindow.webContents.send('minecraft-status', { message: null });
191191
} catch (error) {
192192
console.error('Error downloading mods:', error);
193193
// Show error but let Minecraft continue running

src/minecraftStarter.js

Lines changed: 39 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -116,29 +116,46 @@ class MinecraftStarter {
116116
}
117117

118118
async downloadMods() {
119-
const sodiumUrl = "https://cdn.modrinth.com/data/AANobbMI/versions/DA250htH/sodium-fabric-0.6.13%2Bmc1.21.5.jar";
120-
const modsDir = path.join(path.dirname(this.INSTALL_DIR), 'minecraft/mods');
121-
122-
try {
123-
fs.mkdirSync(modsDir, { recursive: true });
124-
125-
const response = await axios({
126-
method: 'GET',
127-
url: sodiumUrl,
128-
responseType: 'arraybuffer',
129-
headers: {
130-
'User-Agent': 'Node.js downloader'
131-
}
132-
});
133-
134-
const sodiumJarPath = path.join(modsDir, 'sodium-fabric-0.6.13+mc1.21.5.jar');
135-
fs.writeFileSync(sodiumJarPath, response.data);
119+
return new Promise(async (resolve, reject) => {
120+
const sodiumUrl = "https://cdn.modrinth.com/data/AANobbMI/versions/DA250htH/sodium-fabric-0.6.13%2Bmc1.21.5.jar";
121+
const irisUrl = "https://cdn.modrinth.com/data/YL57xq9U/versions/U6evbjd0/iris-fabric-1.8.11%2Bmc1.21.5.jar";
122+
const modsDir = path.join(path.dirname(this.INSTALL_DIR), 'minecraft/mods');
136123

137-
return true;
138-
} catch (error) {
139-
console.error('Error downloading mods:', error);
140-
throw error;
141-
}
124+
try {
125+
fs.mkdirSync(modsDir, { recursive: true });
126+
127+
// Download Sodium
128+
const sodiumResponse = await axios({
129+
method: 'GET',
130+
url: sodiumUrl,
131+
responseType: 'arraybuffer',
132+
headers: {
133+
'User-Agent': 'Node.js downloader'
134+
}
135+
});
136+
137+
const sodiumJarPath = path.join(modsDir, 'sodium-fabric-0.6.13+mc1.21.5.jar');
138+
fs.writeFileSync(sodiumJarPath, sodiumResponse.data);
139+
140+
// Download Iris Shaders
141+
const irisResponse = await axios({
142+
method: 'GET',
143+
url: irisUrl,
144+
responseType: 'arraybuffer',
145+
headers: {
146+
'User-Agent': 'Node.js downloader'
147+
}
148+
});
149+
150+
const irisJarPath = path.join(modsDir, 'iris-fabric-1.8.11+mc1.21.5.jar');
151+
fs.writeFileSync(irisJarPath, irisResponse.data);
152+
153+
resolve(true);
154+
} catch (error) {
155+
console.error('Error downloading mods:', error);
156+
reject(error);
157+
}
158+
})
142159
}
143160

144161
run(uuid, name) {

src/renderer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ window.api.on('minecraft-closed', () => {
5555

5656
// Listen for Minecraft status updates
5757
window.api.on('minecraft-status', (data) => {
58-
if (data && data.message) {
59-
statusMessage.textContent = data.message;
58+
if (data) {
59+
statusMessage.textContent = data.message || '';
6060
}
6161
});
6262

0 commit comments

Comments
 (0)