Is vanilla possible with this mod load, side tests.

This commit is contained in:
cpw 2014-09-07 20:13:37 +12:00
parent 509d244ed4
commit 3dae97cb4a
2 changed files with 22 additions and 0 deletions

View file

@ -285,8 +285,18 @@ public enum NetworkRegistry
{
NetworkModHolder networkModHolder = new NetworkModHolder(fmlModContainer, clazz, remoteVersionRange, asmHarvestedData);
registry.put(fmlModContainer, networkModHolder);
networkModHolder.testVanillaAcceptance();
}
public boolean isVanillaAccepted(Side from)
{
boolean result = true;
for (Entry<ModContainer, NetworkModHolder> e : registry.entrySet())
{
result &= e.getValue().acceptsVanilla(from);
}
return result;
}
public Map<ModContainer,NetworkModHolder> registry()
{
return ImmutableMap.copyOf(registry);

View file

@ -19,6 +19,7 @@ import org.apache.logging.log4j.Level;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.SetMultimap;
@ -94,6 +95,9 @@ public class NetworkModHolder
private NetworkChecker checker;
private boolean acceptsVanillaClient;
private boolean acceptsVanillaServer;
public NetworkModHolder(ModContainer container)
{
this.container = container;
@ -230,4 +234,12 @@ public class NetworkModHolder
this.networkId = value;
}
public void testVanillaAcceptance() {
acceptsVanillaClient = check(ImmutableMap.<String,String>of(), Side.CLIENT);
acceptsVanillaServer = check(ImmutableMap.<String,String>of(), Side.SERVER);
}
public boolean acceptsVanilla(Side from) {
return from == Side.CLIENT ? acceptsVanillaClient : acceptsVanillaServer;
}
}