1
0
mirror of https://github.com/zumbiepig/MineXLauncher.git synced 2025-06-08 09:24:48 +00:00
This commit is contained in:
zumbiepig 2024-09-23 18:04:02 -07:00
parent 8e4bc58460
commit 3173208f3b
No known key found for this signature in database
GPG Key ID: 17C891BE28B953DE
7 changed files with 92 additions and 46 deletions

View File

@ -67,6 +67,28 @@ jobs:
# cp -r ${{ runner.temp }}/eaglerl/javascript/lang/ ./src/game/web/main/1.9.4/lang/
# cp ${{ runner.temp }}/eaglerl/javascript/assets.epk ./src/game/web/main/1.9.4/assets.epk
# cp ${{ runner.temp }}/eaglerl/javascript/classes.js ./src/game/web/main/1.9.4/classes.js
- name: Compile Starlike Client
if: success() || failure()
run: |
git clone https://github.com/SpeedSlicer/Starlike-Client.git ${{ runner.temp }}/starlike
rm -rf \
./src/game/web/clients/starlike/lang/ \
./src/game/web/clients/starlike/assets.epk \
./src/game/web/clients/starlike/classes.js \
./src/game/web/clients/starlike/classes.js.map \
./src/game/offline/clients/Starlike_Client.html \
${{ runner.temp }}/starlike/javascript/assets.epk \
${{ runner.temp }}/starlike/javascript/classes.js
cd ${{ runner.temp }}/starlike/
chmod +x ./gradlew
java -jar "desktopRuntime/CompileEPK.jar" "desktopRuntime/resources" "javascript/assets.epk"
./gradlew generateJavascript
java -cp "desktopRuntime/MakeOfflineDownload.jar:desktopRuntime/CompileEPK.jar" net.lax1dude.eaglercraft.v1_8.buildtools.workspace.MakeOfflineDownload "javascript/OfflineDownloadTemplate.txt" "javascript/classes.js" "javascript/assets.epk" "/dev/null" "javascript/Starlike_Client_International.html" "javascript/lang"
cd ${{ github.workspace }}
cp -r ${{ runner.temp }}/starlike/javascript/lang/ ./src/game/web/clients/starlike/lang/
cp ${{ runner.temp }}/starlike/javascript/assets.epk ./src/game/web/clients/starlike/assets.epk
cp ${{ runner.temp }}/starlike/javascript/classes.js ./src/game/web/clients/starlike/classes.js
cp ${{ runner.temp }}/starlike/javascript/Starlike_Client_International.html ./src/game/offline/clients/Starlike_Client.html
- name: Compile Shadow Client
if: success() || failure()
run: |

View File

View File

@ -84,6 +84,12 @@
>Select a client</span
>
<div class="options">
<div
onclick="game.select('/game/web/clients/starlike/', 'Starlike Client')"
>
<img src="/resources/images/icons/clients/starlike.webp" />
<span>Starlike Client</span>
</div>
<div
onclick="game.select('/game/web/clients/eaglerforge/', 'EaglerForge')"
>

View File

@ -112,6 +112,10 @@
>Indev</span
>
<br /><br />
<span
onclick="downloadFile('/game/offline/clients/Starlike_Client.html', 'Starlike_Client.html')"
>Starlike Client</span
>
<span
onclick="downloadFile('/game/offline/clients/EaglerForge.html', 'EaglerForge.html')"
>EaglerForge</span

View File

@ -45,6 +45,7 @@
{
"version": "1.7.2",
"changelog": [
"Added Starlike Client",
"Updated EaglercraftX 1.8 to u37",
"Added Sweet Cherry 16x texture pack",
"New setting to open new tab instead of popup"

View File

@ -479,7 +479,7 @@ window.eaglercraftXOpts = {
}
},
},
Mods: storage.local.get('mods') ?? [],
Mods: storage.local.get('addons').mods ?? [],
};
const urlParams = new URLSearchParams(window.location.search);

View File

