From 148bbacade77314d9af9495305748c1c5755bf8b Mon Sep 17 00:00:00 2001 From: pahimar Date: Mon, 4 Mar 2013 23:26:26 -0500 Subject: [PATCH] Fix a fringe case with the Version Checker, finally figured out why some item textures weren't working, and got sounds working too --- .../com/pahimar/ee3/EquivalentExchange3.java | 22 +++++++--------- .../ee3/core/helper/VersionHelper.java | 25 +++++++++++++++++-- ee3_common/com/pahimar/ee3/item/ItemEE.java | 2 +- ee3_common/com/pahimar/ee3/lib/Sounds.java | 4 +-- ee3_common/com/pahimar/ee3/lib/Strings.java | 1 + resources/mods/ee3/lang/en_US.xml | 1 + 6 files changed, 37 insertions(+), 18 deletions(-) diff --git a/ee3_common/com/pahimar/ee3/EquivalentExchange3.java b/ee3_common/com/pahimar/ee3/EquivalentExchange3.java index 7e978f6e..3b695b4e 100644 --- a/ee3_common/com/pahimar/ee3/EquivalentExchange3.java +++ b/ee3_common/com/pahimar/ee3/EquivalentExchange3.java @@ -53,17 +53,14 @@ import cpw.mods.fml.relauncher.Side; * @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html) * */ -@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, - version = Reference.VERSION) -@NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, - serverSideRequired = false, packetHandler = PacketHandler.class) +@Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION) +@NetworkMod(channels = { Reference.CHANNEL_NAME }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class) public class EquivalentExchange3 { @Instance(Reference.MOD_ID) public static EquivalentExchange3 instance; - @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, - serverSide = Reference.SERVER_PROXY_CLASS) + @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) public static CommonProxy proxy; public static CreativeTabs tabsEE3 = new CreativeTabEE3(CreativeTabs.getNextID(), Reference.MOD_ID); @@ -101,7 +98,12 @@ public class EquivalentExchange3 { // Register the Sound Handler (Client only) proxy.registerSoundHandler(); + + // Initialize mod blocks + ModBlocks.init(); + // Initialize mod items + ModItems.init(); } @Init @@ -131,12 +133,6 @@ public class EquivalentExchange3 { // Register the DrawBlockHighlight Handler proxy.registerDrawBlockHighlightHandler(); - // Initialize mod blocks - ModBlocks.init(); - - // Initialize mod items - ModItems.init(); - // Initialize mod tile entities proxy.initTileEntities(); @@ -144,7 +140,7 @@ public class EquivalentExchange3 { proxy.initRenderingAndTextures(); // Load the Transmutation Stone recipes - //RecipesTransmutationStone.init(); + RecipesTransmutationStone.init(); // Register the Fuel Handler GameRegistry.registerFuelHandler(new FuelHandler()); diff --git a/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java b/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java index d8949e74..8d9352d4 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java +++ b/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java @@ -42,6 +42,7 @@ public class VersionHelper implements Runnable { public static final byte OUTDATED = 2; public static final byte ERROR = 3; public static final byte FINAL_ERROR = 4; + public static final byte MC_VERSION_NOT_FOUND = 5; // Var to hold the result of the remote version check, initially set to uninitialized private static byte result = UNINITIALIZED; @@ -81,7 +82,12 @@ public class VersionHelper implements Runnable { } } - result = OUTDATED; + if (remoteVersionProperty == null) { + result = MC_VERSION_NOT_FOUND; + } + else { + result = OUTDATED; + } } catch (Exception e) { } @@ -129,14 +135,29 @@ public class VersionHelper implements Runnable { returnString = returnString.replace("@MOD_UPDATE_LOCATION@", remoteUpdateLocation); return returnString; } + else if ((result == OUTDATED) && (remoteVersion != null) && (remoteUpdateLocation != null)) { + String returnString = LanguageRegistry.instance().getStringLocalization(Strings.OUTDATED_MESSAGE); + returnString = returnString.replace("@MOD_NAME@", Reference.MOD_NAME); + returnString = returnString.replace("@REMOTE_MOD_VERSION@", remoteVersion); + returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString()); + returnString = returnString.replace("@MOD_UPDATE_LOCATION@", remoteUpdateLocation); + return returnString; + } else if (result == ERROR) { return LanguageRegistry.instance().getStringLocalization(Strings.GENERAL_ERROR_MESSAGE); } else if (result == FINAL_ERROR) { return LanguageRegistry.instance().getStringLocalization(Strings.FINAL_ERROR_MESSAGE); } + else if (result == MC_VERSION_NOT_FOUND) { + String returnString = LanguageRegistry.instance().getStringLocalization(Strings.MC_VERSION_NOT_FOUND); + returnString = returnString.replace("@MOD_NAME@", Reference.MOD_NAME); + returnString = returnString.replace("@MINECRAFT_VERSION@", Loader.instance().getMCVersionString()); + return returnString; + } else { - return null; + result = ERROR; + return LanguageRegistry.instance().getStringLocalization(Strings.GENERAL_ERROR_MESSAGE); } } diff --git a/ee3_common/com/pahimar/ee3/item/ItemEE.java b/ee3_common/com/pahimar/ee3/item/ItemEE.java index b9ded75f..67aeea6b 100644 --- a/ee3_common/com/pahimar/ee3/item/ItemEE.java +++ b/ee3_common/com/pahimar/ee3/item/ItemEE.java @@ -30,6 +30,6 @@ public class ItemEE extends Item { @SideOnly(Side.CLIENT) // public void setIconIndex(IconRegister iconRegister) public void func_94581_a(IconRegister iconRegister) { - this.iconIndex = iconRegister.func_94245_a(Reference.MOD_ID.toLowerCase() + ":"+ this.getUnlocalizedName()); + this.iconIndex = iconRegister.func_94245_a(Reference.MOD_ID.toLowerCase() + ":"+ this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); } } diff --git a/ee3_common/com/pahimar/ee3/lib/Sounds.java b/ee3_common/com/pahimar/ee3/lib/Sounds.java index c0381896..c9fc8465 100644 --- a/ee3_common/com/pahimar/ee3/lib/Sounds.java +++ b/ee3_common/com/pahimar/ee3/lib/Sounds.java @@ -11,8 +11,8 @@ package com.pahimar.ee3.lib; */ public class Sounds { - private static final String SOUND_RESOURCE_LOCATION = "com/pahimar/ee3/sound/"; - private static final String SOUND_PREFIX = "com.pahimar.ee3.sound."; + private static final String SOUND_RESOURCE_LOCATION = "mods/ee3/sound/"; + private static final String SOUND_PREFIX = "mods.ee3.sound."; public static String[] soundFiles = { SOUND_RESOURCE_LOCATION + "chargeDown.ogg", diff --git a/ee3_common/com/pahimar/ee3/lib/Strings.java b/ee3_common/com/pahimar/ee3/lib/Strings.java index 94fe44b7..e6d43b42 100644 --- a/ee3_common/com/pahimar/ee3/lib/Strings.java +++ b/ee3_common/com/pahimar/ee3/lib/Strings.java @@ -13,6 +13,7 @@ public class Strings { public static final String OUTDATED_MESSAGE = "version.outdated"; public static final String GENERAL_ERROR_MESSAGE = "version.general_error"; public static final String FINAL_ERROR_MESSAGE = "version.final_error"; + public static final String MC_VERSION_NOT_FOUND = "version.mc_version_not_found"; /* Gui related constants */ public static final String GUI_CALCINATOR_NAME = "gui.calcinator.name"; diff --git a/resources/mods/ee3/lang/en_US.xml b/resources/mods/ee3/lang/en_US.xml index b3a9fa7e..110d860c 100644 --- a/resources/mods/ee3/lang/en_US.xml +++ b/resources/mods/ee3/lang/en_US.xml @@ -33,6 +33,7 @@ A new @MOD_NAME@ version exists (@REMOTE_MOD_VERSION@) for @MINECRAFT_VERSION@. Get it here: @MOD_UPDATE_LOCATION@ Error while connecting to remote version authority file; trying again Version check stopping after three unsuccessful connection attempts + Unable to find a version of @MOD_NAME@ for @MINECRAFT_VERSION@ in the remote version authority Target transmutation overlay turned on Target transmutation overlay turned off Target transmutation overlay position set to top left