Use more expressive language when a version specifier is a simple unbounded above condition

This commit is contained in:
Christian committed 2013-04-16 13:46:55 -04:00
1 parent 0888a95f2d
commit 3d142df102
3 files changed
+29 -3

No files matched your search

@@ -5,7 +5,7 @@
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*
* Contributors:
* cpw - implementation
*/
@@ -15,6 +15,7 @@ package cpw.mods.fml.client;
import net.minecraft.client.gui.GuiErrorScreen;
import cpw.mods.fml.common.MissingModsException;
import cpw.mods.fml.common.versioning.ArtifactVersion;
import cpw.mods.fml.common.versioning.DefaultArtifactVersion;
public class GuiModsMissing extends GuiErrorScreen
{
@@ -43,6 +44,15 @@ public class GuiModsMissing extends GuiErrorScreen
for (ArtifactVersion v : modsMissing.missingMods)
{
offset+=10;
if (v instanceof DefaultArtifactVersion)
{
DefaultArtifactVersion dav = (DefaultArtifactVersion)v;
if (dav.getRange() != null && dav.getRange().isUnboundedAbove())
{
this.func_73732_a(this.field_73886_k, String.format("%s : minimum version required is %s", v.getLabel(), dav.getRange().getLowerBoundString()), this.field_73880_f / 2, offset, 0xEEEEEE);
continue;
}
}
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;
@@ -5,7 +5,7 @@
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*
* Contributors:
* cpw - implementation
*/
@@ -98,4 +98,9 @@ public class DefaultArtifactVersion implements ArtifactVersion
{
return label == null ? comparableVersion.toString() : label + ( unbounded ? "" : "@" + range);
}
public VersionRange getRange()
{
return range;
}
}
@@ -5,7 +5,7 @@
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
*
* Contributors:
* cpw - implementation
*/
@@ -549,4 +549,15 @@ public class VersionRange
hash = 31 * hash + ( restrictions == null ? 0 : restrictions.hashCode() );
return hash;
}
public boolean isUnboundedAbove()
{
return restrictions.size() == 1 && restrictions.get(0).getUpperBound() == null && !restrictions.get(0).isUpperBoundInclusive();
}
public String getLowerBoundString()
{
return restrictions.size() == 1 ? restrictions.get(0).getLowerBound().getVersionString() : "";
}
}