Make sure the mod being absent on the other network side does not cause the client to display the server as incompatible after forge-1.13.2-25.0.107. (#124)

This commit is contained in:
ZekerZhayard authored and GitHub committed 2020-11-05 11:52:36 +08:00
1 parent da79597a16
commit a65445e989
5 files changed
+47 -8

No files matched your search

@@ -1,10 +1,12 @@
package customskinloader.forge;
import customskinloader.CustomSkinLoader;
import net.minecraftforge.fml.ExtensionPoint;
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent;
import net.minecraftforge.fml.network.FMLNetworkConstants;
import org.apache.commons.lang3.tuple.Pair;
/**
* Forge Mod Container
@@ -20,8 +22,15 @@ import net.minecraftforge.fml.common.event.FMLFingerprintViolationEvent;
certificateFingerprint = "52885f395e68f42e9b3b629ba56ecf606f7d4269"
)//1.13-
public class ForgeMod {
public ForgeMod() {
try {
this.setExtensionPoint();
} catch (Throwable ignored) {
// before forge-1.13.2-25.0.103
}
}
@EventHandler
@Mod.EventHandler
public void fingerprintError(FMLFingerprintViolationEvent event) {
if (event.isDirectory()) return;//Development Environment
@@ -38,4 +47,9 @@ public class ForgeMod {
throw new RuntimeException("Fingerprint ERROR, please **DO NOT MODIFY** any mod.");
}
// Make sure the mod being absent on the other network side does not cause the client to display the server as incompatible after forge-1.13.2-25.0.107.
private void setExtensionPoint() {
ModLoadingContext.get().registerExtensionPoint(ExtensionPoint.DISPLAYTEST, () -> Pair.of(() -> FMLNetworkConstants.IGNORESERVERONLY, (remote, isServer) -> true));
}
}