Skip to content

Commit

Permalink
Merge remote-tracking branch 'official/main' into prs-base
Browse files Browse the repository at this point in the history
  • Loading branch information
burningtnt committed Jan 24, 2025
2 parents f6596a8 + f972c49 commit 4cbdc60
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ public void execute() {
/* overrideJavaArgs */ true,
/* overrideConsole */ true,
/* overrideCommands */ true,
/* overrideWindow */ true
/* overrideWindow */ true,
/* iconKey */ null // TODO
), modpackFile);
}

Expand Down
9 changes: 9 additions & 0 deletions HMCL/src/main/resources/assets/HMCLauncher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ case "$_HMCL_ARCH" in
exec "$_HMCL_DIR/jre-arm32/bin/$_HMCL_JAVA_EXE_NAME" $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
fi
;;
riscv64)
if [ -x "$_HMCL_DIR/jre-riscv64/bin/$_HMCL_JAVA_EXE_NAME" ]; then
exec "$_HMCL_DIR/jre-riscv64/bin/$_HMCL_JAVA_EXE_NAME" $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
fi
;;
loongarch64)
if [ -x "$_HMCL_DIR/jre-loongarch64/bin/$_HMCL_JAVA_EXE_NAME" ]; then
exec "$_HMCL_DIR/jre-loongarch64/bin/$_HMCL_JAVA_EXE_NAME" $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
Expand All @@ -141,6 +146,10 @@ if [ -x "$(command -v $_HMCL_JAVA_EXE_NAME)" ]; then
exec $_HMCL_JAVA_EXE_NAME $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
fi

if [ "$_HMCL_OS" == "freebsd" ] && [ -x "$(command -v javavm)" ]; then
exec javavm $_HMCL_VM_OPTIONS -jar "$_HMCL_PATH"
fi

# Java not found

if [ "$_HMCL_OS" == "osx" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public final class MultiMCInstanceConfiguration implements ModpackManifest {
private final boolean overrideConsole; // OverrideConsole
private final boolean overrideCommands; // OverrideCommands
private final boolean overrideWindow; // OverrideWindow
private final String iconKey;

private final MultiMCManifest mmcPack;

Expand Down Expand Up @@ -94,6 +95,7 @@ public final class MultiMCInstanceConfiguration implements ModpackManifest {
wrapperCommand = readValue(p, "WrapperCommand");
name = defaultName;
notes = Optional.ofNullable(readValue(p, "notes")).orElse("");
iconKey = readValue(p, "iconKey");
}

/**
Expand All @@ -112,7 +114,7 @@ private String readValue(Properties p, String key) {
return value;
}

public MultiMCInstanceConfiguration(String instanceType, String name, String gameVersion, Integer permGen, String wrapperCommand, String preLaunchCommand, String postExitCommand, String notes, String javaPath, String jvmArgs, boolean fullscreen, Integer width, Integer height, Integer maxMemory, Integer minMemory, boolean showConsole, boolean showConsoleOnError, boolean autoCloseConsole, boolean overrideMemory, boolean overrideJavaLocation, boolean overrideJavaArgs, boolean overrideConsole, boolean overrideCommands, boolean overrideWindow) {
public MultiMCInstanceConfiguration(String instanceType, String name, String gameVersion, Integer permGen, String wrapperCommand, String preLaunchCommand, String postExitCommand, String notes, String javaPath, String jvmArgs, boolean fullscreen, Integer width, Integer height, Integer maxMemory, Integer minMemory, boolean showConsole, boolean showConsoleOnError, boolean autoCloseConsole, boolean overrideMemory, boolean overrideJavaLocation, boolean overrideJavaArgs, boolean overrideConsole, boolean overrideCommands, boolean overrideWindow, String iconKey) {
this.instanceType = instanceType;
this.name = name;
this.gameVersion = gameVersion;
Expand All @@ -138,6 +140,7 @@ public MultiMCInstanceConfiguration(String instanceType, String name, String gam
this.overrideCommands = overrideCommands;
this.overrideWindow = overrideWindow;
this.mmcPack = null;
this.iconKey = iconKey;
}

public String getInstanceType() {
Expand Down Expand Up @@ -310,6 +313,10 @@ public boolean isOverrideWindow() {
return overrideWindow;
}

public String getIconKey() {
return iconKey;
}

public Properties toProperties() {
Properties p = new Properties();
if (instanceType != null) p.setProperty("InstanceType", instanceType);
Expand All @@ -336,6 +343,7 @@ public Properties toProperties() {
if (wrapperCommand != null) p.setProperty("WrapperCommand", wrapperCommand);
if (name != null) p.setProperty("name", name);
if (notes != null) p.setProperty("notes", notes);
if (iconKey != null) p.setProperty("iconKey", iconKey);
return p;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ public void execute() throws Exception {
Path jarmods = root.resolve("jarmods");
if (Files.exists(jarmods))
FileUtils.copyDirectory(jarmods, repository.getVersionRoot(name).toPath().resolve("jarmods"));

String iconKey = this.manifest.getIconKey();
if (iconKey != null) {
Path iconFile = root.resolve(iconKey + ".png");
if (Files.exists(iconFile)) {
FileUtils.copyFile(iconFile, repository.getVersionRoot(name).toPath().resolve("icon.png"));
}
}
}

dependencies.add(repository.saveAsync(version));
Expand Down

0 comments on commit 4cbdc60

Please sign in to comment.