Take only patches on their own and leave bigger module updates to the update commands

A pack used to take every newer module on load, and a major update can change the
blocks it places or stop its settings from loading. Now a load takes patches only.
A module with a new minor or major version stays as it is, and Iris warns that it is
out of date and names the new version.

/iris std update <pack> now only updates the pack's module jars, for its author to
run before checking the settings against the new versions. It no longer writes the
VSCode workspace; studio hotload picks up the new jars and refreshes the workspace.
/iris pack update does the same for a running world, which loads the new jars at
the next server start.
This commit is contained in:
piexel committed 2026-11-11 13:31:24 +01:00
1 parent 6e96c6b71e
commit 0d18637128
36 files changed
+282 -292

No files matched your search

@@ -150,7 +150,7 @@ final class ModdedCommandHelp {
Entry.command("status", "", ModdedHelpMessages.COMMAND_STATUS_SHOW_THE_OPEN_STUDIO_DIMENSION_AND_ITS_PACK),
Entry.command("map", "", ModdedHelpMessages.COMMAND_MAP_OPEN_THE_VISION_MAP_GUI_ON_THE_SERVER_DISPLAY, "render"),
Entry.command("vscode", "[pack]", ModdedHelpMessages.COMMAND_VSCODE_REGENERATE_THE_CODE_WORKSPACE_FOR_A_PACK_AND_OPEN_IT_IN_YOUR, "vsc"),
Entry.command("update", "[pack]", ModdedHelpMessages.COMMAND_UPDATE_REGENERATE_THE_CODE_WORKSPACE_FOR_A_PACK),
Entry.command("update", "[pack]", ModdedHelpMessages.COMMAND_UPDATE_UPDATE_PACK_MODULES),
Entry.command("importvanilla", "", ModdedHelpMessages.COMMAND_IMPORTVANILLA_EXPLAIN_VANILLA_IMPORT_WORKFLOW, "importv", "iv"),
Entry.command("loot", "", ModdedHelpMessages.COMMAND_STUDIO_LOOT_BUKKIT_ONLY),
Entry.command("profile", "", ModdedHelpMessages.COMMAND_STUDIO_PROFILE_BUKKIT_ONLY),
@@ -205,7 +205,7 @@ public final class ModdedPackCommands {
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.IRIS_MODDED_COMMANDS_THIS_DIMENSION_IS_NOT_GENERATED_BY_IRIS_5));
return 0;
}
KeptModuleUpdates.take(engine.getData()).forEach(line -> IrisModdedCommands.ok(source, IrisLogging.clean(line)));
KeptModuleUpdates.takeForWorld(engine.getData()).forEach(line -> IrisModdedCommands.ok(source, IrisLogging.clean(line)));
return 1;
}
@@ -23,6 +23,7 @@ import art.arcane.iris.core.gui.GuiHost;
import art.arcane.iris.core.gui.ImageMapStudioGUI;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.localization.IrisMessages;
import art.arcane.iris.core.modules.KeptModuleUpdates;
import art.arcane.iris.core.modules.PackModulesListing;
import art.arcane.iris.spi.IrisLogging;
import art.arcane.iris.core.studio.bridge.StudioBridge;
@@ -123,9 +124,12 @@ public final class ModdedStudioCommands {
.executes((CommandContext<CommandSourceStack> context) -> tpStudio(context.getSource())));
root.then(Commands.literal("status")
.executes((CommandContext<CommandSourceStack> context) -> status(context.getSource())));
root.then(workspaceTree("vscode", true));
root.then(workspaceTree("vsc", true));
root.then(workspaceTree("update", false));
root.then(workspaceTree("vscode"));
root.then(workspaceTree("vsc"));
root.then(Commands.literal("update")
.executes((CommandContext<CommandSourceStack> context) -> updateModules(context.getSource(), null))
.then(Commands.argument("pack", StringArgumentType.word()).suggests(IrisModdedCommands.PACK_NAMES)
.executes((CommandContext<CommandSourceStack> context) -> updateModules(context.getSource(), StringArgumentType.getString(context, "pack")))));
root.then(message("importvanilla", "Vanilla tree/object/structure capture generates features in throwaway Bukkit worlds via NMS; run /iris studio importvanilla on a Bukkit server against this pack, then copy the pack folder over."));
root.then(message("importv", "Vanilla tree/object/structure capture generates features in throwaway Bukkit worlds via NMS; run /iris studio importvanilla on a Bukkit server against this pack, then copy the pack folder over."));
root.then(message("iv", "Vanilla tree/object/structure capture generates features in throwaway Bukkit worlds via NMS; run /iris studio importvanilla on a Bukkit server against this pack, then copy the pack folder over."));
@@ -242,30 +246,36 @@ public final class ModdedStudioCommands {
return 1;
}
private static LiteralArgumentBuilder<CommandSourceStack> workspaceTree(String name, boolean open) {
return Commands.literal(name)
.executes((CommandContext<CommandSourceStack> context) -> workspace(context.getSource(), null, open))
.then(Commands.argument("pack", StringArgumentType.word()).suggests(IrisModdedCommands.PACK_NAMES)
.executes((CommandContext<CommandSourceStack> context) -> workspace(context.getSource(), StringArgumentType.getString(context, "pack"), open)));
private static int updateModules(CommandSourceStack source, String pack) {
File folder = resolvePack(source, pack);
if (folder == null) {
return 0;
}
KeptModuleUpdates.takeForPack(IrisData.get(folder)).forEach(line -> IrisModdedCommands.ok(source, IrisLogging.clean(line)));
return 1;
}
private static int workspace(CommandSourceStack source, String pack, boolean open) {
private static LiteralArgumentBuilder<CommandSourceStack> workspaceTree(String name) {
return Commands.literal(name)
.executes((CommandContext<CommandSourceStack> context) -> openWorkspace(context.getSource(), null))
.then(Commands.argument("pack", StringArgumentType.word()).suggests(IrisModdedCommands.PACK_NAMES)
.executes((CommandContext<CommandSourceStack> context) -> openWorkspace(context.getSource(), StringArgumentType.getString(context, "pack"))));
}
private static int openWorkspace(CommandSourceStack source, String pack) {
File folder = resolvePack(source, pack);
if (folder == null) {
return 0;
}
File workspace;
try {
workspace = ModdedWorkspaceGenerator.writeWorkspace(IrisData.get(folder), folder, open);
workspace = ModdedWorkspaceGenerator.writeWorkspace(IrisData.get(folder), folder, true);
} catch (Throwable e) {
ModdedIrisLog.error("Iris workspace write failed for {}", folder, e);
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STUDIO_COMMANDS_FAILED_WRITE_WORKSPACE, MessageArgument.untrusted("value", folder.getAbsolutePath()), MessageArgument.untrusted("value2", String.valueOf(e.getMessage()))));
return 0;
}
IrisModdedCommands.ok(source, IrisLanguage.plain(ModdedCommandMessages.MODDED_STUDIO_COMMANDS_WORKSPACE_REGENERATED_WITH_JSON_SCHEMAS_AUTOCOMPLETE, MessageArgument.untrusted("value", workspace.getAbsolutePath())));
if (!open) {
return 1;
}
String unavailable = ModdedGuiHost.editorUnavailableReason();
if (unavailable != null) {
IrisModdedCommands.fail(source, IrisLanguage.plain(ModdedCommandMessages.IRIS_MODDED_COMMANDS_CANNOT_OPEN_FILES_HERE, MessageArgument.untrusted("value", unavailable)));