aboutsummaryrefslogtreecommitdiff
path: root/loader/src/main/java/kr/syeyoung/dungeonsguide
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2023-02-07 15:25:44 +0900
committersyeyoung <cyoung06@naver.com>2023-02-07 15:25:44 +0900
commit399f681abc0bc738e01d659f2a6ae73e5fc64f71 (patch)
tree095f5a63c2a1fcfe47a3305f875c322182f884d4 /loader/src/main/java/kr/syeyoung/dungeonsguide
parentd566771b9fdba45c56b272b28e5fc0dbf2508958 (diff)
downloadSkyblock-Dungeons-Guide-399f681abc0bc738e01d659f2a6ae73e5fc64f71.tar.gz
Skyblock-Dungeons-Guide-399f681abc0bc738e01d659f2a6ae73e5fc64f71.tar.bz2
Skyblock-Dungeons-Guide-399f681abc0bc738e01d659f2a6ae73e5fc64f71.zip
- loading and unloading
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'loader/src/main/java/kr/syeyoung/dungeonsguide')
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfo.java11
-rw-r--r--loader/src/main/java/kr/syeyoung/dungeonsguide/launcher/gui/screen/version/WidgetInfoRemote.java8
2 files changed, 19 insertions, 0 deletions
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 780a3548..63ccad23 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
@@ -40,6 +40,12 @@ public abstract class WidgetInfo extends AnnotatedImportOnlyWidget {
@Bind(variableName = "version")
public final BindableAttribute<String> version = new BindableAttribute<>(String.class, "");
+ @Bind(variableName = "loadVisibility")
+ public final BindableAttribute<String> loadVisibility = new BindableAttribute<>(String.class, "loadable");
+
+ @Bind(variableName = "reason")
+ public final BindableAttribute<String> reason = new BindableAttribute<>(String.class, "");
+
public WidgetInfo() {
super(new ResourceLocation("dungeons_guide_loader:gui/versions/versionInfo.gui"));
makeItDefault.addOnUpdate((old, neu) ->{
@@ -53,6 +59,11 @@ public abstract class WidgetInfo extends AnnotatedImportOnlyWidget {
public void setVersion(String version) {this.version.setValue(version);}
public void setDefault(boolean bool) {this.makeItDefault.setValue(bool);}
+ public void setNotLoadable(String reason) {
+ this.reason.setValue(reason);
+ this.loadVisibility.setValue("notloadable");
+ }
+
public abstract IDGLoader getLoader();
public void setConfiguration(Configuration configuration) {}
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 dc4e2331..64b92d09 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
@@ -18,8 +18,10 @@
package kr.syeyoung.dungeonsguide.launcher.gui.screen.version;
+import kr.syeyoung.dungeonsguide.launcher.LoaderMeta;
import kr.syeyoung.dungeonsguide.launcher.branch.Update;
import kr.syeyoung.dungeonsguide.launcher.branch.UpdateBranch;
+import kr.syeyoung.dungeonsguide.launcher.exceptions.DungeonsGuideLoadingException;
import kr.syeyoung.dungeonsguide.launcher.loader.IDGLoader;
import kr.syeyoung.dungeonsguide.launcher.loader.RemoteLoader;
import net.minecraftforge.common.config.Configuration;
@@ -37,6 +39,12 @@ public class WidgetInfoRemote extends WidgetInfo {
this.isLatest = isLatest;
setVersion((isLatest ? "Latest :: " : "") + branch.getName()+"/"+update.getName()+ " ("+branch.getId()+"/"+update.getId()+")");
setDefault(isLatest);
+
+
+ int reqVersion = update.getMetadata().has("loaderVersion") ? update.getMetadata().getInt("loaderVersion") : 0;
+ if (reqVersion > LoaderMeta.LOADER_VERSION) {
+ setNotLoadable("This version of Dungeons Guide requires loader version: " + reqVersion +" But current loader version: "+ LoaderMeta.LOADER_VERSION);
+ }
}
@Override