Add explicit client/server side field to manifest #2

Merged
Matt merged 2 commits from feature/side-field into main 2026-05-22 15:15:03 +00:00
7 changed files with 538 additions and 353 deletions
Showing only changes of commit 4594cb9c00 - Show all commits
+9
View File
@@ -95,6 +95,15 @@ public sealed class ManifestFile
[JsonPropertyName("size")] [JsonPropertyName("size")]
public long? Size { get; set; } public long? Size { get; set; }
/// <summary>
/// "both" (default), "client", or "server". The launcher skips files
/// marked "server"; the server-tool skips files marked "client".
/// Null/missing/unknown = treated as "both" so manifests pre-dating
/// this field stay fully compatible.
/// </summary>
[JsonPropertyName("side")]
public string? Side { get; set; }
} }
public sealed class PackVersionRecord public sealed class PackVersionRecord
+22
View File
@@ -66,6 +66,7 @@ public sealed class ManifestSyncService
var missing = new System.Collections.Generic.List<ManifestFile>(); var missing = new System.Collections.Generic.List<ManifestFile>();
foreach (var file in manifest.Files) foreach (var file in manifest.Files)
{ {
if (IsServerOnly(file)) continue; // never expected on disk client-side
var dest = Path.Combine(installDir, file.Path); var dest = Path.Combine(installDir, file.Path);
if (!File.Exists(dest)) missing.Add(file); if (!File.Exists(dest)) missing.Add(file);
} }
@@ -113,6 +114,19 @@ public sealed class ManifestSyncService
$"Pack: {manifest.Name ?? "modpack"} v{manifest.Version ?? "?"} (local: {local?.Version ?? "none"})" $"Pack: {manifest.Name ?? "modpack"} v{manifest.Version ?? "?"} (local: {local?.Version ?? "none"})"
)); ));
// Drop server-only files before computing wanted/download sets. Doing
// it once here means the rest of the sync (prune + download) doesn't
// need to know about sides. Unknown/missing/'both' = include on client.
var serverOnlyCount = manifest.Files.Count(f => IsServerOnly(f));
if (serverOnlyCount > 0)
{
manifest.Files = manifest.Files.Where(f => !IsServerOnly(f)).ToList();
progress.Report(new ProgressReport(
ProgressKind.Log,
$"Skipping {serverOnlyCount} server-only file(s) declared in manifest."
));
}
var wantedPaths = new HashSet<string>( var wantedPaths = new HashSet<string>(
manifest.Files.Select(f => NormalizePath(f.Path)), manifest.Files.Select(f => NormalizePath(f.Path)),
StringComparer.OrdinalIgnoreCase StringComparer.OrdinalIgnoreCase
@@ -249,4 +263,12 @@ public sealed class ManifestSyncService
} }
private static string NormalizePath(string p) => p.Replace('\\', '/').TrimStart('/'); private static string NormalizePath(string p) => p.Replace('\\', '/').TrimStart('/');
/// <summary>
/// True if this manifest file is tagged as server-only and therefore
/// should not be installed on the client. Unknown/null/'both' = false
/// (always include) so manifests pre-dating the field still install.
/// </summary>
private static bool IsServerOnly(ManifestFile f)
=> string.Equals(f.Side, "server", StringComparison.OrdinalIgnoreCase);
} }
+380 -347
View File
@@ -1,349 +1,382 @@
{ {
"$schema": "Brass-and-Sigil pack.lock.json - generated, do not edit by hand unless you know what you are doing", "$schema": "Brass-and-Sigil pack.lock.json - generated, do not edit by hand unless you know what you are doing",
"name": "Brass and Sigil", "name": "Brass and Sigil",
"version": "0.9.3", "version": "0.10.0",
"minecraft": "1.21.1", "minecraft": "1.21.1",
"loader": { "loader": {
"type": "neoforge", "type": "neoforge",
"version": "21.1.228" "version": "21.1.228"
}, },
"lockedAt": "2026-05-04T14:22:58.7131203+01:00", "lockedAt": "2026-05-04T13:22:58.7131203+00:00",
"mods": [ "mods": [
{ {
"source": "modrinth", "source": "modrinth",
"slug": "create", "slug": "create",
"versionId": "UjX6dr61", "versionId": "UjX6dr61",
"version": "6.0.10+mc1.21.1", "version": "6.0.10+mc1.21.1",
"path": "mods/create-1.21.1-6.0.10.jar", "path": "mods/create-1.21.1-6.0.10.jar",
"url": "https://cdn.modrinth.com/data/LNytGWDc/versions/UjX6dr61/create-1.21.1-6.0.10.jar", "url": "https://cdn.modrinth.com/data/LNytGWDc/versions/UjX6dr61/create-1.21.1-6.0.10.jar",
"sha1": "0e97e49837bed766e6f28a4c95b04885d6acc353", "sha1": "0e97e49837bed766e6f28a4c95b04885d6acc353",
"size": 19123767 "size": 19123767,
}, "side": "both"
{ },
"source": "modrinth", {
"slug": "create-aeronautics", "source": "modrinth",
"versionId": "YhZLrAFC", "slug": "create-aeronautics",
"version": "1.2.1+mc1.21.1", "versionId": "YhZLrAFC",
"path": "mods/create-aeronautics-bundled-1.21.1-1.2.1.jar", "version": "1.2.1+mc1.21.1",
"url": "https://cdn.modrinth.com/data/oWaK0Q19/versions/YhZLrAFC/create-aeronautics-bundled-1.21.1-1.2.1.jar", "path": "mods/create-aeronautics-bundled-1.21.1-1.2.1.jar",
"sha1": "fdf1ae69e8b6437e0196b3a35dd2325aa904aba9", "url": "https://cdn.modrinth.com/data/oWaK0Q19/versions/YhZLrAFC/create-aeronautics-bundled-1.21.1-1.2.1.jar",
"size": 33030286 "sha1": "fdf1ae69e8b6437e0196b3a35dd2325aa904aba9",
}, "size": 33030286,
{ "side": "both"
"source": "modrinth", },
"slug": "sable", {
"versionId": "3FMsUjO4", "source": "modrinth",
"version": "1.2.2+mc1.21.1", "slug": "sable",
"path": "mods/sable-neoforge-1.21.1-1.2.2.jar", "versionId": "3FMsUjO4",
"url": "https://cdn.modrinth.com/data/T9PomCSv/versions/3FMsUjO4/sable-neoforge-1.21.1-1.2.2.jar", "version": "1.2.2+mc1.21.1",
"sha1": "c5ecd3fcf60a31d84112c708abe29e341b2d1b73", "path": "mods/sable-neoforge-1.21.1-1.2.2.jar",
"size": 12719293 "url": "https://cdn.modrinth.com/data/T9PomCSv/versions/3FMsUjO4/sable-neoforge-1.21.1-1.2.2.jar",
}, "sha1": "c5ecd3fcf60a31d84112c708abe29e341b2d1b73",
{ "size": 12719293,
"source": "modrinth", "side": "both"
"slug": "create-big-cannons", },
"versionId": "bsGaXKEd", {
"version": "5.11.3", "source": "modrinth",
"path": "mods/createbigcannons-5.11.3+mc.1.21.1.jar", "slug": "create-big-cannons",
"url": "https://cdn.modrinth.com/data/GWp4jCJj/versions/bsGaXKEd/createbigcannons-5.11.3%2Bmc.1.21.1.jar", "versionId": "bsGaXKEd",
"sha1": "8b61fa850e260bdeb5d360576123f98c260afa50", "version": "5.11.3",
"size": 3715787 "path": "mods/createbigcannons-5.11.3+mc.1.21.1.jar",
}, "url": "https://cdn.modrinth.com/data/GWp4jCJj/versions/bsGaXKEd/createbigcannons-5.11.3%2Bmc.1.21.1.jar",
{ "sha1": "8b61fa850e260bdeb5d360576123f98c260afa50",
"source": "modrinth", "size": 3715787,
"slug": "create-tfmg", "side": "both"
"versionId": "uDi14nbt", },
"version": "1.2.0", {
"path": "mods/tfmg-1.2.0.jar", "source": "modrinth",
"url": "https://cdn.modrinth.com/data/USgVjXsk/versions/uDi14nbt/tfmg-1.2.0.jar", "slug": "create-tfmg",
"sha1": "b520f3687f60a69eb265ff5b9a16759b9e124103", "versionId": "uDi14nbt",
"size": 4924243 "version": "1.2.0",
}, "path": "mods/tfmg-1.2.0.jar",
{ "url": "https://cdn.modrinth.com/data/USgVjXsk/versions/uDi14nbt/tfmg-1.2.0.jar",
"source": "modrinth", "sha1": "b520f3687f60a69eb265ff5b9a16759b9e124103",
"slug": "distanthorizons", "size": 4924243,
"versionId": "KkaaQtTD", "side": "both"
"version": "3.0.2-b-1.21.1", },
"path": "mods/DistantHorizons-3.0.2-b-1.21.1-fabric-neoforge.jar", {
"url": "https://cdn.modrinth.com/data/uCdwusMi/versions/KkaaQtTD/DistantHorizons-3.0.2-b-1.21.1-fabric-neoforge.jar", "source": "modrinth",
"sha1": "1ff0a8920e52add541471f7b32d0d389997145ba", "slug": "distanthorizons",
"size": 30019727 "versionId": "KkaaQtTD",
}, "version": "3.0.2-b-1.21.1",
{ "path": "mods/DistantHorizons-3.0.2-b-1.21.1-fabric-neoforge.jar",
"source": "modrinth", "url": "https://cdn.modrinth.com/data/uCdwusMi/versions/KkaaQtTD/DistantHorizons-3.0.2-b-1.21.1-fabric-neoforge.jar",
"slug": "sodium", "sha1": "1ff0a8920e52add541471f7b32d0d389997145ba",
"versionId": "Pb3OXVqC", "size": 30019727,
"version": "mc1.21.1-0.6.13-neoforge", "side": "both"
"path": "mods/sodium-neoforge-0.6.13+mc1.21.1.jar", },
"url": "https://cdn.modrinth.com/data/AANobbMI/versions/Pb3OXVqC/sodium-neoforge-0.6.13%2Bmc1.21.1.jar", {
"sha1": "38af70fa4dc4b2aaac636e92fdba3bedd5a025e1", "source": "modrinth",
"size": 1162994 "slug": "sodium",
}, "versionId": "Pb3OXVqC",
{ "version": "mc1.21.1-0.6.13-neoforge",
"source": "modrinth", "path": "mods/sodium-neoforge-0.6.13+mc1.21.1.jar",
"slug": "iris", "url": "https://cdn.modrinth.com/data/AANobbMI/versions/Pb3OXVqC/sodium-neoforge-0.6.13%2Bmc1.21.1.jar",
"versionId": "t3ruzodq", "sha1": "38af70fa4dc4b2aaac636e92fdba3bedd5a025e1",
"version": "1.8.12+1.21.1-neoforge", "size": 1162994,
"path": "mods/iris-neoforge-1.8.12+mc1.21.1.jar", "side": "client"
"url": "https://cdn.modrinth.com/data/YL57xq9U/versions/t3ruzodq/iris-neoforge-1.8.12%2Bmc1.21.1.jar", },
"sha1": "a3e6355915c7d3b2bc392724795113e51d289378", {
"size": 2438548 "source": "modrinth",
}, "slug": "iris",
{ "versionId": "t3ruzodq",
"source": "modrinth", "version": "1.8.12+1.21.1-neoforge",
"slug": "modernfix", "path": "mods/iris-neoforge-1.8.12+mc1.21.1.jar",
"versionId": "6U8JVjdw", "url": "https://cdn.modrinth.com/data/YL57xq9U/versions/t3ruzodq/iris-neoforge-1.8.12%2Bmc1.21.1.jar",
"version": "5.27.4+mc1.21.1", "sha1": "a3e6355915c7d3b2bc392724795113e51d289378",
"path": "mods/modernfix-neoforge-5.27.4+mc1.21.1.jar", "size": 2438548,
"url": "https://cdn.modrinth.com/data/nmDcB62a/versions/6U8JVjdw/modernfix-neoforge-5.27.4%2Bmc1.21.1.jar", "side": "client"
"sha1": "2f39363f0d6d5a5ccc2a9e0f50ad3385611c3cb7", },
"size": 562051 {
}, "source": "modrinth",
{ "slug": "modernfix",
"source": "modrinth", "versionId": "6U8JVjdw",
"slug": "ferrite-core", "version": "5.27.4+mc1.21.1",
"versionId": "x7kQWVju", "path": "mods/modernfix-neoforge-5.27.4+mc1.21.1.jar",
"version": "7.0.3-neoforge", "url": "https://cdn.modrinth.com/data/nmDcB62a/versions/6U8JVjdw/modernfix-neoforge-5.27.4%2Bmc1.21.1.jar",
"path": "mods/ferritecore-7.0.3-neoforge.jar", "sha1": "2f39363f0d6d5a5ccc2a9e0f50ad3385611c3cb7",
"url": "https://cdn.modrinth.com/data/uXXizFIs/versions/x7kQWVju/ferritecore-7.0.3-neoforge.jar", "size": 562051,
"sha1": "9563692efb708b6b568df27a01ec52f6311928ef", "side": "both"
"size": 121559 },
}, {
{ "source": "modrinth",
"source": "modrinth", "slug": "ferrite-core",
"slug": "architectury-api", "versionId": "x7kQWVju",
"versionId": "ZxYGwlk0", "version": "7.0.3-neoforge",
"version": "13.0.8+neoforge", "path": "mods/ferritecore-7.0.3-neoforge.jar",
"path": "mods/architectury-13.0.8-neoforge.jar", "url": "https://cdn.modrinth.com/data/uXXizFIs/versions/x7kQWVju/ferritecore-7.0.3-neoforge.jar",
"url": "https://cdn.modrinth.com/data/lhGA9TYQ/versions/ZxYGwlk0/architectury-13.0.8-neoforge.jar", "sha1": "9563692efb708b6b568df27a01ec52f6311928ef",
"sha1": "6ca11d3cc136bf69bb8f4d56982481eb85b5100b", "size": 121559,
"size": 584004 "side": "both"
}, },
{ {
"source": "modrinth", "source": "modrinth",
"slug": "rhino", "slug": "architectury-api",
"versionId": "ZdLtebKH", "versionId": "ZxYGwlk0",
"version": "2101.2.7-build.81+Rhino-1.21", "version": "13.0.8+neoforge",
"path": "mods/rhino-2101.2.7-build.81.jar", "path": "mods/architectury-13.0.8-neoforge.jar",
"url": "https://cdn.modrinth.com/data/sk9knFPE/versions/ZdLtebKH/rhino-2101.2.7-build.81.jar", "url": "https://cdn.modrinth.com/data/lhGA9TYQ/versions/ZxYGwlk0/architectury-13.0.8-neoforge.jar",
"sha1": "480235a9f7749f68ce6fec3b9c3cac3428b92a4a", "sha1": "6ca11d3cc136bf69bb8f4d56982481eb85b5100b",
"size": 882033 "size": 584004,
}, "side": "both"
{ },
"source": "modrinth", {
"slug": "rpl", "source": "modrinth",
"versionId": "hZ6B2Z0x", "slug": "rhino",
"version": "2.1.2", "versionId": "ZdLtebKH",
"path": "mods/ritchiesprojectilelib-2.1.2+mc.1.21.1-neoforge.jar", "version": "2101.2.7-build.81+Rhino-1.21",
"url": "https://cdn.modrinth.com/data/B3pb093D/versions/hZ6B2Z0x/ritchiesprojectilelib-2.1.2%2Bmc.1.21.1-neoforge.jar", "path": "mods/rhino-2101.2.7-build.81.jar",
"sha1": "ec2e4996f8bee8714173e603e379fef8a6901765", "url": "https://cdn.modrinth.com/data/sk9knFPE/versions/ZdLtebKH/rhino-2101.2.7-build.81.jar",
"size": 76369 "sha1": "480235a9f7749f68ce6fec3b9c3cac3428b92a4a",
}, "size": 882033,
{ "side": "both"
"source": "modrinth", },
"slug": "kubejs", {
"versionId": "Fe9CjPws", "source": "modrinth",
"version": "2101.7.2-build.363", "slug": "rpl",
"path": "mods/kubejs-neoforge-2101.7.2-build.363.jar", "versionId": "hZ6B2Z0x",
"url": "https://cdn.modrinth.com/data/umyGl7zF/versions/Fe9CjPws/kubejs-neoforge-2101.7.2-build.363.jar", "version": "2.1.2",
"sha1": "d4e88254e8c26687d4c6aeb4dfa9c2ad70f260a2", "path": "mods/ritchiesprojectilelib-2.1.2+mc.1.21.1-neoforge.jar",
"size": 2270442 "url": "https://cdn.modrinth.com/data/B3pb093D/versions/hZ6B2Z0x/ritchiesprojectilelib-2.1.2%2Bmc.1.21.1-neoforge.jar",
}, "sha1": "ec2e4996f8bee8714173e603e379fef8a6901765",
{ "size": 76369,
"source": "modrinth", "side": "both"
"slug": "jei", },
"versionId": "YAcQ6elZ", {
"version": "19.27.0.340", "source": "modrinth",
"path": "mods/jei-1.21.1-neoforge-19.27.0.340.jar", "slug": "kubejs",
"url": "https://cdn.modrinth.com/data/u6dRKJwZ/versions/YAcQ6elZ/jei-1.21.1-neoforge-19.27.0.340.jar", "versionId": "Fe9CjPws",
"sha1": "27d0d85e7e32e926fc3664ab6815df5cdabb7941", "version": "2101.7.2-build.363",
"size": 1529391 "path": "mods/kubejs-neoforge-2101.7.2-build.363.jar",
}, "url": "https://cdn.modrinth.com/data/umyGl7zF/versions/Fe9CjPws/kubejs-neoforge-2101.7.2-build.363.jar",
{ "sha1": "d4e88254e8c26687d4c6aeb4dfa9c2ad70f260a2",
"source": "modrinth", "size": 2270442,
"slug": "jade", "side": "both"
"versionId": "yd8FKCmx", },
"version": "15.10.5+neoforge", {
"path": "mods/Jade-1.21.1-NeoForge-15.10.5.jar", "source": "modrinth",
"url": "https://cdn.modrinth.com/data/nvQzSEkH/versions/yd8FKCmx/Jade-1.21.1-NeoForge-15.10.5.jar", "slug": "jei",
"sha1": "d5bf134b3dbde9f5258666823900e21341dc0a50", "versionId": "YAcQ6elZ",
"size": 725742 "version": "19.27.0.340",
}, "path": "mods/jei-1.21.1-neoforge-19.27.0.340.jar",
{ "url": "https://cdn.modrinth.com/data/u6dRKJwZ/versions/YAcQ6elZ/jei-1.21.1-neoforge-19.27.0.340.jar",
"source": "modrinth", "sha1": "27d0d85e7e32e926fc3664ab6815df5cdabb7941",
"slug": "chunky", "size": 1529391,
"versionId": "LuFhm4eU", "side": "both"
"version": "1.4.23", },
"path": "mods/Chunky-NeoForge-1.4.23.jar", {
"url": "https://cdn.modrinth.com/data/fALzjamp/versions/LuFhm4eU/Chunky-NeoForge-1.4.23.jar", "source": "modrinth",
"sha1": "ab0c74743a653020fe2dfc4986b43e893947f3e9", "slug": "jade",
"size": 340572 "versionId": "yd8FKCmx",
}, "version": "15.10.5+neoforge",
{ "path": "mods/Jade-1.21.1-NeoForge-15.10.5.jar",
"source": "curseforge", "url": "https://cdn.modrinth.com/data/nvQzSEkH/versions/yd8FKCmx/Jade-1.21.1-NeoForge-15.10.5.jar",
"slug": "ftb-library", "sha1": "d5bf134b3dbde9f5258666823900e21341dc0a50",
"fileId": "7746959", "size": 725742,
"version": "2101.1.31", "side": "both"
"path": "mods/ftb-library-neoforge-2101.1.31.jar", },
"url": "https://mediafilez.forgecdn.net/files/7746/959/ftb-library-neoforge-2101.1.31.jar", {
"sha1": "686d4e784c28c14f7760cc22b2de6a8573b56b74", "source": "modrinth",
"size": 1411181 "slug": "chunky",
}, "versionId": "LuFhm4eU",
{ "version": "1.4.23",
"source": "curseforge", "path": "mods/Chunky-NeoForge-1.4.23.jar",
"slug": "ftb-teams", "url": "https://cdn.modrinth.com/data/fALzjamp/versions/LuFhm4eU/Chunky-NeoForge-1.4.23.jar",
"fileId": "7369021", "sha1": "ab0c74743a653020fe2dfc4986b43e893947f3e9",
"version": "2101.1.9", "size": 340572,
"path": "mods/ftb-teams-neoforge-2101.1.9.jar", "side": "both"
"url": "https://mediafilez.forgecdn.net/files/7369/21/ftb-teams-neoforge-2101.1.9.jar", },
"sha1": "328e04bf1a445870aacea8fe7637670f84272a8f", {
"size": 291847 "source": "curseforge",
}, "slug": "ftb-library",
{ "fileId": "7746959",
"source": "curseforge", "version": "2101.1.31",
"slug": "ftb-chunks", "path": "mods/ftb-library-neoforge-2101.1.31.jar",
"fileId": "7608681", "url": "https://mediafilez.forgecdn.net/files/7746/959/ftb-library-neoforge-2101.1.31.jar",
"version": "2101.1.14", "sha1": "686d4e784c28c14f7760cc22b2de6a8573b56b74",
"path": "mods/ftb-chunks-neoforge-2101.1.14.jar", "size": 1411181,
"url": "https://mediafilez.forgecdn.net/files/7608/681/ftb-chunks-neoforge-2101.1.14.jar", "side": "both"
"sha1": "908b63b11d0e00ae6c9557d3fe6440bdbcf21bb7", },
"size": 642340 {
}, "source": "curseforge",
{ "slug": "ftb-teams",
"source": "modrinth", "fileId": "7369021",
"slug": "ars-nouveau", "version": "2101.1.9",
"versionId": "BmGGrC9A", "path": "mods/ftb-teams-neoforge-2101.1.9.jar",
"version": "5.11.3+mc1.21.1", "url": "https://mediafilez.forgecdn.net/files/7369/21/ftb-teams-neoforge-2101.1.9.jar",
"path": "mods/ars_nouveau-1.21.1-5.11.3.jar", "sha1": "328e04bf1a445870aacea8fe7637670f84272a8f",
"url": "https://cdn.modrinth.com/data/TKB6INcv/versions/BmGGrC9A/ars_nouveau-1.21.1-5.11.3.jar", "size": 291847,
"sha1": "0af12dd7fda63a4261ceb302c9bb57fc235641c6", "side": "both"
"size": 20689115 },
}, {
{ "source": "curseforge",
"source": "modrinth", "slug": "ftb-chunks",
"slug": "terralith", "fileId": "7608681",
"versionId": "MuJMtPGQ", "version": "2101.1.14",
"version": "2.5.8", "path": "mods/ftb-chunks-neoforge-2101.1.14.jar",
"path": "mods/Terralith_1.21.x_v2.5.8.jar", "url": "https://mediafilez.forgecdn.net/files/7608/681/ftb-chunks-neoforge-2101.1.14.jar",
"url": "https://cdn.modrinth.com/data/8oi3bsk5/versions/MuJMtPGQ/Terralith_1.21.x_v2.5.8.jar", "sha1": "908b63b11d0e00ae6c9557d3fe6440bdbcf21bb7",
"sha1": "bee0cfb1a8cd4bf3d96bccea224fb45d74de9085", "size": 642340,
"size": 3115385 "side": "both"
}, },
{ {
"source": "modrinth", "source": "modrinth",
"slug": "yungs-better-strongholds", "slug": "ars-nouveau",
"versionId": "8U0dIfSM", "versionId": "BmGGrC9A",
"version": "1.21.1-NeoForge-5.1.3", "version": "5.11.3+mc1.21.1",
"path": "mods/YungsBetterStrongholds-1.21.1-NeoForge-5.1.3.jar", "path": "mods/ars_nouveau-1.21.1-5.11.3.jar",
"url": "https://cdn.modrinth.com/data/kidLKymU/versions/8U0dIfSM/YungsBetterStrongholds-1.21.1-NeoForge-5.1.3.jar", "url": "https://cdn.modrinth.com/data/TKB6INcv/versions/BmGGrC9A/ars_nouveau-1.21.1-5.11.3.jar",
"sha1": "5d06a5850af7c577612d4592706a8e156bbe1cbf", "sha1": "0af12dd7fda63a4261ceb302c9bb57fc235641c6",
"size": 461244 "size": 20689115,
}, "side": "both"
{ },
"source": "modrinth", {
"slug": "lithostitched", "source": "modrinth",
"versionId": "IONexlgI", "slug": "terralith",
"version": "1.7.2-neoforge-21.1", "versionId": "MuJMtPGQ",
"path": "mods/lithostitched-1.7.2-neoforge-21.1.jar", "version": "2.5.8",
"url": "https://cdn.modrinth.com/data/XaDC71GB/versions/IONexlgI/lithostitched-1.7.2-neoforge-21.1.jar", "path": "mods/Terralith_1.21.x_v2.5.8.jar",
"sha1": "ce35206214647131ebdf14212d1986349aeba79a", "url": "https://cdn.modrinth.com/data/8oi3bsk5/versions/MuJMtPGQ/Terralith_1.21.x_v2.5.8.jar",
"size": 810015 "sha1": "bee0cfb1a8cd4bf3d96bccea224fb45d74de9085",
}, "size": 3115385,
{ "side": "both"
"source": "modrinth", },
"slug": "c2me-neoforge", {
"versionId": "9iPiN34N", "source": "modrinth",
"version": "0.3.0+alpha.0.91+1.21.1", "slug": "yungs-better-strongholds",
"path": "mods/c2me-neoforge-mc1.21.1-0.3.0+alpha.0.91.jar", "versionId": "8U0dIfSM",
"url": "https://cdn.modrinth.com/data/COlSi5iR/versions/9iPiN34N/c2me-neoforge-mc1.21.1-0.3.0%2Balpha.0.91.jar", "version": "1.21.1-NeoForge-5.1.3",
"sha1": "c858c8becfb5205eb12aaf0420eb82c307c2e6a7", "path": "mods/YungsBetterStrongholds-1.21.1-NeoForge-5.1.3.jar",
"size": 4508649 "url": "https://cdn.modrinth.com/data/kidLKymU/versions/8U0dIfSM/YungsBetterStrongholds-1.21.1-NeoForge-5.1.3.jar",
}, "sha1": "5d06a5850af7c577612d4592706a8e156bbe1cbf",
{ "size": 461244,
"source": "modrinth", "side": "server"
"slug": "noisium", },
"versionId": "nJBE6tif", {
"version": "2.3.0+mc1.21-1.21.1", "source": "modrinth",
"path": "mods/noisium-neoforge-2.3.0+mc1.21-1.21.1.jar", "slug": "lithostitched",
"url": "https://cdn.modrinth.com/data/KuNKN7d2/versions/nJBE6tif/noisium-neoforge-2.3.0%2Bmc1.21-1.21.1.jar", "versionId": "IONexlgI",
"sha1": "1bea6b61378ba80f038256c4345d9ff3b67928c4", "version": "1.7.2-neoforge-21.1",
"size": 60296 "path": "mods/lithostitched-1.7.2-neoforge-21.1.jar",
}, "url": "https://cdn.modrinth.com/data/XaDC71GB/versions/IONexlgI/lithostitched-1.7.2-neoforge-21.1.jar",
{ "sha1": "ce35206214647131ebdf14212d1986349aeba79a",
"source": "modrinth", "size": 810015,
"slug": "async-locator-refined", "side": "server"
"versionId": "3BdGHbV2", },
"version": "1.21.1-1.5.3", {
"path": "mods/async-locator-refined-neoforge-1.21.1-1.5.3.jar", "source": "modrinth",
"url": "https://cdn.modrinth.com/data/LUIHK4LD/versions/3BdGHbV2/async-locator-refined-neoforge-1.21.1-1.5.3.jar", "slug": "c2me-neoforge",
"sha1": "2993e3efc6d211ad8d4db179851dea6fdfff4e07", "versionId": "9iPiN34N",
"size": 273320 "version": "0.3.0+alpha.0.91+1.21.1",
}, "path": "mods/c2me-neoforge-mc1.21.1-0.3.0+alpha.0.91.jar",
{ "url": "https://cdn.modrinth.com/data/COlSi5iR/versions/9iPiN34N/c2me-neoforge-mc1.21.1-0.3.0%2Balpha.0.91.jar",
"source": "modrinth", "sha1": "c858c8becfb5205eb12aaf0420eb82c307c2e6a7",
"slug": "servercore", "size": 4508649,
"versionId": "77MAnmOn", "side": "both"
"version": "1.5.10+1.21.1", },
"path": "mods/servercore-neoforge-1.5.10+1.21.1.jar", {
"url": "https://cdn.modrinth.com/data/4WWQxlQP/versions/77MAnmOn/servercore-neoforge-1.5.10%2B1.21.1.jar", "source": "modrinth",
"sha1": "4524cd40cfa5019d8b5fbcb628b1616031838a0c", "slug": "noisium",
"size": 1429522 "versionId": "nJBE6tif",
}, "version": "2.3.0+mc1.21-1.21.1",
{ "path": "mods/noisium-neoforge-2.3.0+mc1.21-1.21.1.jar",
"source": "modrinth", "url": "https://cdn.modrinth.com/data/KuNKN7d2/versions/nJBE6tif/noisium-neoforge-2.3.0%2Bmc1.21-1.21.1.jar",
"slug": "lithium", "sha1": "1bea6b61378ba80f038256c4345d9ff3b67928c4",
"versionId": "RXHf27Wv", "size": 60296,
"version": "mc1.21.1-0.15.3-neoforge", "side": "server"
"path": "mods/lithium-neoforge-0.15.3+mc1.21.1.jar", },
"url": "https://cdn.modrinth.com/data/gvQqBUqZ/versions/RXHf27Wv/lithium-neoforge-0.15.3%2Bmc1.21.1.jar", {
"sha1": "9fd5fa9076044180ae7f51672de74669196ec72e", "source": "modrinth",
"size": 774148 "slug": "async-locator-refined",
}, "versionId": "3BdGHbV2",
{ "version": "1.21.1-1.5.3",
"source": "modrinth", "path": "mods/async-locator-refined-neoforge-1.21.1-1.5.3.jar",
"slug": "geckolib", "url": "https://cdn.modrinth.com/data/LUIHK4LD/versions/3BdGHbV2/async-locator-refined-neoforge-1.21.1-1.5.3.jar",
"versionId": "gFmrC8Ru", "sha1": "2993e3efc6d211ad8d4db179851dea6fdfff4e07",
"version": "4.8.4", "size": 273320,
"path": "mods/geckolib-neoforge-1.21.1-4.8.4.jar", "side": "server"
"url": "https://cdn.modrinth.com/data/8BmcQJ2H/versions/gFmrC8Ru/geckolib-neoforge-1.21.1-4.8.4.jar", },
"sha1": "eb854c8ec53ef922a5f3877a1aa4c1ce1352e0ce", {
"size": 622582 "source": "modrinth",
}, "slug": "servercore",
{ "versionId": "77MAnmOn",
"source": "modrinth", "version": "1.5.10+1.21.1",
"slug": "curios", "path": "mods/servercore-neoforge-1.5.10+1.21.1.jar",
"versionId": "yohfFbgD", "url": "https://cdn.modrinth.com/data/4WWQxlQP/versions/77MAnmOn/servercore-neoforge-1.5.10%2B1.21.1.jar",
"version": "9.5.1+1.21.1", "sha1": "4524cd40cfa5019d8b5fbcb628b1616031838a0c",
"path": "mods/curios-neoforge-9.5.1+1.21.1.jar", "size": 1429522,
"url": "https://cdn.modrinth.com/data/vvuO3ImH/versions/yohfFbgD/curios-neoforge-9.5.1%2B1.21.1.jar", "side": "server"
"sha1": "418fcd42e3a7844c9bdc71c9b6401fdb3894e0c4", },
"size": 410690 {
}, "source": "modrinth",
{ "slug": "lithium",
"source": "modrinth", "versionId": "RXHf27Wv",
"slug": "yungs-api", "version": "mc1.21.1-0.15.3-neoforge",
"versionId": "ZB22DE9q", "path": "mods/lithium-neoforge-0.15.3+mc1.21.1.jar",
"version": "1.21.1-NeoForge-5.1.6", "url": "https://cdn.modrinth.com/data/gvQqBUqZ/versions/RXHf27Wv/lithium-neoforge-0.15.3%2Bmc1.21.1.jar",
"path": "mods/YungsApi-1.21.1-NeoForge-5.1.6.jar", "sha1": "9fd5fa9076044180ae7f51672de74669196ec72e",
"url": "https://cdn.modrinth.com/data/Ua7DFN59/versions/ZB22DE9q/YungsApi-1.21.1-NeoForge-5.1.6.jar", "size": 774148,
"sha1": "e1c394779fb9e038e4f7a1b4558d0432607d263b", "side": "both"
"size": 388678 },
}, {
{ "source": "modrinth",
"source": "modrinth", "slug": "geckolib",
"slug": "complementary-reimagined", "versionId": "gFmrC8Ru",
"versionId": "836bPNGo", "version": "4.8.4",
"version": "r5.7.1", "path": "mods/geckolib-neoforge-1.21.1-4.8.4.jar",
"path": "shaderpacks/ComplementaryReimagined_r5.7.1.zip", "url": "https://cdn.modrinth.com/data/8BmcQJ2H/versions/gFmrC8Ru/geckolib-neoforge-1.21.1-4.8.4.jar",
"url": "https://cdn.modrinth.com/data/HVnmMxH1/versions/836bPNGo/ComplementaryReimagined_r5.7.1.zip", "sha1": "eb854c8ec53ef922a5f3877a1aa4c1ce1352e0ce",
"sha1": "b560f646a124d5204b1fb7321fec373b9c346fa5", "size": 622582,
"size": 522970 "side": "both"
} },
], {
"defaultServer": { "source": "modrinth",
"name": "Brass and Sigil", "slug": "curios",
"ip": "bns.sijbers.uk" "versionId": "yohfFbgD",
}, "version": "9.5.1+1.21.1",
"defaultShader": "ComplementaryReimagined_r5.7.1.zip", "path": "mods/curios-neoforge-9.5.1+1.21.1.jar",
"panelUrl": "https://bns-admin.sijbers.uk" "url": "https://cdn.modrinth.com/data/vvuO3ImH/versions/yohfFbgD/curios-neoforge-9.5.1%2B1.21.1.jar",
"sha1": "418fcd42e3a7844c9bdc71c9b6401fdb3894e0c4",
"size": 410690,
"side": "both"
},
{
"source": "modrinth",
"slug": "yungs-api",
"versionId": "ZB22DE9q",
"version": "1.21.1-NeoForge-5.1.6",
"path": "mods/YungsApi-1.21.1-NeoForge-5.1.6.jar",
"url": "https://cdn.modrinth.com/data/Ua7DFN59/versions/ZB22DE9q/YungsApi-1.21.1-NeoForge-5.1.6.jar",
"sha1": "e1c394779fb9e038e4f7a1b4558d0432607d263b",
"size": 388678,
"side": "both"
},
{
"source": "modrinth",
"slug": "complementary-reimagined",
"versionId": "836bPNGo",
"version": "r5.7.1",
"path": "shaderpacks/ComplementaryReimagined_r5.7.1.zip",
"url": "https://cdn.modrinth.com/data/HVnmMxH1/versions/836bPNGo/ComplementaryReimagined_r5.7.1.zip",
"sha1": "b560f646a124d5204b1fb7321fec373b9c346fa5",
"size": 522970,
"side": "client"
}
],
"defaultServer": {
"name": "Brass and Sigil",
"ip": "bns.sijbers.uk"
},
"defaultShader": "ComplementaryReimagined_r5.7.1.zip",
"panelUrl": "https://bns-admin.sijbers.uk"
} }
+96
View File
@@ -0,0 +1,96 @@
#requires -Version 7
<#
.SYNOPSIS
Populate the `side` field on each mod entry in pack.lock.json by querying
Modrinth's project metadata. Run once after schema migration; thereafter,
Update-Pack.ps1 should set side automatically when adding new mods.
.DESCRIPTION
Modrinth returns `client_side` and `server_side` per project, with values
`required` / `optional` / `unsupported` / `unknown`. We map:
server_side = unsupported -> side = "client" (skip on server)
client_side = unsupported -> side = "server" (skip on launcher)
both required/optional/unknown -> side = "both" (install everywhere)
Conservative: only marks a mod side-restricted when the OTHER side is
explicitly `unsupported`. Anything ambiguous stays "both".
CurseForge mods can't be queried (no API key here) -- left at "both" by
default, manual edit if needed.
.PARAMETER LockPath
pack.lock.json to update in place. Defaults to ../pack/pack.lock.json.
.PARAMETER DryRun
Print proposed changes without writing the file.
#>
[CmdletBinding()]
param(
[string]$LockPath = $(Join-Path (Split-Path -Parent $MyInvocation.MyCommand.Path) '..\pack\pack.lock.json'),
[switch]$DryRun
)
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
$LockPath = (Resolve-Path $LockPath).Path
$json = Get-Content $LockPath -Raw | ConvertFrom-Json -Depth 20
if (-not $json.mods) { throw "pack.lock.json has no 'mods' array." }
function Get-ModrinthSide {
param([string]$Slug)
$proj = Invoke-RestMethod -Uri "https://api.modrinth.com/v2/project/$Slug" `
-Headers @{ 'User-Agent' = 'BrassAndSigil-Launcher/0.1 (matt@sijbers.uk)' }
$cs = $proj.client_side; $ss = $proj.server_side
if ($ss -eq 'unsupported' -and $cs -ne 'unsupported') { return 'client' }
elseif ($cs -eq 'unsupported' -and $ss -ne 'unsupported') { return 'server' }
else { return 'both' }
}
Write-Host ""
Write-Host "Bootstrapping side field on $($json.mods.Count) mods..."
Write-Host ""
$changes = 0
foreach ($mod in $json.mods) {
$existing = if ($mod.PSObject.Properties.Name -contains 'side') { $mod.side } else { $null }
if ($mod.source -ne 'modrinth') {
# CurseForge or other: default to 'both' if missing, leave alone otherwise.
if (-not $existing) {
$mod | Add-Member -NotePropertyName 'side' -NotePropertyValue 'both' -Force
Write-Host (" [{0}] {1,-26} {2}" -f $mod.source.PadRight(7).Substring(0,7), $mod.slug, 'both (default; non-modrinth)')
$changes++
}
continue
}
try {
$side = Get-ModrinthSide -Slug $mod.slug
} catch {
Write-Warning (" $($mod.slug) lookup failed: $($_.Exception.Message) -- leaving as 'both'")
$side = 'both'
}
if ($existing -ne $side) {
$mod | Add-Member -NotePropertyName 'side' -NotePropertyValue $side -Force
Write-Host (" [{0}] {1,-26} {2}" -f $mod.source.PadRight(7).Substring(0,7), $mod.slug, $side)
$changes++
} else {
Write-Host (" [{0}] {1,-26} {2} (unchanged)" -f $mod.source.PadRight(7).Substring(0,7), $mod.slug, $side) -ForegroundColor DarkGray
}
Start-Sleep -Milliseconds 100 # be polite to Modrinth's API
}
Write-Host ""
Write-Host "$changes mod(s) updated."
if ($DryRun) {
Write-Host "DryRun: not writing $LockPath." -ForegroundColor DarkGray
exit 0
}
# Round-trip via JSON: Modrinth-returned ConvertFrom-Json objects don't always
# round-trip with consistent property order, so we serialise with sorted keys
# at the mod level to keep the lockfile diff minimal.
$json | ConvertTo-Json -Depth 20 | Set-Content -Path $LockPath -Encoding utf8
Write-Host "Wrote $LockPath" -ForegroundColor Green
+9 -2
View File
@@ -77,14 +77,21 @@ $files = @()
$totalBytes = 0L $totalBytes = 0L
foreach ($mod in $lock.mods) { foreach ($mod in $lock.mods) {
$files += [pscustomobject]@{ # `side` is emitted only when explicitly set in the lockfile -- a missing or
# null lockfile side means "both", and we keep the manifest clean by omitting
# the field rather than serialising "both" everywhere.
$entry = [ordered]@{
path = $mod.path path = $mod.path
url = $mod.url url = $mod.url
sha1 = $mod.sha1 sha1 = $mod.sha1
size = $mod.size size = $mod.size
} }
$hasSide = ($mod.PSObject.Properties.Name -contains 'side') -and $mod.side -and $mod.side -ne 'both'
if ($hasSide) { $entry.side = $mod.side }
$files += [pscustomobject]$entry
$totalBytes += $mod.size $totalBytes += $mod.size
Write-Host (" [{0}] {1,-26} {2,-22} {3,8:N0} KB" -f $mod.source.PadRight(7).Substring(0,7), $mod.slug, $mod.version, ($mod.size/1KB)) $sideTag = if ($hasSide) { " [$($mod.side)]" } else { '' }
Write-Host (" [{0}] {1,-26} {2,-22} {3,8:N0} KB{4}" -f $mod.source.PadRight(7).Substring(0,7), $mod.slug, $mod.version, ($mod.size/1KB), $sideTag)
} }
# Local overrides (configs, custom files not on Modrinth/CurseForge) # Local overrides (configs, custom files not on Modrinth/CurseForge)
+7
View File
@@ -37,6 +37,12 @@ public sealed class ManifestFile
[JsonPropertyName("url")] public string Url { get; set; } = ""; [JsonPropertyName("url")] public string Url { get; set; } = "";
[JsonPropertyName("sha1")] public string? Sha1 { get; set; } [JsonPropertyName("sha1")] public string? Sha1 { get; set; }
[JsonPropertyName("size")] public long? Size { get; set; } [JsonPropertyName("size")] public long? Size { get; set; }
/// <summary>
/// "both" (default), "client", or "server". Server skips "client" files;
/// launcher skips "server" files. Null/missing = "both".
/// </summary>
[JsonPropertyName("side")] public string? Side { get; set; }
} }
public sealed class PackLock public sealed class PackLock
@@ -59,4 +65,5 @@ public sealed class LockedMod
[JsonPropertyName("url")] public string Url { get; set; } = ""; [JsonPropertyName("url")] public string Url { get; set; } = "";
[JsonPropertyName("sha1")] public string Sha1 { get; set; } = ""; [JsonPropertyName("sha1")] public string Sha1 { get; set; } = "";
[JsonPropertyName("size")] public long Size { get; set; } [JsonPropertyName("size")] public long Size { get; set; }
[JsonPropertyName("side")] public string? Side { get; set; }
} }
+14 -3
View File
@@ -38,12 +38,20 @@ public sealed class ManifestSync
progress?.Report($"Pack: {manifest.Name} v{manifest.Version}"); progress?.Report($"Pack: {manifest.Name} v{manifest.Version}");
Directory.CreateDirectory(serverDir); Directory.CreateDirectory(serverDir);
// Resolve which mods are server-side. // Build-time tagging is authoritative: anything marked "client" is dropped
var skipSlugs = await ResolveServerSideSkipListAsync(manifest, ct); // outright, anything marked "server" or "both" is kept. We only fall back
// to the runtime Modrinth lookup for files with NO explicit side -- this
// keeps un-tagged (or CurseForge-only) mods safe and matches pre-side
// behaviour for them.
var needsLookup = manifest.Files.Where(f => string.IsNullOrEmpty(f.Side)).ToList();
var skipSlugs = needsLookup.Count > 0
? await ResolveServerSideSkipListAsync(
new Manifest { Files = needsLookup }, ct)
: new HashSet<string>(StringComparer.OrdinalIgnoreCase);
// Build the filtered list of files to keep on the server. // Build the filtered list of files to keep on the server.
var keepFiles = manifest.Files var keepFiles = manifest.Files
.Where(f => !ShouldSkipFile(f.Path, skipSlugs)) .Where(f => !IsClientOnly(f) && (!string.IsNullOrEmpty(f.Side) || !ShouldSkipFile(f.Path, skipSlugs)))
.ToList(); .ToList();
var skippedCount = manifest.Files.Count - keepFiles.Count; var skippedCount = manifest.Files.Count - keepFiles.Count;
@@ -108,6 +116,9 @@ public sealed class ManifestSync
|| name.Equals(slug, StringComparison.OrdinalIgnoreCase)); || name.Equals(slug, StringComparison.OrdinalIgnoreCase));
} }
private static bool IsClientOnly(ManifestFile f)
=> string.Equals(f.Side, "client", StringComparison.OrdinalIgnoreCase);
/// <summary>Walk the manifest's mod URLs; for Modrinth ones, look up server_side; build a skip set.</summary> /// <summary>Walk the manifest's mod URLs; for Modrinth ones, look up server_side; build a skip set.</summary>
private async Task<HashSet<string>> ResolveServerSideSkipListAsync(Manifest manifest, CancellationToken ct) private async Task<HashSet<string>> ResolveServerSideSkipListAsync(Manifest manifest, CancellationToken ct)
{ {