mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 16:54:04 +00:00
Serve module resource kinds through IrisPackResources, run module validators wherever packs are validated, and drop the structure, jigsaw pool and piece loaders and validators from core
This commit is contained in:
1 parent
12c315bb52
commit
2f3ba3cebe
55 files changed
+1770
-1060
No files matched your search
@@ -18,6 +18,7 @@
|
||||
|
||||
package art.arcane.iris.core.commands;
|
||||
|
||||
import art.arcane.iris.engine.framework.structure.StructureResources;
|
||||
import art.arcane.iris.Iris;
|
||||
import art.arcane.iris.core.localization.BukkitCommandMessages;
|
||||
import art.arcane.iris.core.localization.BukkitCommandMessagesExtended;
|
||||
@@ -315,7 +316,7 @@ public class CommandFind implements DirectorExecutor {
|
||||
Set<String> unplacedEditableKeys = new LinkedHashSet<>();
|
||||
Set<String> locatableEditableKeys = normalizedStructureKeys(
|
||||
IrisStructureLocator.locatableEditableKeys(engine));
|
||||
for (String editableKey : engine.getData().getStructureLoader().getPossibleKeys()) {
|
||||
for (String editableKey : StructureResources.structureKeys(engine.getData())) {
|
||||
String normalizedKey = normalizeStructureKey(editableKey);
|
||||
if (!isUnplacedEditableCandidate(
|
||||
normalizedKey, registeredKeys.keySet(), locatableEditableKeys,
|
||||
|
||||
+7
-7
@@ -1,5 +1,6 @@
|
||||
package art.arcane.iris.core.commands;
|
||||
|
||||
import art.arcane.iris.engine.framework.structure.StructureResources;
|
||||
import art.arcane.iris.Iris;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.core.pack.BrokenPackException;
|
||||
@@ -262,7 +263,7 @@ public class CommandJigsaw implements DirectorExecutor {
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
IrisStructure irisStructure = data.load(IrisStructure.class, structure, false);
|
||||
IrisStructure irisStructure = StructureResources.structure(data, structure);
|
||||
if (irisStructure == null) {
|
||||
sendError(commandSender, "No Iris jigsaw structure '" + structure + "' exists in this pack.");
|
||||
return;
|
||||
@@ -1215,7 +1216,7 @@ public class CommandJigsaw implements DirectorExecutor {
|
||||
static JigsawStudioLayout loadPersistedLayout(ActiveContext context) throws IOException {
|
||||
IrisData source = context.request().source();
|
||||
source.invalidateStructureResources();
|
||||
IrisStructure structure = source.load(IrisStructure.class, context.request().structureKey(), false);
|
||||
IrisStructure structure = StructureResources.structure(source, context.request().structureKey());
|
||||
if (structure == null) {
|
||||
throw new IOException("The structure could not be reloaded after the graph transaction");
|
||||
}
|
||||
@@ -1274,10 +1275,9 @@ public class CommandJigsaw implements DirectorExecutor {
|
||||
}
|
||||
|
||||
static String nextThemeKey(ActiveContext context) throws IOException {
|
||||
IrisStructure structure = context.request().source().load(
|
||||
IrisStructure.class,
|
||||
context.request().structureKey(),
|
||||
false);
|
||||
IrisStructure structure = StructureResources.structure(
|
||||
context.request().source(),
|
||||
context.request().structureKey());
|
||||
if (structure == null) {
|
||||
throw new IOException("The active jigsaw structure could not be loaded");
|
||||
}
|
||||
@@ -1749,7 +1749,7 @@ public class CommandJigsaw implements DirectorExecutor {
|
||||
sendError(this, "Open a Jigsaw Studio project first.");
|
||||
return;
|
||||
}
|
||||
IrisJigsawPiece piece = context.request().source().getJigsawPieceLoader().load(pieceKey);
|
||||
IrisJigsawPiece piece = StructureResources.piece(context.request().source(), pieceKey);
|
||||
if (piece == null) {
|
||||
sendError(this, "No jigsaw piece '" + pieceKey + "' exists in this pack.");
|
||||
return;
|
||||
|
||||
+3
-2
@@ -18,6 +18,7 @@
|
||||
|
||||
package art.arcane.iris.core.commands;
|
||||
|
||||
import art.arcane.iris.engine.framework.structure.StructureResources;
|
||||
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
||||
import art.arcane.iris.Iris;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
@@ -301,7 +302,7 @@ public class CommandStructure implements DirectorExecutor {
|
||||
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STRUCTURE_COULD_NOT_RESOLVE_PACK_DIMENSION_4, MessageArgument.untrusted("value", dimension.getLoadKey())));
|
||||
return;
|
||||
}
|
||||
IrisStructure s = data.load(IrisStructure.class, structure, false);
|
||||
IrisStructure s = StructureResources.structure(data, structure);
|
||||
if (s == null) {
|
||||
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STRUCTURE_NO_IRIS_STRUCTURE_THIS_PACK, MessageArgument.untrusted("structure", structure)));
|
||||
return;
|
||||
@@ -339,7 +340,7 @@ public class CommandStructure implements DirectorExecutor {
|
||||
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STRUCTURE_COULD_NOT_RESOLVE_PACK_DIMENSION_5, MessageArgument.untrusted("value", dimension.getLoadKey())));
|
||||
return;
|
||||
}
|
||||
IrisStructure s = data.load(IrisStructure.class, structure, false);
|
||||
IrisStructure s = StructureResources.structure(data, structure);
|
||||
if (s == null) {
|
||||
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STRUCTURE_NO_IRIS_STRUCTURE_THIS_PACK_2, MessageArgument.untrusted("structure", structure)));
|
||||
return;
|
||||
|
||||
+1
-1
@@ -207,7 +207,7 @@ public class IrisStructureLocateCommandContractTest {
|
||||
assertTrue(method.indexOf("DatapackIngestService.installed()") > method.indexOf("J.a(() ->"));
|
||||
assertTrue(source.contains("engine.getDimension().getDatapackImports()"));
|
||||
assertTrue(source.contains("snapshot.configuredImportUrls().contains(importUrl)"));
|
||||
assertTrue(source.contains("engine.getData().getStructureLoader().getPossibleKeys()"));
|
||||
assertTrue(source.contains("StructureResources.structureKeys(engine.getData())"));
|
||||
assertFalse(method.contains("commandSender.sendMessage(exclusion"));
|
||||
}
|
||||
|
||||
|
||||
+2
@@ -20,6 +20,7 @@ package art.arcane.iris.modded;
|
||||
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
import art.arcane.iris.core.loader.ResourceLoader;
|
||||
import art.arcane.iris.core.project.ModuleResourceSchemas;
|
||||
import art.arcane.iris.core.project.SchemaBuilder;
|
||||
import art.arcane.iris.engine.object.annotations.Snippet;
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
@@ -95,6 +96,7 @@ public final class ModdedWorkspaceGenerator {
|
||||
schemas.put(immediateSchemas ? loader.buildSchemaImmediately() : loader.buildSchema());
|
||||
}
|
||||
}
|
||||
ModuleResourceSchemas.entries(data, immediateSchemas).forEach(schemas::put);
|
||||
|
||||
for (Class<?> snippetClass : data.resolveSnippets()) {
|
||||
try {
|
||||
|
||||
+5
-4
@@ -18,6 +18,7 @@
|
||||
|
||||
package art.arcane.iris.modded.command;
|
||||
|
||||
import art.arcane.iris.engine.framework.structure.StructureResources;
|
||||
import art.arcane.iris.engine.object.placement.IrisObjectPlacement;
|
||||
import art.arcane.iris.modded.ModdedIrisLog;
|
||||
import art.arcane.iris.core.loader.IrisData;
|
||||
@@ -140,7 +141,7 @@ public final class ModdedStructureCommands {
|
||||
return 0;
|
||||
}
|
||||
String key = keyRaw.trim();
|
||||
IrisStructure structure = data.load(IrisStructure.class, key, false);
|
||||
IrisStructure structure = StructureResources.structure(data, key);
|
||||
if (structure == null) {
|
||||
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STRUCTURE_COMMANDS_NO_IRIS_STRUCTURE_THIS_PACK, MessageArgument.untrusted("key", key)));
|
||||
return 0;
|
||||
@@ -180,7 +181,7 @@ public final class ModdedStructureCommands {
|
||||
return 0;
|
||||
}
|
||||
String key = keyRaw.trim();
|
||||
IrisStructure structure = data.load(IrisStructure.class, key, false);
|
||||
IrisStructure structure = StructureResources.structure(data, key);
|
||||
if (structure == null) {
|
||||
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STRUCTURE_COMMANDS_NO_IRIS_STRUCTURE_THIS_PACK_2, MessageArgument.untrusted("key", key)));
|
||||
return 0;
|
||||
@@ -226,8 +227,8 @@ public final class ModdedStructureCommands {
|
||||
ModdedCommandFeedback.tab(context.getSource());
|
||||
try {
|
||||
Engine engine = IrisModdedCommands.engineFor(context.getSource().getLevel());
|
||||
if (engine != null && engine.getData().getStructureLoader() != null) {
|
||||
return SharedSuggestionProvider.suggest(engine.getData().getStructureLoader().getPossibleKeys(), builder);
|
||||
if (engine != null) {
|
||||
return SharedSuggestionProvider.suggest(StructureResources.structureKeys(engine.getData()), builder);
|
||||
}
|
||||
} catch (Throwable ignored) {
|
||||
}
|
||||
|
||||
+16
-17
@@ -18,6 +18,7 @@
|
||||
|
||||
package art.arcane.iris.modded.command;
|
||||
|
||||
import art.arcane.iris.engine.framework.structure.StructureResources;
|
||||
import art.arcane.iris.modded.ModdedIrisLog;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.framework.IrisStructureLocator;
|
||||
@@ -72,7 +73,7 @@ final class ModdedUnregisteredStructures {
|
||||
entry.status().label(), entry.key(), entry.reason());
|
||||
}
|
||||
ModdedIrisLog.info("[Iris goto unregistered] Inventory scope is the live registry, this pack's "
|
||||
+ "nativeStructures placements, and structureLoader editable resources. This is deterministic "
|
||||
+ "nativeStructures placements, and its editable Iris structures. This is deterministic "
|
||||
+ "eligibility analysis and performs no chunk search; absent unmanaged datapack resources "
|
||||
+ "cannot be inferred after registry loading.");
|
||||
IrisModdedCommands.ok(source, "Iris wrote " + excluded.size() + " structure candidate(s) for "
|
||||
@@ -136,23 +137,21 @@ final class ModdedUnregisteredStructures {
|
||||
"Configured by an Iris nativeStructures placement, but absent from the live structure registry; "
|
||||
+ "install or enable the datapack or mod that provides this key."));
|
||||
}
|
||||
if (engine.getData().getStructureLoader() != null) {
|
||||
for (String key : engine.getData().getStructureLoader().getPossibleKeys()) {
|
||||
String normalizedKey = ModdedCommandSuggestions.normalizeKey(key);
|
||||
if (normalizedKey.isEmpty() || eligibleRegisteredKeys.contains(normalizedKey)
|
||||
|| excluded.containsKey(normalizedKey)) {
|
||||
continue;
|
||||
}
|
||||
boolean registered = registeredKeys.contains(normalizedKey);
|
||||
boolean nativePlacement = IrisStructureLocator.hasNativePlacement(engine, key);
|
||||
boolean locatableEditable = IrisStructureLocator.hasLocatableEditablePlacement(engine, key);
|
||||
if (!registered && !nativePlacement && locatableEditable) {
|
||||
continue;
|
||||
}
|
||||
boolean configured = IrisStructureLocator.hasEditablePlacement(engine, key);
|
||||
excluded.putIfAbsent(normalizedKey, new ExcludedStructure(
|
||||
ReportStatus.UNPLACED, key.trim(), editableExclusionReason(configured)));
|
||||
for (String key : StructureResources.structureKeys(engine.getData())) {
|
||||
String normalizedKey = ModdedCommandSuggestions.normalizeKey(key);
|
||||
if (normalizedKey.isEmpty() || eligibleRegisteredKeys.contains(normalizedKey)
|
||||
|| excluded.containsKey(normalizedKey)) {
|
||||
continue;
|
||||
}
|
||||
boolean registered = registeredKeys.contains(normalizedKey);
|
||||
boolean nativePlacement = IrisStructureLocator.hasNativePlacement(engine, key);
|
||||
boolean locatableEditable = IrisStructureLocator.hasLocatableEditablePlacement(engine, key);
|
||||
if (!registered && !nativePlacement && locatableEditable) {
|
||||
continue;
|
||||
}
|
||||
boolean configured = IrisStructureLocator.hasEditablePlacement(engine, key);
|
||||
excluded.putIfAbsent(normalizedKey, new ExcludedStructure(
|
||||
ReportStatus.UNPLACED, key.trim(), editableExclusionReason(configured)));
|
||||
}
|
||||
return List.copyOf(excluded.values());
|
||||
}
|
||||
|
||||
+1
-1
@@ -184,7 +184,7 @@ public class IrisModdedStructureCommandTest {
|
||||
assertTrue(tree.contains("ModdedUnregisteredStructures.print(context.getSource())"));
|
||||
assertTrue(command.contains("ModdedCommandSuggestions.isEligibleRegisteredStructure("));
|
||||
assertTrue(command.contains("ModdedLocateCommands.registeredStructureUnavailableMessage("));
|
||||
assertTrue(command.contains("engine.getData().getStructureLoader().getPossibleKeys()"));
|
||||
assertTrue(command.contains("StructureResources.structureKeys(engine.getData())"));
|
||||
assertTrue(command.contains("IrisStructureLocator.hasLocatableEditablePlacement(engine, key)"));
|
||||
assertTrue(command.contains("ModdedIrisLog.info(\"[Iris goto unregistered] [{}] {} - {}\""));
|
||||
assertTrue(command.contains("UNREGISTERED(\"unregistered\")"));
|
||||
|
||||
Reference in new issue
Block a user