Skip to content

Commit

Permalink
Default command for exporting last recording
Browse files Browse the repository at this point in the history
  • Loading branch information
skycatminepokie committed Sep 4, 2024
1 parent 034f774 commit 57726c4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.21+build.9
loader_version=0.15.11

# Mod Properties
mod_version=0.0.2+1.21
mod_version=0.0.3+1.21
maven_group=com.skycatdev.autocut
archives_base_name=autocut

Expand Down
12 changes: 11 additions & 1 deletion src/client/java/com/skycatdev/autocut/AutocutCommandHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
.executes(AutocutCommandHandler::makeClip) // WARN: Debug only
.build();
var finish = literal("finish")
.executes(AutocutCommandHandler::finish)
.build();
var finishDatabase = argument("database", StringArgumentType.string())
.executes(AutocutCommandHandler::finish) // WARN: Debug only
.executes(AutocutCommandHandler::finishDatabase)
.build();
//@formatter:off
dispatcher.getRoot().addChild(autocut);
Expand All @@ -97,6 +98,15 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
}

private static int finish(CommandContext<FabricClientCommandSource> context) {
try {
AutocutClient.currentRecordingManager.export();
} catch (SQLException e) {
throw new RuntimeException(e); // TODO: Error handling
}
return Command.SINGLE_SUCCESS;
}

private static int finishDatabase(CommandContext<FabricClientCommandSource> context) {
try {
RecordingManager recordingManager = RecordingManager.fromDatabase(new File(StringArgumentType.getString(context, "database")));
recordingManager.export();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ public void progress(Progress progress) {
}
});
job.run();
MinecraftClient.getInstance().inGameHud.getChatHud().addMessage(Text.of("Preparing to cut..."));
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 57726c4

Please sign in to comment.