Host side of the vanilla structure hook's starts, adjustments and setup; the planner is gone

ModuleVanillaStructures asks every hook for rules and adjustments (per engine, structure and snapshot), starts per
chunk (converted to NativeStructureStartPlan, refused outside the chunk asked for) and setup per dimension before a
world exists (DimensionSettings: the dimension's settings without an engine). NativeStructureStartPlan carries the
module's start as host types (structure key, chunk, world base Y, underground, replacesPlatformStart, identity,
IrisJigsawConfiguration, stilt, terrain) and decision(); NativeStructureStarts replaces plansAt/matchingPlan.
NativeStructureGenerationPolicy builds its decision from rule and adjustment only. NativeStructureFrequencies (host)
replaces IrisImportedStructureControl in INMSBinding, Bukkit NMS, DatapackStructureScopeSVC and modded frequency
overrides; DatapackIngestService asks setup for protecting vanilla definitions. IrisValues converts the fit value
types to Iris's classes (same JSON). Studio: Reference.STRUCTURE_PREFIX/STRUCTURE_SET complete like Iris's prefix
and structure set lists; the annotation branches they replace are gone. Validators read the iris:structure key.
Messages name iris:structure instead of importedStructures.

Tests: NativeStructureStartsTest pins the planner's starts for seed 1337 (52 starts) and the fit JSON;
NativeStartPlannerTest (moved), ImportedStructuresTest (was IrisImportedStructureControlTest),
StructureSettingsDecodingTest (migrated overworld JSON), policy, schema, validator, handler, Bukkit NMS and modded
tests ported.
This commit is contained in:
piexel committed 2026-10-09 22:09:44 +02:00
1 parent 49b82f7c16
commit 23e07c3a5f
49 files changed
+1301 -1078

No files matched your search

@@ -8,7 +8,7 @@ import art.arcane.iris.core.nms.INMS;
import art.arcane.iris.core.tools.IrisToolbelt;
import art.arcane.iris.engine.platform.BukkitChunkGenerator;
import art.arcane.iris.engine.platform.PlatformChunkGenerator;
import art.arcane.iris.engine.object.structure.vanilla.IrisImportedStructureControl;
import art.arcane.iris.engine.framework.NativeStructureFrequencies;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.util.common.plugin.IrisService;
import org.bukkit.Bukkit;
@@ -41,9 +41,9 @@ public final class DatapackStructureScopeSVC implements IrisService {
}
for (World world : Bukkit.getWorlds()) {
try {
IrisImportedStructureControl importedStructures = importedStructures(world);
if (!scopeIndex.isEmpty() || importedStructures != null && importedStructures.hasFrequencyOverrides()) {
applyScope(world, importedStructures);
NativeStructureFrequencies frequencies = frequencies(world);
if (!scopeIndex.isEmpty() || frequencies.hasOverrides()) {
applyScope(world, frequencies);
}
} catch (Throwable e) {
// Per-world containment: one world's scoping failure must not abort the
@@ -67,10 +67,9 @@ public final class DatapackStructureScopeSVC implements IrisService {
boolean studioEntryBootstrap = event.getWorld().getGenerator()
instanceof BukkitChunkGenerator generator
&& generator.isStudioEntryBootstrapActive();
IrisImportedStructureControl importedStructures = importedStructures(event.getWorld());
if (shouldApplyScope(scopeIndex.isEmpty(), studioEntryBootstrap,
importedStructures != null && importedStructures.hasFrequencyOverrides())) {
applyScope(event.getWorld(), importedStructures);
NativeStructureFrequencies frequencies = frequencies(event.getWorld());
if (shouldApplyScope(scopeIndex.isEmpty(), studioEntryBootstrap, frequencies.hasOverrides())) {
applyScope(event.getWorld(), frequencies);
}
}
@@ -84,14 +83,11 @@ public final class DatapackStructureScopeSVC implements IrisService {
return !scopeIndexEmpty || studioEntryBootstrap || hasFrequencyOverrides;
}
private void applyScope(World world, IrisImportedStructureControl importedStructures) {
private void applyScope(World world, NativeStructureFrequencies frequencies) {
Set<String> declaredSources = declaredSources(world);
IrisImportedStructureControl activeControl = importedStructures == null
? new IrisImportedStructureControl()
: importedStructures;
try {
DatapackStructureScopeResult result = INMS.get().scopeDatapackStructures(
world, scopeIndex, declaredSources, activeControl);
world, scopeIndex, declaredSources, frequencies);
IrisLogging.info("Scoped Iris-managed datapack structure sets for world '"
+ world.getName() + "': " + result.retainedManagedSets() + " retained, "
+ result.excludedManagedSets() + " excluded.");
@@ -101,13 +97,13 @@ public final class DatapackStructureScopeSVC implements IrisService {
}
}
private IrisImportedStructureControl importedStructures(World world) {
private NativeStructureFrequencies frequencies(World world) {
PlatformChunkGenerator generator = IrisToolbelt.access(world);
if (generator == null || generator.getTarget() == null
|| generator.getTarget().getDimension() == null) {
return null;
return NativeStructureFrequencies.NONE;
}
return generator.getTarget().getDimension().getImportedStructures();
return NativeStructureFrequencies.of(generator.getTarget().getData(), generator.getTarget().getDimension());
}
private Set<String> declaredSources(World world) {
@@ -118,7 +118,7 @@ public class IrisStructureLocateCommandContractTest {
@Test
public void unregisteredDiagnosticExplainsEveryRejectedRoute() {
assertEquals(
"Native structure minecraft:village is disabled by this dimension's importedStructures settings or a module of the pack.",
"Native structure minecraft:village is disabled by this dimension's iris:structure settings or a module of the pack.",
CommandFind.describeStructureExclusion(
CommandFind.StructureLookupRoute.POLICY_DISABLED, "minecraft:village",
NativeStructureGenerationStatus.DISABLED_BY_PACK,
@@ -214,7 +214,7 @@ public class IrisStructureLocateCommandContractTest {
@Test
public void findNativePolicyMessagesMatchModdedDiagnostics() {
assertEquals(
"Native structure minecraft:village_plains is disabled by this dimension's importedStructures settings or a module of the pack.",
"Native structure minecraft:village_plains is disabled by this dimension's iris:structure settings or a module of the pack.",
NativeStructureGenerationPolicy.generationStatusMessage(
"minecraft:village_plains", NativeStructureGenerationStatus.DISABLED_BY_PACK));
assertEquals(