Fix a fringe case with the Version Checker, finally figured out why some item textures weren't working, and got sounds working too

This commit is contained in:
pahimar 2013-03-04 23:26:26 -05:00
parent 0b49a57a19
commit 148bbacade
6 changed files with 37 additions and 18 deletions

View file

@ -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());

View file

@ -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);
}
}

View file

@ -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));
}
}

View file

@ -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",

View file

@ -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";

View file

@ -33,6 +33,7 @@
<entry key="version.outdated">A new @MOD_NAME@ version exists (@REMOTE_MOD_VERSION@) for @MINECRAFT_VERSION@. Get it here: @MOD_UPDATE_LOCATION@</entry>
<entry key="version.general_error">Error while connecting to remote version authority file; trying again</entry>
<entry key="version.final_error">Version check stopping after three unsuccessful connection attempts</entry>
<entry key="version.mc_version_not_found">Unable to find a version of @MOD_NAME@ for @MINECRAFT_VERSION@ in the remote version authority</entry>
<entry key="command.ee3.overlay.turned_on">Target transmutation overlay turned on</entry>
<entry key="command.ee3.overlay.turned_off">Target transmutation overlay turned off</entry>
<entry key="command.ee3.overlay.position.top_left">Target transmutation overlay position set to top left</entry>