ironbarrels/IronChests2/common/cpw/mods/ironchest/ServerClientProxy.java

32 lines
798 B
Java
Raw Normal View History

2012-01-29 22:12:06 +01:00
package cpw.mods.ironchest;
import net.minecraft.src.ModLoader;
import net.minecraft.src.forge.MinecraftForge;
2012-01-29 22:12:06 +01:00
public enum ServerClientProxy {
CLIENT("cpw.mods.ironchest.client.ClientProxy"),
SERVER("cpw.mods.ironchest.server.ServerProxy");
private String className;
private ServerClientProxy(String proxyClassName) {
className=proxyClassName;
}
private IProxy buildProxy() {
try {
return (IProxy) Class.forName(className).newInstance();
} catch (Exception e) {
ModLoader.getLogger().severe("A fatal error has occured initializing IronChests");
e.printStackTrace(System.err);
throw new RuntimeException(e);
}
}
public static IProxy getProxy() {
if (MinecraftForge.isClient()) {
return CLIENT.buildProxy();
} else {
return SERVER.buildProxy();
2012-01-29 22:12:06 +01:00
}
}
}