Modrinth as default Update location (can be configured to revert to curseforge as default)

This commit is contained in:
Frank 2022-11-16 17:28:58 +01:00
parent f63f0ef5fc
commit 4d626b23b2
7 changed files with 81 additions and 14 deletions

View file

@ -80,8 +80,47 @@ public class UpdatesScreen extends BCLibLayoutScreen {
row.addText(fit(), fit(), Component.literal(" -> "));
row.addText(fit(), fit(), Component.literal(updated)).setColor(ColorUtil.GREEN);
row.addFiller();
if (nfo != null && nfo.getMetadata().getContact().get("homepage").isPresent()) {
row.addButton(fit(), fit(), Component.translatable("bclib.updates.curseforge_link"))
boolean createdDownloadLink = false;
if (nfo != null
&& nfo.getMetadata().getCustomValue("bclib") != null
&& nfo.getMetadata().getCustomValue("bclib").getAsObject().get("downloads") != null) {
CustomValue.CvObject downloadLinks = nfo.getMetadata()
.getCustomValue("bclib")
.getAsObject()
.get("downloads")
.getAsObject();
String link = null;
Component name = null;
if (Configs.CLIENT_CONFIG.preferModrinthForUpdates() && downloadLinks.get("modrinth") != null) {
link = downloadLinks.get("modrinth").getAsString();
name = Component.translatable("bclib.updates.modrinth_link");
// row.addButton(fit(), fit(), Component.translatable("bclib.updates.modrinth_link"))
// .onPress((bt) -> {
// this.openLink(downloadLinks.get("modrinth").getAsString());
// }).centerVertical();
// createdDownloadLink = true;
} else if (downloadLinks.get("curseforge") != null) {
link = downloadLinks.get("curseforge").getAsString();
name = Component.translatable("bclib.updates.curseforge_link");
// row.addButton(fit(), fit(), Component.translatable("bclib.updates.curseforge_link"))
// .onPress((bt) -> {
// this.openLink(downloadLinks.get("curseforge").getAsString());
// }).centerVertical();
// createdDownloadLink = true;
}
if (link != null) {
createdDownloadLink = true;
final String finalLink = link;
row.addButton(fit(), fit(), name)
.onPress((bt) -> {
this.openLink(finalLink);
}).centerVertical();
}
}
if (!createdDownloadLink && nfo != null && nfo.getMetadata().getContact().get("homepage").isPresent()) {
row.addButton(fit(), fit(), Component.translatable("bclib.updates.download_link"))
.onPress((bt) -> {
this.openLink(nfo.getMetadata().getContact().get("homepage").get());
}).centerVertical();

View file

@ -11,7 +11,6 @@ public class ClientConfig extends NamedPathConfig {
"didShowWelcome",
"version"
);
@ConfigUI(topPadding = 12)
public static final ConfigToken<Boolean> CHECK_VERSIONS = ConfigToken.Boolean(
true,
"check",
@ -24,12 +23,20 @@ public class ClientConfig extends NamedPathConfig {
"ui"
);
@ConfigUI(leftPadding = 8)
public static final ConfigToken<Boolean> PREFER_MODRINTH_FOR_UPDATES = ConfigToken.Boolean(
true,
"preferModrinthForUpdates",
"ui"
);
@ConfigUI(hide = true)
public static final ConfigToken<Boolean> FORCE_BETTERX_PRESET = ConfigToken.Boolean(
true,
"forceBetterXPreset",
"ui"
);
@ConfigUI(topPadding = 12)
public static final ConfigToken<Boolean> SUPPRESS_EXPERIMENTAL_DIALOG = ConfigToken.Boolean(
false,
"suppressExperimentalDialogOnLoad",
@ -107,6 +114,8 @@ public class ClientConfig extends NamedPathConfig {
"rendering",
(config) -> config.get(CUSTOM_FOG_RENDERING)
);
@ConfigUI(topPadding = 12)
public static final ConfigToken<Boolean> SURVIES_ON_HINT = ConfigToken.Boolean(
true,
"survives_on_hint",
@ -194,8 +203,12 @@ public class ClientConfig extends NamedPathConfig {
public void setForceBetterXPreset(boolean v) {
set(FORCE_BETTERX_PRESET, v);
}
public boolean survivesOnHint() {
return get(ClientConfig.SURVIES_ON_HINT);
}
public boolean preferModrinthForUpdates() {
return get(ClientConfig.PREFER_MODRINTH_FOR_UPDATES);
}
}

View file

@ -3,11 +3,7 @@ package org.betterx.bclib.config;
import org.betterx.bclib.BCLib;
public class MainConfig extends NamedPathConfig {
public static final ConfigToken<Boolean> VERBOSE_LOGGING = ConfigToken.Boolean(
true,
"verbose",
Configs.MAIN_INFO_CATEGORY
);
public static final ConfigToken<Boolean> APPLY_PATCHES = ConfigToken.Boolean(
true,
@ -15,7 +11,7 @@ public class MainConfig extends NamedPathConfig {
Configs.MAIN_PATCH_CATEGORY
);
@ConfigUI(leftPadding = 8, topPadding = 8)
@ConfigUI(leftPadding = 8)
public static final ConfigToken<Boolean> REPAIR_BIOMES = DependendConfigToken.Boolean(
false,
"repairBiomesOnLoad",
@ -24,6 +20,13 @@ public class MainConfig extends NamedPathConfig {
APPLY_PATCHES)
);
@ConfigUI(topPadding = 8)
public static final ConfigToken<Boolean> VERBOSE_LOGGING = ConfigToken.Boolean(
true,
"verbose",
Configs.MAIN_INFO_CATEGORY
);
public MainConfig() {
super(BCLib.MOD_ID, "main", true, true);

View file

@ -131,10 +131,10 @@ public class VersionChecker implements Runnable {
}
if (mod.n != null && mod.v != null && KNOWN_MODS.contains(mod.n)) {
String installedVersion = ModUtil.getModVersion(mod.n);
boolean isNew = ModUtil.isLargerVersion(mod.v, installedVersion) && !installedVersion.equals(
"0.0.0");
boolean isNew = ModUtil.isLargerVersion(mod.v, installedVersion)
&& !installedVersion.equals("0.0.0");
BCLib.LOGGER.info(" - " + mod.n + ":" + mod.v + (isNew ? " (update available)" : ""));
if (isNew)
if (true || isNew)
NEW_VERSIONS.add(mod);
}
}

View file

@ -73,6 +73,8 @@
"title.config.bclib.client.rendering.customFogRendering": "Angepasster Nebel",
"title.config.bclib.client.rendering.netherThickFog": "Dicker Nether-Nebel",
"bclib.updates.curseforge_link": "[CurseForge]",
"bclib.updates.modrinth_link": "[Modrinth]",
"bclib.updates.download_link": "Herunterladen",
"bclib.updates.title": "Mod Aktualisierungen",
"bclib.updates.disable_check": "Nicht Prüfen",
"bclib.updates.donate_pre": "Gefallen Dir unsere Inhalte?\nDann erwäge eine kleine Spende :)",
@ -88,6 +90,7 @@
"title.config.bclib.main.infos.verbose": "Ausführliche Logs",
"title.config.bclib.client.infos.survives_on_hint": "Zeige 'Überlebt auf' Tooltip",
"description.config.bclib.client.ui.suppressExperimentalDialogOnLoad": "Der Warnbildschirm wird immer dann angezeigt, wenn Deine Welt nicht die Einstellungen der Vanilla-Version verwendet. Dies kann passieren, wenn Du eine Welt in einer Vorschauversion startest, aber auch wenn Du Mods verwendest, um die Welterzeugung zu verändern. Wenn diese Option aktiviert ist, wird die Warnung übersprungen, wenn Du eine bestehende Welt lädst. Sie wird weiterhin angezeigt (als Erinnerung), wenn eine neue Welt erstellt wird.",
"title.config.bclib.client.ui.preferModrinthForUpdates": "Bevorzuge Updates über Modrinth",
"title.config.bclib.client.ui.forceBetterXPreset": "BetterX als Standard-Welt-Typ verwenden",
"description.config.bclib.client.ui.forceBetterXPreset": "Der Welt-Typ bestimmt, wie eine Welt generiert wird. In den meisten Fällen solltet BetterX als Standardeinstellung beibehalten werden (Du kannst den Typ jederzeit im Welt-Erstellen-Bildschirm ändern). Dieser Typ ist für maximale Kompatibilität zwischen DataPacks, unserer Mod und anderen Fabric-Mods optimiert. Außerdem bietet er einige einzigartige Funktionen für BetterNether und BetterEnd. Du solltest diese Option nur deaktivieren, wenn Du einen Grund dazu hast!",
"warning.config.bclib.client.ui.forceBetterXPreset": "IN DEN MEISTEN FÄLLEN SOLLTE DIESE OPTION AKTIVIERT BLEIBEN.\n",

View file

@ -31,6 +31,7 @@
"title.config.bclib.main.patches.applyPatches": "Automatically apply patches when loading level",
"title.config.bclib.main.patches.repairBiomesOnLoad": "Fix Biomesource on level load",
"title.config.bclib.client.ui.suppressExperimentalDialogOnLoad": "Disable Experimental Warning Screen on Load",
"title.config.bclib.client.ui.preferModrinthForUpdates": "Prefere Modrinth for Updates",
"title.bclib.syncfiles.modInfo": "Mod Info",
"title.bclib.syncfiles.modlist": "Mod Information",
"message.bclib.syncfiles.modlist": "The following shows the state of your installed Mods.\n\nAll Mods that do not exist locally, or have a different version on the Server will be synchronized.",
@ -75,6 +76,8 @@
"title.screen.bclib.worldgen.central_radius": "Central Void Radius (in Chunks)",
"title.screen.bclib.worldgen.end_void": "Generate Small Islands",
"bclib.updates.curseforge_link": "[CurseForge]",
"bclib.updates.modrinth_link": "[Modrinth]",
"bclib.updates.download_link": "Download",
"bclib.updates.title": "Mod Updates",
"bclib.updates.disable_check": "Disable Check",
"bclib.updates.donate_pre": "Like our Content?\nPlease consider a small Donation :)",

View file

@ -10,7 +10,7 @@
"Bulldog83"
],
"contact": {
"homepage": "https://www.curseforge.com/minecraft/mc-mods/bclib",
"homepage": "https://modrinth.com/mod/bclib",
"issues": "https://github.com/quiqueck/bclib/issues",
"sources": "https://github.com/quiqueck/bclib"
},
@ -55,6 +55,12 @@
]
},
"custom": {
"bclib": {
"downloads": {
"modrinth": "https://modrinth.com/mod/bclib",
"curseforge": "https://www.curseforge.com/minecraft/mc-mods/bclib"
}
},
"modmenu": {
"links": {
"title.link.bclib.discord": "https://discord.gg/kYuATbYbKW"