From 29017610f35722a3f866629930d5cc5b94e5af80 Mon Sep 17 00:00:00 2001 From: vfyjxf <2331007009@qq.com> Date: Sun, 26 Apr 2026 21:42:01 +0800 Subject: [PATCH] first step to split dist --- gradle.properties | 2 +- .../fml/loading/moddiscovery/locators/GameLocator.java | 7 +++++-- .../loading/moddiscovery/locators/RequiredSystemFiles.java | 2 +- tests/build.gradle | 7 +++++-- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/gradle.properties b/gradle.properties index 918ef2d49..c7a794e45 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ gradleutils_version=5.0.1 -test_neoforge_version=26.1.0.5-beta +test_neoforge_version=26.1.2.29-beta test_minecraft_version=26.1 mergetool_version=2.0.0 diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/GameLocator.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/GameLocator.java index 7bf8ab53f..010c77428 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/GameLocator.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/GameLocator.java @@ -195,9 +195,12 @@ private static List getMinecraftResourcesRoots(ILaunch result.add(buildFilteredMinecraftResourcesFilteredPath(commonResources, context.getRequiredDistribution(), systemFiles)); if (clientResources != null && clientResources != commonResources) { - result.add(buildFilteredMinecraftResourcesFilteredPath(clientResources, context.getRequiredDistribution(), systemFiles)); + JarContents.PathFilter pathFilter = null; + if (systemFiles.getClassesRoots().contains(clientResources)) { + pathFilter = relativePath -> !relativePath.endsWith(".class"); + } + result.add(new JarContents.FilteredPath(clientResources.getPrimaryPath(), pathFilter)); } - return result; } diff --git a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/RequiredSystemFiles.java b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/RequiredSystemFiles.java index f6ef51d34..79664b77c 100644 --- a/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/RequiredSystemFiles.java +++ b/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/locators/RequiredSystemFiles.java @@ -35,7 +35,7 @@ final class RequiredSystemFiles implements AutoCloseable { static final String COMMON_CLASS = "net/minecraft/DetectedVersion.class"; static final String CLIENT_CLASS = "net/minecraft/client/Minecraft.class"; static final String COMMON_RESOURCE_ROOT = "data/.mcassetsroot"; - static final String CLIENT_RESOURCE_ROOT = "assets/.mcassetsroot"; + static final String CLIENT_RESOURCE_ROOT = "pack.png";//TODO:find a better solution static final String NEOFORGE_COMMON_CLASS = "net/neoforged/neoforge/common/NeoForgeMod.class"; static final String NEOFORGE_CLIENT_CLASS = "net/neoforged/neoforge/client/ClientNeoForgeMod.class"; private JarContents commonClasses; diff --git a/tests/build.gradle b/tests/build.gradle index f812cb650..351fba2ee 100644 --- a/tests/build.gradle +++ b/tests/build.gradle @@ -4,18 +4,21 @@ plugins { sourceSets { moddevTest + moddevTestClient } neoForge { enable { version = test_neoforge_version - enabledSourceSets = [sourceSets.moddevTest] + splitDist = true + enabledSourceSets = [sourceSets.moddevTest,sourceSets.moddevTestClient] } + addModdingDependenciesTo(sourceSets.moddevTestClient, true) runs { client { client() gameDirectory = file("build/runs/client") - sourceSet = sourceSets.moddevTest + sourceSet = sourceSets.moddevTestClient } server { server()