From d5796b275e674d278e893e55baab5df43410ed97 Mon Sep 17 00:00:00 2001 From: Brian Neumann-Fopiano Date: Wed, 14 Oct 2026 21:41:41 -0400 Subject: [PATCH] Audited datapack priority mixin - The modded mixin audit checks that the pack selection mixin keeping the Iris forced datapack last is applied - Ordering tests cover a world datapack saved after the Iris pack and already-ordered selections --- .../arcane/iris/modded/ModdedMixinAudit.java | 6 ++- .../iris/modded/ModdedDatapackOrderTest.java | 51 +++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 adapters/modded-common/src/test/java/art/arcane/iris/modded/ModdedDatapackOrderTest.java diff --git a/adapters/modded-common/src/main/java/art/arcane/iris/modded/ModdedMixinAudit.java b/adapters/modded-common/src/main/java/art/arcane/iris/modded/ModdedMixinAudit.java index 62e3b3fe1..decc3121f 100644 --- a/adapters/modded-common/src/main/java/art/arcane/iris/modded/ModdedMixinAudit.java +++ b/adapters/modded-common/src/main/java/art/arcane/iris/modded/ModdedMixinAudit.java @@ -61,6 +61,10 @@ public final class ModdedMixinAudit { NativeMixinTarget.STRUCTURE_PALETTE, "iris$installConcurrentBlockCache", false, NativeMixinFlags::structureTemplatePaletteRan), + new ExpectedMixin(ENTITY_CONFIG, "PackRepositorySelectionMixin", + NativeMixinTarget.PACK_REPOSITORY, + "volmlib$keepNativeDatapacksLast", + false, NativeMixinFlags::packSelectionRan), new ExpectedMixin(CLIENT_CONFIG, "NativeWorldOpenFlowsMixin", NativeMixinTarget.WORLD_OPEN_FLOWS, "volmlib$openWorldCheckWorldStemCompatibility", @@ -111,7 +115,7 @@ public final class ModdedMixinAudit { ModdedIrisLog.error(" missing: {}", entry); } ModdedIrisLog.error("The mixin config was not registered for this loader (fabric.mod.json mixins, neoforge.mods.toml [[mixins]], forge MixinConfigs manifest attribute)."); - ModdedIrisLog.error("Entity persistence, custom mob loot, parallel structure safety, readable biome identifiers, or Iris world-type labels are disabled until this is fixed."); + ModdedIrisLog.error("Entity persistence, custom mob loot, parallel structure safety, Iris datapack priority, readable biome identifiers, or Iris world-type labels are disabled until this is fixed."); ModdedIrisLog.error("==============================================================="); } diff --git a/adapters/modded-common/src/test/java/art/arcane/iris/modded/ModdedDatapackOrderTest.java b/adapters/modded-common/src/test/java/art/arcane/iris/modded/ModdedDatapackOrderTest.java new file mode 100644 index 000000000..11df85894 --- /dev/null +++ b/adapters/modded-common/src/test/java/art/arcane/iris/modded/ModdedDatapackOrderTest.java @@ -0,0 +1,51 @@ +/* + * Iris is a World Generator for Minecraft Servers + * Copyright (c) 2026 Arcane Arts (Volmit Software) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package art.arcane.iris.modded; + +import art.arcane.volmlib.nativelib.minecraft26_2.modded.NativeDatapackSource; +import org.junit.Test; + +import java.util.List; +import java.util.Set; +import java.util.function.Function; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertSame; + +public class ModdedDatapackOrderTest { + private static final Set PINNED = Set.of("iris_worldgen"); + + @Test + public void worldDatapacksSavedAfterTheIrisPackNoLongerOverrideIt() { + List saved = List.of("vanilla", "mod_data", "iris_worldgen", "file/iristest"); + + assertEquals(List.of("vanilla", "mod_data", "file/iristest", "iris_worldgen"), + NativeDatapackSource.orderPinnedLast(saved, Function.identity(), PINNED)); + } + + @Test + public void alreadyLastOrUnpinnedSelectionsAreReturnedUnchanged() { + List ordered = List.of("vanilla", "file/iristest", "iris_worldgen"); + List withoutIris = List.of("vanilla", "file/iristest"); + + assertSame(ordered, NativeDatapackSource.orderPinnedLast(ordered, Function.identity(), PINNED)); + assertSame(withoutIris, NativeDatapackSource.orderPinnedLast(withoutIris, Function.identity(), PINNED)); + assertSame(withoutIris, NativeDatapackSource.orderPinnedLast(withoutIris, Function.identity(), Set.of())); + } +}