mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-30 09:44:24 +00:00
Move the jigsaw commands and the structure importers onto the tooling api
Add PlatformStructures, the capability the structure importers read the platform through: templates, registered structures and structure sets, jigsaw structures, template pools with their connectors, and a closable capture area. The Bukkit host implements it in the plugin and takes over all reflection, the structure manager and the NMS calls; the importers keep only their model-building logic and report through the api sender. CommandContext.platformStructures() reaches it, ToolPlayer.targetBlock() lets a command read what the player looks at. CommandJigsaw, JigsawStudioBridge, IrisStructureHandler, the Director import and capture of CommandStructure and the modded stubs that explained the Bukkit workflow are replaced by the neutral jigsaw command tree in core/structure/tooling, mounted by StructureModelModule. Import and capture are now jigsaw sub-commands. The graph editor, the vanilla exporter and StructureIndexService speak api types: IrisObject hands out its contents as BlockState and BlockEntityData, exports go below ToolPack.outputFolder(), and the index writes through ToolPack.edit. The move lint is at 0 for the B2 set.
This commit is contained in:
1 parent
23c93e6e74
commit
ae11b38093
82 files changed
+6529
-4789
No files matched your search
-7
@@ -85,7 +85,6 @@ final class ModdedCommandHelp {
|
||||
Entry.group("pack", ModdedHelpMessages.GROUP_PACK_PACK_VALIDATION_AND_MAINTENANCE, "pk"),
|
||||
Entry.group("world", ModdedHelpMessages.GROUP_WORLD_RUNTIME_IRIS_DIMENSION_CREATION_REMOVAL_AND_STATUS, "w"),
|
||||
Entry.group("datapack", ModdedHelpMessages.GROUP_DATAPACK_WORLD_DATAPACK_INSTALL_AND_STATUS_HELPERS, "datapacks", "dp"),
|
||||
Entry.group("structure", ModdedHelpMessages.GROUP_STRUCTURE_IRIS_STRUCTURE_IMPORT_AND_CAPTURE_TOOLS, "struct", "str"),
|
||||
Entry.command(ToolingCommands.BRANCH, "<root> <command...>", ModdedHelpMessages.COMMAND_MODULE_RUN_A_MODULE_COMMAND_OR_LIST_THEM, ToolingCommands.BRANCH_ALIAS),
|
||||
Entry.command("goldenhash", "[radius] [threads] [capture|verify]", ModdedHelpMessages.COMMAND_GOLDENHASH_GENERATE_DETERMINISTIC_BLOCK_HASHES_FOR_PARITY_TESTING, "gold"),
|
||||
Entry.group("developer", ModdedHelpMessages.GROUP_DEVELOPER_DEVELOPER_DIAGNOSTICS_NETWORK_INTERFACES_REGION_FILE_SCAN, "dev")
|
||||
@@ -185,12 +184,6 @@ final class ModdedCommandHelp {
|
||||
));
|
||||
SECTIONS.put("datapacks", SECTIONS.get("datapack"));
|
||||
SECTIONS.put("dp", SECTIONS.get("datapack"));
|
||||
SECTIONS.put("structure", List.of(
|
||||
Entry.command("import", "", ModdedHelpMessages.COMMAND_IMPORT_EXPLAIN_BUKKIT_STRUCTURE_IMPORT_WORKFLOW, "import-all", "reimport", "imp", "all"),
|
||||
Entry.command("capture", "", ModdedHelpMessages.COMMAND_CAPTURE_EXPLAIN_BUKKIT_STRUCTURE_CAPTURE_WORKFLOW, "cap")
|
||||
));
|
||||
SECTIONS.put("struct", SECTIONS.get("structure"));
|
||||
SECTIONS.put("str", SECTIONS.get("structure"));
|
||||
SECTIONS.put("developer", List.of(
|
||||
Entry.command("network", "", ModdedHelpMessages.COMMAND_NETWORK_LIST_NETWORK_INTERFACES_AND_THEIR_ADDRESSES, "ip")
|
||||
));
|
||||
|
||||
-3
@@ -147,9 +147,6 @@ final class ModdedCommandTree {
|
||||
root.then(ModdedDatapackCommands.tree("datapack"));
|
||||
root.then(ModdedDatapackCommands.tree("datapacks"));
|
||||
root.then(ModdedDatapackCommands.tree("dp"));
|
||||
root.then(ModdedStructureCommands.tree("structure"));
|
||||
root.then(ModdedStructureCommands.tree("struct"));
|
||||
root.then(ModdedStructureCommands.tree("str"));
|
||||
root.then(ModdedDeveloperCommands.tree("developer"));
|
||||
root.then(ModdedDeveloperCommands.tree("dev"));
|
||||
root.then(ModdedModuleBranch.tree(ToolingCommands.BRANCH));
|
||||
|
||||
-66
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.modded.command;
|
||||
|
||||
import com.mojang.brigadier.arguments.StringArgumentType;
|
||||
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
|
||||
import com.mojang.brigadier.context.CommandContext;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.commands.Commands;
|
||||
|
||||
/**
|
||||
* The {@code /iris structure} literals that only explain the Bukkit-only import and capture. The structure module's own
|
||||
* commands ({@code list}, {@code info}, {@code verify}) are under {@code /iris module structure}.
|
||||
*/
|
||||
public final class ModdedStructureCommands {
|
||||
private static final String IMPORT_EXPLANATION = "Structure import rebuilds vanilla & datapack structures as editable Iris resources through Bukkit/NMS template managers; run /iris structure import on a Bukkit server against this pack, then copy the pack folder over.";
|
||||
private static final String CAPTURE_EXPLANATION = "Structure capture generates each structure in a throwaway Bukkit scratch world to read its blocks; it requires the Bukkit plugin (v26 NMS binding).";
|
||||
|
||||
private ModdedStructureCommands() {
|
||||
}
|
||||
|
||||
public static LiteralArgumentBuilder<CommandSourceStack> tree(String name) {
|
||||
LiteralArgumentBuilder<CommandSourceStack> root = Commands.literal(name).requires(ModdedCommandTree.GATE);
|
||||
|
||||
root.executes((CommandContext<CommandSourceStack> context) -> ModdedCommandHelp.send(context.getSource(), name));
|
||||
|
||||
root.then(message("import", IMPORT_EXPLANATION));
|
||||
root.then(message("import-all", IMPORT_EXPLANATION));
|
||||
root.then(message("reimport", IMPORT_EXPLANATION));
|
||||
root.then(message("imp", IMPORT_EXPLANATION));
|
||||
root.then(message("all", IMPORT_EXPLANATION));
|
||||
root.then(message("capture", CAPTURE_EXPLANATION));
|
||||
root.then(message("cap", CAPTURE_EXPLANATION));
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
private static LiteralArgumentBuilder<CommandSourceStack> message(String name, String text) {
|
||||
return Commands.literal(name)
|
||||
.executes((CommandContext<CommandSourceStack> context) -> {
|
||||
IrisModdedCommands.fail(context.getSource(), text);
|
||||
return 0;
|
||||
})
|
||||
.then(Commands.argument("args", StringArgumentType.greedyString())
|
||||
.executes((CommandContext<CommandSourceStack> context) -> {
|
||||
IrisModdedCommands.fail(context.getSource(), text);
|
||||
return 0;
|
||||
}));
|
||||
}
|
||||
}
|
||||
+8
-7
@@ -162,7 +162,7 @@ public class IrisModdedCommandParityTest {
|
||||
assertNotNull("iris", iris.getCommand());
|
||||
for (String category : new String[]{"help", "find", "goto", "pregen", "pregenerate", "object", "o",
|
||||
"edit", "studio", "std", "s", "pack", "pk", "world", "w", "datapack", "datapacks", "dp",
|
||||
"structure", "struct", "str", "developer", "dev", "module", "m"}) {
|
||||
"developer", "dev", "module", "m"}) {
|
||||
assertNotNull(category, child(iris, category).getCommand());
|
||||
}
|
||||
}
|
||||
@@ -174,9 +174,6 @@ public class IrisModdedCommandParityTest {
|
||||
for (CommandNode<CommandSourceStack> node : iris.getChildren()) {
|
||||
assertTrue(node.getName() + " must be a literal", node instanceof LiteralCommandNode);
|
||||
}
|
||||
for (CommandNode<CommandSourceStack> node : child(iris, "structure").getChildren()) {
|
||||
assertTrue("structure " + node.getName() + " must be a literal", node instanceof LiteralCommandNode);
|
||||
}
|
||||
for (String branch : new String[]{"module", "m"}) {
|
||||
CommandNode<CommandSourceStack> module = child(iris, branch);
|
||||
assertNotNull(branch + " lists the mounted commands on its own", module.getCommand());
|
||||
@@ -225,9 +222,13 @@ public class IrisModdedCommandParityTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void structureHelpListsOnlyImportAndCapture() {
|
||||
assertEquals(List.of("import", "import-all", "reimport", "imp", "all", "capture", "cap"),
|
||||
ModdedCommandHelp.documentedWords("structure"));
|
||||
public void structureImportAndCaptureAreModuleCommandsAndHaveNoLiteralsOfTheirOwn() {
|
||||
CommandNode<CommandSourceStack> iris = irisNode();
|
||||
|
||||
for (String structure : new String[]{"structure", "struct", "str"}) {
|
||||
assertNull(structure, iris.getChild(structure));
|
||||
}
|
||||
assertFalse(ModdedCommandHelp.sections().contains("structure"));
|
||||
}
|
||||
|
||||
private static CommandNode<CommandSourceStack> child(
|
||||
|
||||
+2
-3
@@ -281,10 +281,9 @@ public class IrisModdedStructureCommandTest {
|
||||
|
||||
@Test
|
||||
public void structureListInfoAndVerifyBelongToTheStructureModule() throws IOException {
|
||||
String source = source("ModdedStructureCommands.java");
|
||||
Path staticTree = commonSourceRoot().resolve("art/arcane/iris/modded/command/ModdedStructureCommands.java");
|
||||
|
||||
assertFalse(source.contains("Commands.literal(\"list\")"));
|
||||
assertFalse(source.contains("verifyTree("));
|
||||
assertFalse(Files.exists(staticTree));
|
||||
}
|
||||
|
||||
private String source(String fileName) throws IOException {
|
||||
|
||||
Reference in new issue
Block a user