Update for ForgeSPI change, revert back to VersionStatus checking
This commit is contained in:
parent
c2a7fe4019
commit
da33233762
4 changed files with 16 additions and 13 deletions
|
@ -35,7 +35,6 @@ public class ModFileInfo implements IModFileInfo
|
|||
{
|
||||
private final UnmodifiableConfig config;
|
||||
private final ModFile modFile;
|
||||
private final URL updateJSONURL;
|
||||
private final URL issueURL;
|
||||
private final String modLoader;
|
||||
private final VersionRange modLoaderVersion;
|
||||
|
@ -59,7 +58,6 @@ public class ModFileInfo implements IModFileInfo
|
|||
throw new InvalidModFileException("Missing mods list", this);
|
||||
}
|
||||
this.mods = modConfigs.stream().map(mi-> new ModInfo(this, mi)).collect(Collectors.toList());
|
||||
this.updateJSONURL = config.<String>getOptional("updateJSONURL").map(StringUtils::toURL).orElse(null);
|
||||
this.issueURL = config.<String>getOptional("issueTrackerURL").map(StringUtils::toURL).orElse(null);
|
||||
}
|
||||
|
||||
|
@ -80,12 +78,6 @@ public class ModFileInfo implements IModFileInfo
|
|||
return this.config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getUpdateURL(IModFileInfo modFileInfo)
|
||||
{
|
||||
return this.updateJSONURL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModLoader()
|
||||
{
|
||||
|
|
|
@ -20,9 +20,11 @@
|
|||
package net.minecraftforge.fml.loading.moddiscovery;
|
||||
|
||||
import com.electronwill.nightconfig.core.UnmodifiableConfig;
|
||||
import net.minecraftforge.fml.loading.StringUtils;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import net.minecraftforge.fml.loading.StringSubstitutor;
|
||||
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -48,6 +50,7 @@ public class ModInfo implements IModInfo
|
|||
private final ArtifactVersion version;
|
||||
private final String displayName;
|
||||
private final String description;
|
||||
private final URL updateJSONURL;
|
||||
private final List<IModInfo.ModVersion> dependencies;
|
||||
private final Map<String,Object> properties;
|
||||
private final UnmodifiableConfig modConfig;
|
||||
|
@ -71,6 +74,7 @@ public class ModInfo implements IModInfo
|
|||
map(DefaultArtifactVersion::new).orElse(DEFAULT_VERSION);
|
||||
this.displayName = modConfig.<String>getOptional("displayName").orElse(null);
|
||||
this.description = modConfig.get("description");
|
||||
this.updateJSONURL = modConfig.<String>getOptional("updateJSONURL").map(StringUtils::toURL).orElse(null);
|
||||
if (owningFile != null) {
|
||||
this.dependencies = owningFile.getConfig().<List<UnmodifiableConfig>>getOptional(Arrays.asList("dependencies", this.modId)).
|
||||
orElse(Collections.emptyList()).stream().map(dep -> new ModVersion(this, dep)).collect(Collectors.toList());
|
||||
|
@ -103,6 +107,7 @@ public class ModInfo implements IModInfo
|
|||
{
|
||||
return this.description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArtifactVersion getVersion() {
|
||||
return version;
|
||||
|
@ -128,6 +133,11 @@ public class ModInfo implements IModInfo
|
|||
return this.properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public URL getUpdateURL() {
|
||||
return this.updateJSONURL;
|
||||
}
|
||||
|
||||
public Optional<String> getLogoFile()
|
||||
{
|
||||
return this.owningFile != null ? this.owningFile.getConfig().getOptional("logoFile") : this.modConfig.getOptional("logoFile");
|
||||
|
|
|
@ -298,7 +298,8 @@ public class ForgeHooksClient
|
|||
|
||||
public static void renderMainMenu(GuiMainMenu gui, FontRenderer font, int width, int height)
|
||||
{
|
||||
if (ForgeVersion.getVersion().getMinorVersion() == 0)
|
||||
VersionChecker.Status status = ForgeVersion.getStatus();
|
||||
if (status == BETA || status == BETA_OUTDATED)
|
||||
{
|
||||
// render a warning at the top of the screen,
|
||||
String line = I18n.format("forge.update.beta.1", TextFormatting.RED, TextFormatting.RESET);
|
||||
|
@ -308,7 +309,7 @@ public class ForgeHooksClient
|
|||
}
|
||||
|
||||
String line = null;
|
||||
switch(ForgeVersion.getStatus())
|
||||
switch(status)
|
||||
{
|
||||
//case FAILED: line = " Version check failed"; break;
|
||||
//case UP_TO_DATE: line = "Forge up to date"}; break;
|
||||
|
|
|
@ -36,7 +36,7 @@ public class ForgeVersion
|
|||
// This is Forge's Mod Id, used for the ForgeMod and resource locations
|
||||
public static final String MOD_ID = "forge";
|
||||
|
||||
private static final ArtifactVersion forgeVersion;
|
||||
private static final String forgeVersion;
|
||||
private static final String forgeSpec;
|
||||
private static final String forgeGroup;
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class ForgeVersion
|
|||
if (group == null) {
|
||||
group = "net.minecraftforge"; // If all else fails, Our normal group
|
||||
}
|
||||
forgeVersion = new DefaultArtifactVersion(vers);
|
||||
forgeVersion = vers;
|
||||
forgeSpec = spec;
|
||||
forgeGroup = group;
|
||||
LOGGER.debug(CORE, "Found Forge version {}", forgeVersion);
|
||||
|
@ -58,7 +58,7 @@ public class ForgeVersion
|
|||
LOGGER.debug(CORE, "Found Forge group {}", forgeGroup);
|
||||
}
|
||||
|
||||
public static ArtifactVersion getVersion()
|
||||
public static String getVersion()
|
||||
{
|
||||
return forgeVersion;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue