Fix up version handling properly. Hopefully, and the error screen.
This commit is contained in:
parent
675f4115aa
commit
87fa59b0f7
7 changed files with 47 additions and 16 deletions
|
@ -184,9 +184,7 @@ public class FMLClientHandler implements IFMLSidedHandler
|
|||
{
|
||||
if (modsMissing != null)
|
||||
{
|
||||
ModsMissingGuiScreen err = new ModsMissingGuiScreen();
|
||||
err.setList(modsMissing);
|
||||
client.func_71373_a(err);
|
||||
client.func_71373_a(new GuiModsMissing(modsMissing));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -4,13 +4,12 @@ import cpw.mods.fml.common.MissingModsException;
|
|||
import cpw.mods.fml.common.versioning.ArtifactVersion;
|
||||
import net.minecraft.src.GuiErrorScreen;
|
||||
|
||||
public class ModsMissingGuiScreen extends GuiErrorScreen
|
||||
public class GuiModsMissing extends GuiErrorScreen
|
||||
{
|
||||
|
||||
private MissingModsException modsMissing;
|
||||
|
||||
|
||||
public void setList(MissingModsException modsMissing)
|
||||
public GuiModsMissing(MissingModsException modsMissing)
|
||||
{
|
||||
this.modsMissing = modsMissing;
|
||||
}
|
||||
|
@ -27,7 +26,7 @@ public class ModsMissingGuiScreen extends GuiErrorScreen
|
|||
for (ArtifactVersion v : modsMissing.missingMods)
|
||||
{
|
||||
offset+=10;
|
||||
this.func_73732_a(this.field_73886_k, String.format("%s : %s", v.getLabel(), v.getVersionString()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||
this.func_73732_a(this.field_73886_k, String.format("%s : %s", v.getLabel(), v.getRangeString()), this.field_73880_f / 2, offset, 0xEEEEEE);
|
||||
}
|
||||
offset+=20;
|
||||
this.func_73732_a(this.field_73886_k, "The file 'ForgeModLoader-client-0.log' contains more information", this.field_73880_f / 2, offset, 0xFFFFFF);
|
|
@ -35,6 +35,7 @@ import com.google.common.collect.HashBiMap;
|
|||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableMultiset;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
|
@ -185,28 +186,39 @@ public class Loader
|
|||
|
||||
for (ModContainer mod : getActiveModList())
|
||||
{
|
||||
Set<ArtifactVersion> missingMods = Sets.difference(mod.getRequirements(), modVersions.values());
|
||||
Map<String,ArtifactVersion> names = Maps.uniqueIndex(mod.getRequirements(), new Function<ArtifactVersion, String>()
|
||||
{
|
||||
public String apply(ArtifactVersion v)
|
||||
{
|
||||
return v.getLabel();
|
||||
}
|
||||
});
|
||||
Set<String> missingMods = Sets.difference(names.keySet(), modVersions.keySet());
|
||||
Set<ArtifactVersion> versionMissingMods = Sets.newHashSet();
|
||||
if (!missingMods.isEmpty())
|
||||
{
|
||||
FMLLog.severe("The mod %s (%s) requires mods %s to be available", mod.getModId(), mod.getName(), missingMods);
|
||||
throw new MissingModsException(missingMods);
|
||||
for (String modid : missingMods)
|
||||
{
|
||||
versionMissingMods.add(names.get(modid));
|
||||
}
|
||||
throw new MissingModsException(versionMissingMods);
|
||||
}
|
||||
ImmutableList<ArtifactVersion> allDeps = ImmutableList.<ArtifactVersion>builder().addAll(mod.getDependants()).addAll(mod.getDependencies()).build();
|
||||
for (ArtifactVersion v : allDeps)
|
||||
{
|
||||
missingMods = Sets.newHashSet();
|
||||
if (modVersions.containsKey(v.getLabel()))
|
||||
{
|
||||
if (!v.containsVersion(modVersions.get(v.getLabel())))
|
||||
{
|
||||
missingMods.add(v);
|
||||
versionMissingMods.add(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!missingMods.isEmpty())
|
||||
if (!versionMissingMods.isEmpty())
|
||||
{
|
||||
FMLLog.severe("The mod %s (%s) requires mod versions %s to be available", mod.getModId(), mod.getName(), missingMods);
|
||||
throw new MissingModsException(missingMods);
|
||||
throw new MissingModsException(versionMissingMods);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -217,7 +229,10 @@ public class Loader
|
|||
try
|
||||
{
|
||||
FMLLog.fine("Sorting mods into an ordered list");
|
||||
mods = sorter.sort();
|
||||
List<ModContainer> sortedMods = sorter.sort();
|
||||
mods.removeAll(sortedMods);
|
||||
sortedMods.addAll(mods);
|
||||
mods = sortedMods;
|
||||
FMLLog.fine("Mod sorting completed successfully");
|
||||
}
|
||||
catch (ModSortingException sortException)
|
||||
|
|
|
@ -15,5 +15,4 @@ public class MissingModsException extends RuntimeException
|
|||
{
|
||||
this.missingMods = missingMods;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,4 +33,6 @@ public interface ArtifactVersion
|
|||
String getVersionString();
|
||||
|
||||
boolean containsVersion(ArtifactVersion source);
|
||||
|
||||
String getRangeString();
|
||||
}
|
||||
|
|
|
@ -73,9 +73,14 @@ public class DefaultArtifactVersion implements ArtifactVersion
|
|||
@Override
|
||||
public String getVersionString()
|
||||
{
|
||||
return comparableVersion==null ? "any" : comparableVersion.toString();
|
||||
return comparableVersion == null ? "unknown" : comparableVersion.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRangeString()
|
||||
{
|
||||
return range == null ? "any" : range.toString();
|
||||
}
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
--- ../src-base/minecraft/net/minecraft/src/GuiErrorScreen.java
|
||||
+++ ../src-work/minecraft/net/minecraft/src/GuiErrorScreen.java
|
||||
@@ -9,6 +9,10 @@
|
||||
private String field_74001_a;
|
||||
private String field_74000_b;
|
||||
|
||||
+ public GuiErrorScreen()
|
||||
+ {
|
||||
+ }
|
||||
+
|
||||
public void func_73863_a(int p_73863_1_, int p_73863_2_, float p_73863_3_)
|
||||
{
|
||||
this.func_73733_a(0, 0, this.field_73880_f, this.field_73881_g, -12574688, -11530224);
|
Loading…
Reference in a new issue