diff --git a/common/cpw/mods/fml/common/FMLHooks.java b/common/cpw/mods/fml/common/FMLCommonHandler.java similarity index 74% rename from common/cpw/mods/fml/common/FMLHooks.java rename to common/cpw/mods/fml/common/FMLCommonHandler.java index af149f5126..eedb829bb4 100644 --- a/common/cpw/mods/fml/common/FMLHooks.java +++ b/common/cpw/mods/fml/common/FMLCommonHandler.java @@ -18,18 +18,34 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; +import java.util.logging.Logger; import net.minecraft.src.EntityPlayer; -public class FMLHooks +public class FMLCommonHandler { - private static final FMLHooks INSTANCE = new FMLHooks(); + private static final FMLCommonHandler INSTANCE = new FMLCommonHandler(); private Map> channelList = new HashMap>(); private Map modChannels = new HashMap(); private Map> activeChannels = new HashMap>(); - + private IFMLSidedHandler sidedDelegate; + + private FMLCommonHandler() { + try { + Class.forName("net.minecraft.client.Minecraft"); + sidedDelegate=(IFMLSidedHandler) Class.forName("cpw.mods.fml.client.FMLClientHandler").newInstance(); + } catch (Exception ex) { + try { + sidedDelegate=(IFMLSidedHandler) Class.forName("cpw.mods.fml.server.FMLServerHandler").newInstance(); + } catch (Exception ex2) { + Loader.log.severe("A severe installation issue has occured with FML, we cannot continue"); + throw new LoaderException(ex2); + } + } + } + public void gameTickStart() { for (ModContainer mod : Loader.getModList()) @@ -49,7 +65,7 @@ public class FMLHooks /** * @return the instance */ - public static FMLHooks instance() + public static FMLCommonHandler instance() { return INSTANCE; } @@ -151,4 +167,22 @@ public class FMLHooks { return activeChannels.get(player).contains(channel); } + + public Logger getFMLLogger() { + return Loader.log; + } + + public Logger getMinecraftLogger() { + return sidedDelegate.getMinecraftLogger(); + } + + public boolean isModLoaderMod(Class clazz) + { + return sidedDelegate.isModLoaderMod(clazz); + } + + public ModContainer loadBaseModMod(Class clazz, String canonicalPath) + { + return sidedDelegate.loadBaseModMod(clazz, canonicalPath); + } } diff --git a/common/cpw/mods/fml/common/IFMLSidedHandler.java b/common/cpw/mods/fml/common/IFMLSidedHandler.java new file mode 100644 index 0000000000..0717002329 --- /dev/null +++ b/common/cpw/mods/fml/common/IFMLSidedHandler.java @@ -0,0 +1,12 @@ +package cpw.mods.fml.common; + +import java.util.logging.Logger; + +public interface IFMLSidedHandler +{ + Logger getMinecraftLogger(); + boolean isModLoaderMod(Class clazz); + ModContainer loadBaseModMod(Class clazz, String canonicalPath); + boolean isServer(); + boolean isClient(); +} diff --git a/common/cpw/mods/fml/common/Loader.java b/common/cpw/mods/fml/common/Loader.java index f155e43fb0..909763806c 100644 --- a/common/cpw/mods/fml/common/Loader.java +++ b/common/cpw/mods/fml/common/Loader.java @@ -32,7 +32,6 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import cpw.mods.fml.common.toposort.ModSorter; -import cpw.mods.fml.server.FMLHandler; public class Loader { @@ -71,7 +70,7 @@ public class Loader } private Loader() { - Loader.log.setParent(FMLHandler.getMinecraftLogger()); + Loader.log.setParent(FMLCommonHandler.instance().getMinecraftLogger()); Loader.log.setLevel(Level.ALL); FileHandler fileHandler; @@ -79,7 +78,7 @@ public class Loader { fileHandler = new FileHandler("ForgeModLoader-%g.log", 0, 3); // We're stealing minecraft's log formatter - fileHandler.setFormatter(FMLHandler.getMinecraftLogger().getHandlers()[0].getFormatter()); + fileHandler.setFormatter(FMLCommonHandler.instance().getMinecraftLogger().getHandlers()[0].getFormatter()); fileHandler.setLevel(Level.ALL); Loader.log.addHandler(fileHandler); } @@ -331,10 +330,10 @@ public class Loader // an FML mod mods.add(FMLModContainer.buildFor(clazz)); } - else if (FMLHandler.instance().isModLoaderMod(clazz)) + else if (FMLCommonHandler.instance().isModLoaderMod(clazz)) { log.fine(String.format("ModLoader BaseMod class %s found, loading", clazzName)); - ModContainer mc = FMLHandler.instance().loadBaseModMod(clazz, classSource.getCanonicalPath()); + ModContainer mc = FMLCommonHandler.instance().loadBaseModMod(clazz, classSource.getCanonicalPath()); mods.add(mc); log.fine(String.format("ModLoader BaseMod class %s loaded", clazzName)); } diff --git a/common/cpw/mods/fml/common/ReflectionHelper.java b/common/cpw/mods/fml/common/ReflectionHelper.java index 7aceeae98a..2bf5a2bdac 100644 --- a/common/cpw/mods/fml/common/ReflectionHelper.java +++ b/common/cpw/mods/fml/common/ReflectionHelper.java @@ -14,8 +14,6 @@ package cpw.mods.fml.common; import java.lang.reflect.Field; -import cpw.mods.fml.server.FMLHandler; - public class ReflectionHelper { @SuppressWarnings("unchecked") @@ -29,8 +27,8 @@ public class ReflectionHelper } catch (Exception e) { - FMLHandler.getFMLLogger().severe(String.format("There was a problem getting field %d from %s", fieldIndex, classToAccess.getName())); - FMLHandler.getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e); + FMLCommonHandler.instance().getFMLLogger().severe(String.format("There was a problem getting field %d from %s", fieldIndex, classToAccess.getName())); + FMLCommonHandler.instance().getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e); throw new RuntimeException(e); } } @@ -46,8 +44,8 @@ public class ReflectionHelper } catch (Exception e) { - FMLHandler.getFMLLogger().severe(String.format("There was a problem getting field %s from %s", fieldName, classToAccess.getName())); - FMLHandler.getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e); + FMLCommonHandler.instance().getFMLLogger().severe(String.format("There was a problem getting field %s from %s", fieldName, classToAccess.getName())); + FMLCommonHandler.instance().getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e); throw new RuntimeException(e); } } @@ -62,8 +60,8 @@ public class ReflectionHelper } catch (Exception e) { - FMLHandler.getFMLLogger().severe(String.format("There was a problem setting field %d from %s", fieldIndex, classToAccess.getName())); - FMLHandler.getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e); + FMLCommonHandler.instance().getFMLLogger().severe(String.format("There was a problem setting field %d from %s", fieldIndex, classToAccess.getName())); + FMLCommonHandler.instance().getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e); throw new RuntimeException(e); } } @@ -78,8 +76,8 @@ public class ReflectionHelper } catch (Exception e) { - FMLHandler.getFMLLogger().severe(String.format("There was a problem setting field %s from %s", fieldName, classToAccess.getName())); - FMLHandler.getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e); + FMLCommonHandler.instance().getFMLLogger().severe(String.format("There was a problem setting field %s from %s", fieldName, classToAccess.getName())); + FMLCommonHandler.instance().getFMLLogger().throwing("ReflectionHelper", "getPrivateValue", e); throw new RuntimeException(e); } } diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Clean-Client/placeholder b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Clean-Client/placeholder deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Clean-Server/placeholder b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/Clean-Server/placeholder deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/FML-Client/placeholder b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/FML-Client/placeholder deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/FML-Server/placeholder b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.projects/FML-Server/placeholder deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.resources/.snap b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.snap new file mode 100644 index 0000000000..e3ccec7a44 Binary files /dev/null and b/eclipse/.metadata/.plugins/org.eclipse.core.resources/.snap differ diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs index e31ce19f96..b570e7c256 100644 --- a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.debug.ui.prefs @@ -1,9 +1,8 @@ -#Wed Apr 04 23:17:19 PDT 2012 -pref_state_memento.org.eclipse.debug.ui.DebugVieworg.eclipse.debug.ui.DebugView=\r\n -eclipse.preferences.version=1 -org.eclipse.debug.ui.UseContextualLaunch=false -Console.highWaterMark=88000 -preferredTargets=default\:default| -org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=\r\n\r\n -org.eclipse.debug.ui.user_view_bindings=\r\n\r\n\r\n\r\n\r\n\r\n -StringVariablePreferencePage=130,107,107,86, +Console.highWaterMark=88000 +StringVariablePreferencePage=130,107,107,86, +eclipse.preferences.version=1 +org.eclipse.debug.ui.PREF_LAUNCH_PERSPECTIVES=\n\n +org.eclipse.debug.ui.UseContextualLaunch=false +org.eclipse.debug.ui.user_view_bindings=\r\n\r\n\r\n\r\n\r\n\r\n +pref_state_memento.org.eclipse.debug.ui.DebugVieworg.eclipse.debug.ui.DebugView=\r\n +preferredTargets=default\:default|default,org.eclipse.cdt.debug.ui.toggleCBreakpointTarget\:default|org.eclipse.cdt.debug.ui.toggleCBreakpointTarget\:org.eclipse.cdt.debug.ui.toggleCBreakpointTarget| diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs index 15c3ceb566..b8548e8d6a 100644 --- a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.jdt.ui.prefs @@ -1,18 +1,21 @@ -#Wed Apr 04 21:53:26 PDT 2012 -useQuickDiffPrefPage=true -proposalOrderMigrated=true -tabWidthPropagated=true -content_assist_proposals_background=255,255,255 -org.eclipse.jdt.ui.javadoclocations.migrated=true -org.eclipse.jdt.ui.formatterprofiles=\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n -useAnnotationsPrefPage=true -org.eclipse.jdt.ui.editor.tab.width= -org.eclipse.jface.textfont=1|Consolas|10.0|0|WINDOWS|1|0|0|0|0|0|0|0|0|1|0|0|0|0|Consolas; -org.eclipse.jdt.ui.formatterprofiles.version=12 -content_assist_number_of_computers=16 -formatter_settings_version=12 -formatter_profile=_FML Code Style -spelling_locale_initialized=true -eclipse.preferences.version=1 -content_assist_proposals_foreground=0,0,0 -fontPropagated=true +content_assist_number_of_computers=13 +content_assist_proposals_background=255,255,255 +content_assist_proposals_foreground=0,0,0 +eclipse.preferences.version=1 +fontPropagated=true +formatter_profile=_FML Code Style +formatter_settings_version=12 +org.eclipse.jdt.ui.editor.tab.width= +org.eclipse.jdt.ui.formatterprofiles=\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n +org.eclipse.jdt.ui.formatterprofiles.version=12 +org.eclipse.jdt.ui.javadoclocations.migrated=true +org.eclipse.jdt.ui.text.code_templates_migrated=true +org.eclipse.jdt.ui.text.custom_code_templates= +org.eclipse.jdt.ui.text.custom_templates= +org.eclipse.jdt.ui.text.templates_migrated=true +org.eclipse.jface.textfont=1|Monospace|10.0|0|GTK|1|; +proposalOrderMigrated=true +spelling_locale_initialized=true +tabWidthPropagated=true +useAnnotationsPrefPage=true +useQuickDiffPrefPage=true diff --git a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs index 8641a11aa0..08076f236a 100644 --- a/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs +++ b/eclipse/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs @@ -1,3 +1,2 @@ -#Wed Apr 04 21:23:51 PDT 2012 -eclipse.preferences.version=1 -showIntro=false +eclipse.preferences.version=1 +showIntro=false diff --git a/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml b/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml index 406792f312..ae4022458b 100644 --- a/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml +++ b/eclipse/.metadata/.plugins/org.eclipse.debug.ui/launchConfigurationHistory.xml @@ -1,27 +1,27 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eclipse/FML-Server/.classpath b/eclipse/FML-Server/.classpath index 01adcf4ce9..705ff03fef 100644 --- a/eclipse/FML-Server/.classpath +++ b/eclipse/FML-Server/.classpath @@ -1,9 +1,9 @@ - - - - - - - - - + + + + + + + + + diff --git a/eclipse/FML-Server/.project b/eclipse/FML-Server/.project index 46130ef0de..35fde0d418 100644 --- a/eclipse/FML-Server/.project +++ b/eclipse/FML-Server/.project @@ -1,56 +1,56 @@ - - - FML-Server - - - - - - org.eclipse.jdt.core.javabuilder - - - - - - org.eclipse.jdt.core.javanature - - - - common - 2 - MCP_LOC/FML/common - - - jars - 2 - MCP_LOC/jars - - - server - 2 - MCP_LOC/FML/server - - - src - 2 - MCP_LOC/src-work/minecraft_server - - - - - 0 - jars - 13 - - org.eclipse.ui.ide.multiFilter - 1.0-name-matches-false-false-*.jar - - - - - - MCP_LOC - $%7BPARENT-2-WORKSPACE_LOC%7D - - - + + + FML-Server + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + + + common + 2 + MCP_LOC/FML/common + + + jars + 2 + MCP_LOC/jars + + + server + 2 + MCP_LOC/FML/server + + + src + 2 + MCP_LOC/src-work/minecraft_server + + + + + 0 + jars + 13 + + org.eclipse.ui.ide.multiFilter + 1.0-name-matches-false-false-*.jar + + + + + + MCP_LOC + $%7BPARENT-2-WORKSPACE_LOC%7D + + + diff --git a/server/cpw/mods/fml/server/FMLHandler.java b/server/cpw/mods/fml/server/FMLServerHandler.java similarity index 87% rename from server/cpw/mods/fml/server/FMLHandler.java rename to server/cpw/mods/fml/server/FMLServerHandler.java index f7013f1ac9..6a16c2789a 100644 --- a/server/cpw/mods/fml/server/FMLHandler.java +++ b/server/cpw/mods/fml/server/FMLServerHandler.java @@ -30,13 +30,14 @@ import net.minecraft.src.Packet1Login; import net.minecraft.src.Packet250CustomPayload; import net.minecraft.src.Packet3Chat; import net.minecraft.src.World; -import cpw.mods.fml.common.FMLHooks; +import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.IFMLSidedHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ModContainer; -public class FMLHandler +public class FMLServerHandler implements IFMLSidedHandler { - private static final FMLHandler INSTANCE = new FMLHandler(); + private static final FMLServerHandler INSTANCE = new FMLServerHandler(); private MinecraftServer server; @@ -55,12 +56,12 @@ public class FMLHandler public void onPreTick() { - FMLHooks.instance().gameTickStart(); + FMLCommonHandler.instance().gameTickStart(); } public void onPostTick() { - FMLHooks.instance().gameTickEnd(); + FMLCommonHandler.instance().gameTickEnd(); } public MinecraftServer getServer() @@ -68,7 +69,7 @@ public class FMLHandler return server; } - public static Logger getMinecraftLogger() + public Logger getMinecraftLogger() { return MinecraftServer.field_6038_a; } @@ -124,14 +125,9 @@ public class FMLHandler } } - public static Logger getFMLLogger() - { - return Loader.log; - } - public void raiseException(Throwable exception, String message, boolean stopGame) { - getFMLLogger().throwing("FMLHandler", "raiseException", exception); + FMLCommonHandler.instance().getFMLLogger().throwing("FMLHandler", "raiseException", exception); throw new RuntimeException(exception); } @@ -161,7 +157,7 @@ public class FMLHandler /** * @return the instance */ - public static FMLHandler instance() + public static FMLServerHandler instance() { return INSTANCE; } @@ -235,7 +231,7 @@ public class FMLHandler return; } - ModContainer mod = FMLHooks.instance().getModForChannel(packet.field_44005_a); + ModContainer mod = FMLCommonHandler.instance().getModForChannel(packet.field_44005_a); if (mod != null) { @@ -253,18 +249,18 @@ public class FMLHandler for (String channel : new String(packet.field_44004_c, "UTF8").split("\0")) { // Skip it if we don't know it - if (FMLHooks.instance().getModForChannel(channel) == null) + if (FMLCommonHandler.instance().getModForChannel(channel) == null) { continue; } if ("REGISTER".equals(packet.field_44005_a)) { - FMLHooks.instance().activateChannel(player, channel); + FMLCommonHandler.instance().activateChannel(player, channel); } else { - FMLHooks.instance().deactivateChannel(player, channel); + FMLCommonHandler.instance().deactivateChannel(player, channel); } } } @@ -286,8 +282,20 @@ public class FMLHandler Packet250CustomPayload packet = new Packet250CustomPayload(); packet.field_44005_a = "REGISTER"; - packet.field_44004_c = FMLHooks.instance().getPacketRegistry(); + packet.field_44004_c = FMLCommonHandler.instance().getPacketRegistry(); packet.field_44003_b = packet.field_44004_c.length; networkManager.func_745_a(packet); } + + @Override + public boolean isServer() + { + return true; + } + + @Override + public boolean isClient() + { + return false; + } } diff --git a/server/cpw/mods/fml/server/ModLoaderModContainer.java b/server/cpw/mods/fml/server/ModLoaderModContainer.java index d31bdcf24b..1d59c21ad2 100644 --- a/server/cpw/mods/fml/server/ModLoaderModContainer.java +++ b/server/cpw/mods/fml/server/ModLoaderModContainer.java @@ -26,7 +26,7 @@ import java.util.StringTokenizer; import net.minecraft.src.BaseMod; import net.minecraft.src.MLProp; -import cpw.mods.fml.common.FMLHooks; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.ICraftingHandler; import cpw.mods.fml.common.IDispenseHandler; import cpw.mods.fml.common.INetworkHandler; @@ -271,7 +271,7 @@ public class ModLoaderModContainer implements ModContainer { if (isTicking) { - isTicking = mod.onTickInGame(FMLHandler.instance().getServer()); + isTicking = mod.onTickInGame(FMLServerHandler.instance().getServer()); } } @Override @@ -498,6 +498,6 @@ public class ModLoaderModContainer implements ModContainer @Override public boolean ownsNetworkChannel(String channel) { - return FMLHooks.instance().getChannelListFor(this).contains(channel); + return FMLCommonHandler.instance().getChannelListFor(this).contains(channel); } } diff --git a/server/net/minecraft/src/ModLoader.java b/server/net/minecraft/src/ModLoader.java index 64e4a8ccfc..d2541e251f 100644 --- a/server/net/minecraft/src/ModLoader.java +++ b/server/net/minecraft/src/ModLoader.java @@ -16,10 +16,10 @@ import java.util.List; import java.util.logging.Logger; import net.minecraft.server.MinecraftServer; -import cpw.mods.fml.common.FMLHooks; +import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.ReflectionHelper; -import cpw.mods.fml.server.FMLHandler; +import cpw.mods.fml.server.FMLServerHandler; import cpw.mods.fml.server.ModLoaderModContainer; public class ModLoader @@ -38,7 +38,7 @@ public class ModLoader /** * This method is a call in hook from modified external code. Implemented elsewhere. * - * {@link FMLHandler#fuelLookup(int, int)} + * {@link FMLServerHandler#fuelLookup(int, int)} * @param id * @param metadata * @return @@ -176,7 +176,7 @@ public class ModLoader */ public static void addSpawn(Class entityClass, int weightedProb, int min, int max, EnumCreatureType spawnList) { - CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, FMLHandler.instance().getDefaultOverworldBiomes()); + CommonRegistry.addSpawn(entityClass, weightedProb, min, max, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes()); } /** @@ -203,7 +203,7 @@ public class ModLoader */ public static void addSpawn(String entityName, int weightedProb, int min, int max, EnumCreatureType spawnList) { - CommonRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, FMLHandler.instance().getDefaultOverworldBiomes()); + CommonRegistry.addSpawn(entityName, weightedProb, min, max, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes()); } /** @@ -222,7 +222,7 @@ public class ModLoader /** * This method is a call in hook from modified external code. Implemented elsewhere. - * {@link FMLHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)} + * {@link FMLServerHandler#tryDispensingEntity(World, double, double, double, byte, byte, ItemStack)} * @param world * @param x * @param y @@ -307,12 +307,12 @@ public class ModLoader /** * Get a logger instance - * {@link FMLHandler#getFMLLogger()} + * {@link FMLServerHandler#getFMLLogger()} * @return */ public static Logger getLogger() { - return FMLHandler.getFMLLogger(); + return FMLCommonHandler.instance().getFMLLogger(); } /** @@ -364,7 +364,7 @@ public class ModLoader /** * This method is a call in hook from modified external code. Implemented elsewhere. - * {@link FMLHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)} + * {@link FMLServerHandler#handlePacket250(Packet250CustomPayload, EntityPlayer)} * @param packet */ @Deprecated @@ -418,13 +418,13 @@ public class ModLoader /** * Register the mod for packets on this channel. This only registers the channel with Forge Mod Loader, not * with clients connecting- use BaseMod.onClientLogin to tell them about your custom channel - * {@link FMLHooks#registerChannel(cpw.mods.fml.common.ModContainer, String)} + * {@link FMLCommonHandler#registerChannel(cpw.mods.fml.common.ModContainer, String)} * @param mod * @param channel */ public static void registerPacketChannel(BaseMod mod, String channel) { - FMLHooks.instance().registerChannel(ModLoaderModContainer.findContainerFor(mod), channel); + FMLCommonHandler.instance().registerChannel(ModLoaderModContainer.findContainerFor(mod), channel); } /** @@ -454,7 +454,7 @@ public class ModLoader */ public static void removeSpawn(Class entityClass, EnumCreatureType spawnList) { - CommonRegistry.removeSpawn(entityClass, spawnList, FMLHandler.instance().getDefaultOverworldBiomes()); + CommonRegistry.removeSpawn(entityClass, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes()); } /** @@ -475,7 +475,7 @@ public class ModLoader */ public static void removeSpawn(String entityName, EnumCreatureType spawnList) { - CommonRegistry.removeSpawn(entityName, spawnList, FMLHandler.instance().getDefaultOverworldBiomes()); + CommonRegistry.removeSpawn(entityName, spawnList, FMLServerHandler.instance().getDefaultOverworldBiomes()); } /** @@ -500,7 +500,7 @@ public class ModLoader /** * This method is unimplemented on the server: it is meant for clients to send chat to the server - * {@link FMLHandler#handleChatPacket(Packet3Chat, EntityPlayer)} + * {@link FMLServerHandler#handleChatPacket(Packet3Chat, EntityPlayer)} * @param text */ @Deprecated @@ -552,7 +552,7 @@ public class ModLoader /** * This method is a call in hook from modified external code. Implemented elsewhere. - * {@link FMLHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)} + * {@link FMLServerHandler#onItemCrafted(EntityPlayer, ItemStack, IInventory)} * @param player * @param item * @param matrix @@ -564,7 +564,7 @@ public class ModLoader /** * This method is a call in hook from modified external code. Implemented elsewhere. - * {@link FMLHandler#onItemSmelted(EntityPlayer, ItemStack)} + * {@link FMLServerHandler#onItemSmelted(EntityPlayer, ItemStack)} * @param player * @param item */ @@ -575,23 +575,23 @@ public class ModLoader /** * Throw the offered exception. Likely will stop the game. - * {@link FMLHandler#raiseException(Throwable, String, boolean)} + * {@link FMLServerHandler#raiseException(Throwable, String, boolean)} * @param message * @param e */ public static void throwException(String message, Throwable e) { - FMLHandler.instance().raiseException(e, message, true); + FMLServerHandler.instance().raiseException(e, message, true); } /** * Get the minecraft server instance - * {@link FMLHandler#getServer()} + * {@link FMLServerHandler#getServer()} * @return */ public static MinecraftServer getMinecraftServerInstance() { - return FMLHandler.instance().getServer(); + return FMLServerHandler.instance().getServer(); } /** @@ -604,6 +604,6 @@ public class ModLoader */ public static boolean isChannelActive(EntityPlayer player, String channel) { - return FMLHooks.instance().isChannelActive(channel, player); + return FMLCommonHandler.instance().isChannelActive(channel, player); } } \ No newline at end of file