Added Feature from issue 762 (#803)

* Added Feature from issue 762

* Changelog

* Spelling

* Done

* Update CHANGELOG.md

* Implemented Changes
This commit is contained in:
Red-S2 2023-08-18 08:16:35 +02:00 committed by GitHub
parent 3ea69265b8
commit b9e6fc2382
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 36 additions and 9 deletions

View file

@ -6,6 +6,8 @@ This changelog only contains the changes that are unreleased. For changes for in
## 3.4.31.3
### New Features
- New open resources button to visit minecraft.jar for modding purposes
- Servers will now be started using kitty, allacritty or gnome-terminal, if x-terminal-emulator or exo-open aren't present
- Support NeoForge loader for Modrinth and MultiMC import
@ -13,4 +15,4 @@ This changelog only contains the changes that are unreleased. For changes for in
### Misc
- Organize ViewModels
- Rename "Vanilla Packs" to "Create Pack"
- Rename "Vanilla Packs" to "Create Pack"

Binary file not shown.

View file

@ -2,5 +2,6 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

16
gradlew vendored
View file

@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -133,10 +130,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@ -144,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -152,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -197,6 +197,10 @@ if "$cygwin" || "$msys" ; then
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in

View file

@ -85,9 +85,18 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
private final JButton editButton = new JButton(GetText.tr("Edit Mods"));
private final JButton serversButton = new JButton(GetText.tr("Servers"));
private final JButton openWebsite = new JButton(GetText.tr("Open Website"));
private final JButton openButton = new JButton(GetText.tr("Open Folder"));
private final JButton settingsButton = new JButton(GetText.tr("Settings"));
private final JPopupMenu openPopupMenu = new JPopupMenu();
private final JMenuItem openResourceMenuItem = new JMenuItem(GetText.tr("Open Resources"));
private final DropDownButton openButton = new DropDownButton(GetText.tr("Open Folder"), openPopupMenu, true,
new MouseAdapter() {
@Override
public void mousePressed(MouseEvent e) {
OS.openFileExplorer(instance.getRoot());
}
});
private final JPopupMenu playPopupMenu = new JPopupMenu();
private final JMenuItem playOnlinePlayMenuItem = new JMenuItem(GetText.tr("Play Online"));
private final JMenuItem playOfflinePlayMenuItem = new JMenuItem(GetText.tr("Play Offline"));
@ -203,6 +212,7 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
bottom.add(this.getHelpButton);
setupPlayPopupMenus();
setupOpenPopupMenus();
setupButtonPopupMenus();
// check it can be exported
@ -270,6 +280,16 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
playPopupMenu.add(playOfflinePlayMenuItem);
}
private void setupOpenPopupMenus() {
openResourceMenuItem.addActionListener(e -> {
DialogManager.okDialog().setTitle(GetText.tr("Reminder"))
.setContent(GetText.tr("You may not distribute ANY resources."))
.setType(DialogManager.WARNING).show();
OS.openFileExplorer(instance.getMinecraftJarLibraryPath());
});
openPopupMenu.add(openResourceMenuItem);
}
private void setupButtonPopupMenus() {
if (instance.showGetHelpButton()) {
if (instance.getDiscordInviteUrl() != null) {
@ -501,7 +521,6 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
String.format("%s/%s?utm_source=launcher&utm_medium=button&utm_campaign=instance_v2_button",
Constants.SERVERS_LIST_PACK, instance.getSafePackName())));
this.openWebsite.addActionListener(e -> OS.openWebBrowser(instance.getWebsiteUrl()));
this.openButton.addActionListener(e -> OS.openFileExplorer(instance.getRoot()));
this.settingsButton.addActionListener(e -> {
Analytics.trackEvent(AnalyticsEvent.forInstanceEvent("instance_settings", instance));
new InstanceSettingsDialog(instance);
@ -716,6 +735,7 @@ public class InstanceCard extends CollapsiblePanel implements RelocalizationList
this.serversButton.setText(GetText.tr("Servers"));
this.openWebsite.setText(GetText.tr("Open Website"));
this.openButton.setText(GetText.tr("Open Folder"));
this.openResourceMenuItem.setText(GetText.tr("Open Resources"));
this.settingsButton.setText(GetText.tr("Settings"));
this.normalBackupMenuItem.setText(GetText.tr("Normal Backup"));