Fixing problems with grafter not enchanting; version checking.

This commit is contained in:
MysteriousAges committed 2013-03-06 13:42:57 -08:00
1 parent 1a394ce858
commit 9bed2d3749
3 files changed
+21 -11

No files matched your search

+3 -1
View File
@@ -1,4 +1,6 @@
Changed Version info embedded in mod to match format supported by Version checking.
1.4.3a
Changed Version info embedded in mod to match format supported by Version checking. Will need to make this more robust in the future.
Fixed bug with Thaumium Grafter not being enchantable.
1.4.3
Added automatic version-checking for ThaumicBees! From this version on, when a new version becomes available, it will notify you in-game. Notifications can be switched off via a config file option.
@@ -16,15 +16,15 @@ import net.minecraftforge.common.ForgeHooks;
public class ItemThaumiumGrafter extends Item implements IVisRepairable, IToolGrafter
{
public ItemThaumiumGrafter(int id)
{
super(id);
this.setCreativeTab(forestry.api.core.Tabs.tabArboriculture);
this.setMaxStackSize(1);
this.setMaxDamage(15);
this.setTextureFile(CommonProxy.TCBEES_ITEMS_IMAGE);
this.setIconIndex(21);
this.setTextureFile(CommonProxy.TCBEES_ITEMS_IMAGE);
this.setItemName("tb.thaumiumGrafter");
this.setCreativeTab(forestry.api.core.Tabs.tabArboriculture);
}
@Override
@@ -22,7 +22,7 @@ import cpw.mods.fml.relauncher.Side;
public class VersionInfo
{
public static final String Version = "@VERSION@";
public static final String Version = "1.4.3";
public static final String Build = "@BUILD_NUMBER@";
public static final String MCVersion = "@MCVERSION@";
public static final String VersionURL = "http://bit.ly/thaumicbeeversion";
@@ -52,18 +52,20 @@ public class VersionInfo
for (int i = 0; i < tokens.length; ++i)
{
if (tokens[i].matches("[0-9]+[a-z]"))
tokens[i] = tokens[i].trim();
if (tokens[i].matches("[0-9]+"))
{
versionTokens.add(Integer.valueOf(tokens[i]));
}
else if (tokens[i].matches("[0-9]+[a-z]"))
{
String numberString = tokens[i].substring(0, tokens[i].length()-1);
versionTokens.add(Integer.valueOf(numberString));
versionTokens.add(Character.getNumericValue(tokens[i].charAt(tokens[i].length()-1)));
}
else
{
versionTokens.add(Integer.valueOf(tokens[i]));
}
}
// Can't use versionTokens.toArray 'cause that returns an Integer[], not int[]
int[] value = new int[versionTokens.size()];
for (int i = 0; i < value.length; ++i)
{
@@ -91,6 +93,13 @@ public class VersionInfo
result = false;
break;
}
if (i == versionTokens.length-1 && versionTokens.length < targetTokens.length)
{
// If the versions compared are the same, but target has an extra token, it's probably a "letter" build
// and is ahead of this one.
result = true;
}
}
return result;
@@ -181,7 +190,6 @@ public class VersionInfo
@Override
public void run()
{
try
{
String location = VersionURL;