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

@@ -95,7 +95,7 @@ public class CommandPack implements DirectorExecutor {
persistValidationCache(packsRoot);
}
@Director(description = "Take the module updates a world kept because they change its terrain", descriptionKey = "iris.director.commandpack.director.take_kept_module_updates")
@Director(description = "Update the modules a world kept back", descriptionKey = "iris.director.commandpack.director.take_kept_module_updates")
public void update(
@Param(name = "world", description = "The Iris world whose modules to update", descriptionKey = "iris.director.commandpack.param.world_take_module_updates", contextual = true, contextualOverride = true)
World world
@@ -104,7 +104,7 @@ public class CommandPack implements DirectorExecutor {
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STUDIO_YOU_NEED_BE_SPECIFY_IRIS_GENERATED_WORLD));
return;
}
KeptModuleUpdates.take(IrisToolbelt.access(world).getEngine().getData()).forEach(sender()::sendMessage);
KeptModuleUpdates.takeForWorld(IrisToolbelt.access(world).getEngine().getData()).forEach(sender()::sendMessage);
}
@Director(description = "Preview or apply unused-resource cleanup", descriptionKey = "iris.director.commandpack.director.preview_apply_unused_resource_cleanup", aliases = {"c"})
@@ -23,6 +23,7 @@ import art.arcane.iris.platform.bukkit.BukkitPlatform;
import art.arcane.iris.core.IrisSettings;
import art.arcane.iris.core.gui.ImageMapStudioGUI;
import art.arcane.iris.core.loader.IrisData;
import art.arcane.iris.core.modules.KeptModuleUpdates;
import art.arcane.iris.core.modules.PackModulesListing;
import art.arcane.iris.core.localization.IrisMessages;
import art.arcane.iris.core.studio.bridge.StudioBridge;
@@ -30,7 +31,6 @@ import art.arcane.iris.core.studio.bridge.StudioBridges;
import art.arcane.iris.core.studio.bridge.StudioWindow;
import art.arcane.iris.core.pack.PackDownloader;
import art.arcane.iris.core.project.IrisProject;
import art.arcane.iris.core.project.IrisCodeWorkspace;
import art.arcane.iris.core.project.StudioEditor;
import art.arcane.iris.core.project.StudioEditorLauncher;
import art.arcane.iris.core.localization.RuntimeUiMessages;
@@ -684,17 +684,12 @@ public class CommandStudio implements DirectorExecutor {
});
}
@Director(description = "Update your dimension projects VSCode workspace", descriptionKey = "iris.director.commandstudio.director.update_your_dimension_projects_vscode_workspace")
@Director(description = "Update a pack's modules to the versions this Iris ships", descriptionKey = "iris.director.commandstudio.director.update_pack_modules")
public void update(
@Param(description = "The dimension to update the workspace of", descriptionKey = "iris.director.commandstudio.param.dimension_update_workspace", contextual = true, contextualOverride = true, defaultValue = "default", customHandler = DimensionHandler.class)
@Param(description = "The pack to update", descriptionKey = "iris.director.commandstudio.param.dimension_update_modules", contextual = true, contextualOverride = true, defaultValue = "default", customHandler = DimensionHandler.class)
IrisDimension dimension
) {
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STUDIO_UPDATING_CODE_WORKSPACE, MessageArgument.untrusted("value", dimension.getName())));
if (new IrisCodeWorkspace(new IrisProject(dimension.getLoader().getDataFolder())).updateWorkspace()) {
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STUDIO_UPDATED_CODE_WORKSPACE, MessageArgument.untrusted("value", dimension.getName())));
} else {
sender().sendMessage(IrisLanguage.text(BukkitCommandMessagesExtended.COMMAND_STUDIO_INVALID_PROJECT_TRY_DELETING_CODE_WORKSPACE_FILE_TRY_AGAIN, MessageArgument.untrusted("value", dimension.getName())));
}
KeptModuleUpdates.takeForPack(dimension.getLoader()).forEach(sender()::sendMessage);
}
@Director(aliases = "find-objects", description = "Capture an IGenData chunk report for nearby chunks", descriptionKey = "iris.director.commandstudio.director.capture_igendata_chunk_report_nearby_chunks", origin = DirectorOrigin.PLAYER)
@@ -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)));