mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Is vanilla possible with this mod load, side tests.
This commit is contained in:
1 parent
509d244ed4
commit
3dae97cb4a
2 files changed
+22
No files matched your search
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user