@ -498,33 +498,37 @@ const detect = {
},
};
const mods = {
toggle: function (modId: string): void {
const mod = `/resources/addons/${modId}.js`;
const mods: string[] = storage.local.get('mods') ?? [];
const modIndex = mods.indexOf(mod);
if (modIndex === -1) {
mods.push(mod);
mods.sort();
storage.local.set('mods', mods);
const modInstallElem = document.querySelector(
`.mod-list > div .links .install[data-mod-id='${modId}']`,
);
if (modInstallElem) {
modInstallElem.textContent = 'Uninstall';
modInstallElem.classList.add('installed');
const addons = {
mods: {
toggle: function (modId: string): void {
const mod = `/resources/addons/${modId}.js`;
const addons: { mods: string[] } = storage.local.get('addons') ?? {
mods: [],
};
const modIndex = addons.mods.indexOf(mod);
if (modIndex === -1) {
addons.mods.push(mod);
addons.mods.sort();
storage.local.set('addons', addons);
const modInstallElem = document.querySelector(
`.mod-list > div .links .install[data-mod-id='${modId}']`,
);
if (modInstallElem) {
modInstallElem.classList.add('installed');
modInstallElem.textContent = 'Uninstall';
}
} else {
addons.mods.splice(modIndex, 1);
storage.local.set('addons', addons);
const modInstallElem = document.querySelector(
`.mod-list > div .links .install[data-mod-id='${modId}']`,
);
if (modInstallElem) {
modInstallElem.classList.remove('installed');
modInstallElem.textContent = 'Install';
}
}
} else {
mods.splice(modIndex, 1);
storage.local.set('mods', mods);
const modInstallElem = document.querySelector(
`.mod-list > div .links .install[data-mod-id='${modId}']`,
);
if (modInstallElem) {
modInstallElem.textContent = 'Install';
modInstallElem.classList.remove('installed');
}
}
},
},
};
@ -924,7 +928,7 @@ if (window.location.pathname === '/settings/general/') {
storage.local.set('noPopup', false);
// storage.local.set('offlineCache', offlineCheckbox?.checked ?? false);
// storage.local.set('showAds', true);
storage.local.set('mods', []);
storage.local.set('addons', { mods: [] });
storage.local.set(
'lastVersion',
(await (await fetch('/resources/data/main.json')).json()).updates[0]
@ -951,38 +955,47 @@ if (window.location.pathname === '/settings/general/') {
document.addEventListener('DOMContentLoaded', async () => {
const addonType: 'mods' | 'resourcepacks' =
window.location.pathname === '/addons/mods/' ? 'mods' : 'resourcepacks';
const data: {
id: string;
name: string;
description: string;
author: string;
authorLink: string;
source: string;
}[] = (await (await fetch('/resources/data/main.json')).json()).addons;
const modList = document.querySelector('.mod-list');
// @ts-expect-error
data[addonType].forEach((addon) => {
const modItem = document.createElement('div');
modItem.innerHTML = `<img loading="lazy" src="/resources/images/icons/addons/${addon.id}.webp" /><div class="details"><strong>${
const addons: {
mods: {
id: string;
name: string;
description: string;
author: string;
authorLink: string;
source: string;
}[];
resourcepacks: {
id: string;
name: string;
description: string;
author: string;
authorLink: string;
source: string;
}[];
} = (await (await fetch('/resources/data/main.json')).json()).addons;
const addonList = document.querySelector('.mod-list');
addons[addonType].forEach((addon) => {
const addonItem = document.createElement('div');
addonItem.innerHTML = `<img loading="lazy" src="/resources/images/icons/addons/${addon.id}.webp" /><div class="details"><strong>${
addon.name
}</strong><p class="author">By <a href="${addon.authorLink}" target="_blank">${addon.author}</a></p><p class="description">${addon.description}</p></div><div class="links">${
addonType === 'mods'
? `<span class="download" onclick="downloadFile('/resources/addons/${addon.id}.js', '${addon.name.replace('\\', '\\\\').replace("'", "\\'")}.js')">Download</span><span class="install" data-mod-id="${addon.id}" onclick="mods.toggle('${addon.id}')">Install</span>`
? `<span class="download" onclick="downloadFile('/resources/addons/${addon.id}.js', '${addon.name.replace('\\', '\\\\').replace("'", "\\'")}.js')">Download</span><span class="install" data-mod-id="${addon.id}" onclick="addons.mods.toggle('${addon.id}')">Install</span>`
: `<span class="download" onclick="downloadFile('/resources/addons/${addon.id}.zip', '${addon.name.replace('\\', '\\\\').replace("'", "\\'")}.zip')">Download</span>`
}</div>`;
modList?.append(modItem);
addonList?.append(addonItem);
});
if (addonType === 'mods') {
const installedMods = storage.local.get('mods') ?? [];
const installedMods = storage.local.get('addons').mods ?? [];
const modElements = document.querySelectorAll(
'.mod-list > div .links .install',
);
modElements.forEach((element) => {
const modId = (element as HTMLElement).dataset['modId'];
if (installedMods.includes(`/resources/addons/${modId}.js`)) {
element.textContent = 'Uninstall';
element.classList.add('installed');
element.textContent = 'Uninstall';
}
});
}
@ -1025,7 +1038,7 @@ if (window.location.hostname === null) {
query,
versionSelector,
game,
mods,
addons,
base64Gzip,
article,
downloadFile,