diff --git a/loader/src/main/java/net/neoforged/fml/IExtensionPoint.java b/loader/src/main/java/net/neoforged/fml/IExtensionPoint.java index c69620ff9..2d14ffc7f 100644 --- a/loader/src/main/java/net/neoforged/fml/IExtensionPoint.java +++ b/loader/src/main/java/net/neoforged/fml/IExtensionPoint.java @@ -18,73 +18,4 @@ */ public interface IExtensionPoint { - /** - * Extension point for the compatibility display test used on the server selection screen. - * - * Note: "server" and "client" refers to the {@linkplain net.neoforged.api.distmarker.Dist#DEDICATED_SERVER dedicated server} - * and {@linkplain net.neoforged.api.distmarker.Dist#CLIENT game client} physical distributions, rather than the - * {@linkplain LogicalSide logical server and client}. - * - *

The {@link Supplier} provides the local compatibility version, which is sent from the server to the client - * for multiplayer connections or stored to disk for the world save. The {@link BiPredicate} accepts the remote - * compatibility version and a boolean indicating whether the remote version is from the server or a world save, - * where {@code true} means it is from the server and {@code false} means it is from the world save. The return - * value of the predicate determines whether the remote version is "compatible" for the purposes of the display test.

- * - *

The local compatibility version may be of the value {@link net.neoforged.network.NetworkConstants#IGNORESERVERONLY}, - * in which case clients will ignore the mod's presence if it is present on the server but not on the client. - * However, the remote version test predicate must still accept this value as a remote version in order to display - * as compatible if the mod is present on the client.

- * - *

The compatibility display test does not necessarily indicate the success or failure of an actual - * connection attempt. Factors such as display test extension misconfiguration, truncation of ping data, - * difference of registry data or network channels between server and client, and others may cause the result of the - * compatibility test to not reflect the actual likelihood of a connection successfully being established between - * the server and the client.

- * - *

An example declaration of a display test extension registration for a regular mod (requires to be present on - * server and client) is as follows:

- *
{@code
-     * String compatibilityVersion = "1"; // Could be linked with a network channel version or mod version
-     * ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
-     *         () -> new IExtensionPoint.DisplayTest(
-     *                 () -> compatibilityVersion,
-     *                 (remoteVersion, isFromServer) -> remoteVersion.equals(compatibilityVersion)
-     *         )
-     * );
-     * }
- * - *

An example declaration of a display test extension registration for a server-side-only mod (does not - * require to be present on the client) is as follows:

- *
{@code
-     * ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
-     *         () -> new IExtensionPoint.DisplayTest(
-     *                 // Ignore this mod if not present on the client
-     *                 () -> NetworkConstants.IGNORESERVERONLY,
-     *                 // If present on the client, accept any version if from a server
-     *                 (remoteVersion, isFromServer) -> isFromServer
-     *         )
-     * );
-     * }
- * - *

An example declaration of a display test extension registration for a client-side-only mod (does not - * require to be present on the server) is as follows:

- *
{@code
-     * ModLoadingContext.get().registerExtensionPoint(IExtensionPoint.DisplayTest.class,
-     *         () -> new IExtensionPoint.DisplayTest(
-     *                 // Send any version from server to client, since we will be accepting any version as well
-     *                 () -> "dQw4w9WgXcQ",
-     *                 // Accept any version on the client, from server or from save
-     *                 (remoteVersion, isFromServer) -> true
-     *         )
-     * );
-     * }
- * - * @see net.neoforged.network.ServerStatusPing - * @see net.neoforged.client.ForgeHooksClient#processForgeListPingData(net.minecraft.network.protocol.status.ServerStatus, net.minecraft.client.multiplayer.ServerData) - */ - @SuppressWarnings("JavadocReference") // reference to NetworkConstants, ForgeHooksClient - record DisplayTest(Supplier suppliedVersion, BiPredicate remoteVersionTest) implements IExtensionPoint { - public static final String IGNORESERVERONLY = "OHNOES\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31\uD83D\uDE31"; - } } diff --git a/loader/src/main/java/net/neoforged/fml/ModContainer.java b/loader/src/main/java/net/neoforged/fml/ModContainer.java index dff66dab6..743c8ed23 100644 --- a/loader/src/main/java/net/neoforged/fml/ModContainer.java +++ b/loader/src/main/java/net/neoforged/fml/ModContainer.java @@ -22,7 +22,6 @@ import java.util.HashMap; import java.util.IdentityHashMap; import java.util.Map; -import java.util.Objects; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -64,24 +63,6 @@ public ModContainer(IModInfo info) this.namespace = this.modId; this.modInfo = info; this.modLoadingStage = ModLoadingStage.CONSTRUCT; - - final String displayTestString = info.getConfig().getConfigElement("displayTest").orElse("MATCH_VERSION"); // missing defaults to DEFAULT type - var displayTest = switch (displayTestString) { - case "MATCH_VERSION" -> // default displaytest checks for version string match - new IExtensionPoint.DisplayTest(() -> this.modInfo.getVersion().toString(), - (incoming, isNetwork) -> Objects.equals(incoming, this.modInfo.getVersion().toString())); - case "IGNORE_SERVER_VERSION" -> // Ignores any version information coming from the server - use for server only mods - new IExtensionPoint.DisplayTest(() -> IExtensionPoint.DisplayTest.IGNORESERVERONLY, (incoming, isNetwork) -> true); - case "IGNORE_ALL_VERSION" -> // Ignores all information and provides no information - new IExtensionPoint.DisplayTest(() -> "", (incoming, isNetwork) -> true); - case "NONE" -> null; // NO display test at all - use this if you're going to do your own display test - default -> // any other value throws an exception - throw new IllegalArgumentException("Invalid displayTest value supplied in mods.toml"); - }; - if (displayTest != null) - registerExtensionPoint(IExtensionPoint.DisplayTest.class, displayTest); - else - extensionPoints.remove(IExtensionPoint.DisplayTest.class); } /** diff --git a/loader/src/main/java/net/neoforged/fml/lowcodemod/LowCodeModContainer.java b/loader/src/main/java/net/neoforged/fml/lowcodemod/LowCodeModContainer.java index 437851d76..3ea8d3555 100644 --- a/loader/src/main/java/net/neoforged/fml/lowcodemod/LowCodeModContainer.java +++ b/loader/src/main/java/net/neoforged/fml/lowcodemod/LowCodeModContainer.java @@ -7,7 +7,6 @@ import com.mojang.logging.LogUtils; import net.neoforged.bus.api.IEventBus; -import net.neoforged.fml.IExtensionPoint; import net.neoforged.fml.ModContainer; import net.neoforged.neoforgespi.language.IModInfo; import net.neoforged.neoforgespi.language.ModFileScanData; @@ -29,7 +28,6 @@ public LowCodeModContainer(IModInfo info, ModFileScanData modFileScanResults, Mo this.scanResults = modFileScanResults; this.modInstance = new Object(); this.contextExtension = () -> null; - this.extensionPoints.remove(IExtensionPoint.DisplayTest.class); } @Override