From 54ada57ab533b4706e5105e1a1dbe3d8b06bd696 Mon Sep 17 00:00:00 2001 From: McCal-Codes <175259256+McCal-Codes@users.noreply.github.com> Date: Wed, 7 Oct 2026 12:18:50 -0400 Subject: [PATCH] Keep server-side mods in client-hosted (LAN) packs When a player opens their world to LAN, the pack is generated from their own game dir, and auto-exclude-server-side-mods drops mods like Dungeons Arise. The host still loads them though, so Forge kicks every joiner with "mismatched mod list". Skip the auto-exclude when the host is a client. Co-Authored-By: Claude Opus 5.5 --- .../skidam/automodpack_core/modpack/ModpackExecutor.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/pl/skidam/automodpack_core/modpack/ModpackExecutor.java b/core/src/main/java/pl/skidam/automodpack_core/modpack/ModpackExecutor.java index 37099d4eb..d97377703 100644 --- a/core/src/main/java/pl/skidam/automodpack_core/modpack/ModpackExecutor.java +++ b/core/src/main/java/pl/skidam/automodpack_core/modpack/ModpackExecutor.java @@ -15,6 +15,7 @@ import java.util.function.Supplier; import pl.skidam.automodpack_core.config.ServerConfigJsons; +import pl.skidam.automodpack_core.loader.LoaderManagerService; import pl.skidam.automodpack_core.loader.ModFileCache; import pl.skidam.automodpack_core.modpack.PackAbsence.Kind; import pl.skidam.automodpack_core.modpack.candidate.CandidateBuildException; @@ -455,9 +456,15 @@ private ModpackCandidate buildCandidate(GenerationStore.Current previous, boolea // Unadvertised versions leave the manifest fields empty, so clients see a files-only pack instead of a // pack whose versions they must switch to. boolean advertiseVersions = serverConfig.advertiseVersionsToSync; + // A client hosting its world to LAN loads every "server-side" mod itself, and Forge's login handshake + // rejects any joiner whose mod list differs ("mismatched mod list"). Those mods must ship to joiners. + boolean clientHost = LOADER_MANAGER != null && LOADER_MANAGER.getEnvironmentType() == LoaderManagerService.EnvironmentType.CLIENT; + boolean excludeServerSideMods = serverConfig.autoExcludeServerSideMods && !clientHost; + if (serverConfig.autoExcludeServerSideMods && clientHost) + LOGGER.info("Client-hosted pack: keeping server-side mods in the pack because LAN joiners must match the host's mod list"); ModpackCandidateScanner.Request request = new ModpackCandidateScanner.Request(modpackId, serverConfig.modpack.name, AM_VERSION, advertiseVersions ? LOADER : null, advertiseVersions ? LOADER_VERSION : null, advertiseVersions ? MC_VERSION : null, serverRoot, groupRoot, - serverConfig.modpack.categories, serverConfig.autoExcludeServerSideMods, generationRoot.resolve(SERVER_STAGING_DIR.getFileName()), + serverConfig.modpack.categories, excludeServerSideMods, generationRoot.resolve(SERVER_STAGING_DIR.getFileName()), creationExecutor, generationStore.objectRoot(), fileCache, modFileCache, materializeMissingObjects); ModpackCandidate candidate = candidateScan.scan(request); for (ExcludedCandidate exclusion : candidate.exclusions())