diff options
author | syeyoung <cyoung06@naver.com> | 2023-02-07 14:26:57 +0900 |
---|---|---|
committer | syeyoung <cyoung06@naver.com> | 2023-02-07 14:26:57 +0900 |
commit | bcd5991f42c2a65d11a682fba120c44d35fe8fde (patch) | |
tree | 695f5f64b75c87b533e918a2d01064ae620099d1 /loader/src/main | |
parent | 8e81545ee8bf3d360a4437427e86bab6c3fca0f4 (diff) | |
download | Skyblock-Dungeons-Guide-bcd5991f42c2a65d11a682fba120c44d35fe8fde.tar.gz Skyblock-Dungeons-Guide-bcd5991f42c2a65d11a682fba120c44d35fe8fde.tar.bz2 Skyblock-Dungeons-Guide-bcd5991f42c2a65d11a682fba120c44d35fe8fde.zip |
- local and jar
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'loader/src/main')
5 files changed, 98 insertions, 3 deletions
diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetChooseVersion.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetChooseVersion.java index b62cd91f..05484f21 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetChooseVersion.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetChooseVersion.java @@ -45,13 +45,18 @@ public class WidgetChooseVersion extends AnnotatedImportOnlyWidget { @Bind(variableName = "infoWidget") public final BindableAttribute<Widget> infoWidget = new BindableAttribute<>(Widget.class); private void back() { + Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); listVisibility.setValue("branch"); } private void jar() { + infoWidget.setValue(new WidgetInfoJar()); + infoVisibility.setValue("show"); } private void local() { + infoWidget.setValue(new WidgetInfoLocal()); + infoVisibility.setValue("show"); } private void remote(UpdateBranch branch, Update update, boolean isLatest) { diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfo.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfo.java index 7196c5e2..780a3548 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfo.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfo.java @@ -51,6 +51,7 @@ public abstract class WidgetInfo extends AnnotatedImportOnlyWidget { updateLog.setValue(log); } public void setVersion(String version) {this.version.setValue(version);} + public void setDefault(boolean bool) {this.makeItDefault.setValue(bool);} public abstract IDGLoader getLoader(); @@ -68,6 +69,8 @@ public abstract class WidgetInfo extends AnnotatedImportOnlyWidget { setConfiguration(configuration); configuration.save(); } - // do smth + + Minecraft.getMinecraft().displayGuiScreen(null); + Main.getMain().tryReloadingWithSplash(idgLoader); } } diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoJar.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoJar.java new file mode 100644 index 00000000..777b3860 --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoJar.java @@ -0,0 +1,42 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.launcher.gui.screen.version; + +import kr.syeyoung.dungeonsguide.launcher.loader.IDGLoader; +import kr.syeyoung.dungeonsguide.launcher.loader.JarLoader; +import kr.syeyoung.dungeonsguide.launcher.loader.LocalLoader; +import net.minecraftforge.common.config.Configuration; + +public class WidgetInfoJar extends WidgetInfo { + public WidgetInfoJar() { + super(); + setVersion("Local (Jar)"); + setUpdateLog(""); + } + + @Override + public void setConfiguration(Configuration configuration) { + configuration.get("loader", "modsource", "").set("jar"); + } + + @Override + public IDGLoader getLoader() { + return new JarLoader(); + } +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoLocal.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoLocal.java new file mode 100644 index 00000000..92a8dcc6 --- /dev/null +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoLocal.java @@ -0,0 +1,43 @@ +/* + * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod + * Copyright (C) 2023 cyoung06 (syeyoung) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +package kr.syeyoung.dungeonsguide.launcher.gui.screen.version; + +import kr.syeyoung.dungeonsguide.launcher.branch.Update; +import kr.syeyoung.dungeonsguide.launcher.branch.UpdateBranch; +import kr.syeyoung.dungeonsguide.launcher.loader.IDGLoader; +import kr.syeyoung.dungeonsguide.launcher.loader.LocalLoader; +import net.minecraftforge.common.config.Configuration; + +public class WidgetInfoLocal extends WidgetInfo { + public WidgetInfoLocal() { + super(); + setVersion("Local (Classes)"); + setUpdateLog(""); + } + + @Override + public void setConfiguration(Configuration configuration) { + configuration.get("loader", "modsource", "").set("local"); + } + + @Override + public IDGLoader getLoader() { + return new LocalLoader(); + } +} diff --git a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoRemote.java b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoRemote.java index 6b450a67..dc4e2331 100644 --- a/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoRemote.java +++ b/loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoRemote.java @@ -21,6 +21,7 @@ package kr.syeyoung.dungeonsguide.launcher.gui.screen.version; import kr.syeyoung.dungeonsguide.launcher.branch.Update; import kr.syeyoung.dungeonsguide.launcher.branch.UpdateBranch; import kr.syeyoung.dungeonsguide.launcher.loader.IDGLoader; +import kr.syeyoung.dungeonsguide.launcher.loader.RemoteLoader; import net.minecraftforge.common.config.Configuration; public class WidgetInfoRemote extends WidgetInfo { @@ -34,7 +35,8 @@ public class WidgetInfoRemote extends WidgetInfo { this.isLatest = isLatest; setUpdateLog(update.getUpdateLog()); this.isLatest = isLatest; - setVersion(branch.getName()+"/"+update.getName()+ " ("+branch.getId()+"/"+update.getId()+")"); + setVersion((isLatest ? "Latest :: " : "") + branch.getName()+"/"+update.getName()+ " ("+branch.getId()+"/"+update.getId()+")"); + setDefault(isLatest); } @Override @@ -46,6 +48,6 @@ public class WidgetInfoRemote extends WidgetInfo { @Override public IDGLoader getLoader() { - return null; + return new RemoteLoader(updateBranch.getName(), update.getBranchId(), update.getId()); } } |