blob: 6618e795f45d14df65169ddc62229f671693a1d7 [file] [log] [blame] [raw]
package li.cil.oc.util;
import cpw.mods.fml.common.FMLCommonHandler;
import java.util.Collections;
import java.util.Set;
public final class SideTracker {
private static final Set<Thread> serverThreads = Collections.newSetFromMap(new java.util.WeakHashMap<Thread, Boolean>());
public static void addServerThread() {
serverThreads.add(Thread.currentThread());
}
public static boolean isServer() {
return FMLCommonHandler.instance().getEffectiveSide().isServer() || serverThreads.contains(Thread.currentThread());
}
public static boolean isClient() {
return !isServer();
}
}