Skip to content

Commit a378237

Browse files
committed
Enhance configuration dialog with improved button text, detailed instructions, and better layout; allow resizing and add confirmation prompts for extraction
1 parent f21a8e9 commit a378237

File tree

3 files changed

+102
-40
lines changed

3 files changed

+102
-40
lines changed
Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.kd_gaming1;
22

33
import com.kd_gaming1.commands.PackCoreCommands;
4+
import com.kd_gaming1.config.ModConfig;
45
import com.kd_gaming1.screen.SEMainMenu;
56
import net.fabricmc.api.ModInitializer;
67
import net.fabricmc.fabric.api.client.screen.v1.ScreenEvents;
@@ -16,13 +17,16 @@ public class PackCore implements ModInitializer {
1617
public void onInitialize() {
1718
PackCoreCommands.registerCommands();
1819

19-
// Register screen event to replace the main menu after initialization
20-
ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> {
21-
// Check if the screen being opened is the vanilla main menu
22-
if (screen instanceof TitleScreen) {
23-
// Replace it with your custom menu on the next tick
24-
client.execute(() -> client.setScreen(new SEMainMenu()));
25-
}
26-
});
20+
// Check if the Custom Menu is enabled
21+
if (ModConfig.getEnableCustomMenu()) {
22+
// Register screen event to replace the main menu after initialization
23+
ScreenEvents.AFTER_INIT.register((client, screen, scaledWidth, scaledHeight) -> {
24+
// Check if the screen being opened is the vanilla main menu
25+
if (screen instanceof TitleScreen) {
26+
// Replace it with your custom menu on the next tick
27+
client.execute(() -> client.setScreen(new SEMainMenu()));
28+
}
29+
});
30+
}
2731
}
2832
}

src/main/java/com/kd_gaming1/copysystem/ConfigSelectionDialog.java

Lines changed: 90 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,14 @@ private void initializeComponents() {
6666
progressBar.setString("Ready");
6767
progressBar.setVisible(false);
6868

69-
// Create buttons
70-
extractButton = new JButton("Extract Selected Config");
71-
skipButton = new JButton("Skip & Use Current Settings");
69+
// Create buttons with more descriptive text
70+
extractButton = new JButton("📦 Extract & Apply Selected Configuration");
71+
skipButton = new JButton("⏭️ Skip & Continue with Current Settings");
72+
73+
// Make buttons a bit larger to accommodate the longer text
74+
Dimension buttonSize = new Dimension(280, 35);
75+
extractButton.setPreferredSize(buttonSize);
76+
skipButton.setPreferredSize(buttonSize);
7277
}
7378

7479
private void layoutComponents() {
@@ -88,30 +93,61 @@ private void layoutComponents() {
8893

8994
pack();
9095
setLocationRelativeTo(null);
91-
setResizable(false);
96+
setResizable(true); // Allow resizing since we have more content now
97+
setMinimumSize(new Dimension(700, 600)); // Set minimum size
9298
}
9399

94100
private JPanel createHeaderPanel() {
95101
JPanel panel = new JPanel(new BorderLayout());
96102
panel.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));
97103

98-
JLabel titleLabel = new JLabel("<html><h2>PackCore Configuration Setup</h2></html>");
104+
JLabel titleLabel = new JLabel("<html><h2>PackCore Configuration Management</h2></html>");
99105
titleLabel.setHorizontalAlignment(SwingConstants.CENTER);
100106

101107
JTextArea instructionsArea = new JTextArea(
102-
"Choose a configuration to apply to Minecraft, or skip to use current settings.\n" +
103-
"Official configs are pre-made configurations, while custom configs are user-created.\n" +
104-
"After making your selection, please be patient as Minecraft loads."
108+
"Welcome to PackCore! This dialog helps you manage your Minecraft mod configurations before the game starts.\n\n" +
109+
110+
"📦 CONFIGURATION TYPES:\n" +
111+
"• Official Configs: Pre-made configurations that come with your modpack. These are tested setups " +
112+
"created by the modpack authors to provide specific gameplay experiences or performance optimizations.\n" +
113+
"• Custom Configs: Your personal configurations or ones shared by other players. These contain " +
114+
"customized mod settings that you or others have fine-tuned for specific preferences.\n\n" +
115+
116+
"🎯 WHAT HAPPENS WHEN YOU:\n" +
117+
"• Extract: The selected configuration will overwrite your current mod settings. All config files " +
118+
"from the chosen archive will be applied to your Minecraft installation, giving you that specific setup.\n" +
119+
"• Skip: Minecraft will start with whatever settings are currently in place (either default settings " +
120+
"or previously applied configurations). No changes will be made.\n\n" +
121+
122+
"⚠️ IMPORTANT NOTES:\n" +
123+
"• Extracting will REPLACE your current mod configurations - make a backup first if you want to keep them!\n" +
124+
"• After clicking Extract or Skip, please be patient! Minecraft may take 10-60 seconds to appear.\n" +
125+
"• The game is loading in the background even if nothing appears to happen immediately.\n\n" +
126+
127+
"🔧 MANAGING CONFIGURATIONS:\n" +
128+
"• Create your own backup: Use '/packcore archive' in-game to save your current settings\n" +
129+
"• Share with friends: Custom config archives can be shared and imported by other players\n" +
130+
"• Disable this dialog: Use '/packcore dialog false' if you don't want to see this anymore\n" +
131+
"• Re-enable later: Use '/packcore dialog true' to bring this dialog back\n" +
132+
"• Get help: Use '/packcore help' to see all available commands and options"
105133
);
134+
106135
instructionsArea.setEditable(false);
107136
instructionsArea.setOpaque(false);
108137
instructionsArea.setWrapStyleWord(true);
109138
instructionsArea.setLineWrap(true);
110-
instructionsArea.setFont(instructionsArea.getFont().deriveFont(12f));
139+
instructionsArea.setFont(instructionsArea.getFont().deriveFont(11f));
140+
instructionsArea.setBackground(panel.getBackground());
141+
142+
// Create a scrollable text area for the instructions since they're longer now
143+
JScrollPane instructionsScroll = new JScrollPane(instructionsArea);
144+
instructionsScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
145+
instructionsScroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
146+
instructionsScroll.setPreferredSize(new Dimension(600, 200));
111147

112148
panel.add(titleLabel, BorderLayout.NORTH);
113149
panel.add(Box.createVerticalStrut(10), BorderLayout.CENTER);
114-
panel.add(instructionsArea, BorderLayout.SOUTH);
150+
panel.add(instructionsScroll, BorderLayout.SOUTH);
115151

116152
return panel;
117153
}
@@ -123,12 +159,16 @@ private JPanel createCenterPanel() {
123159
// Official configs panel
124160
JPanel officialPanel = new JPanel(new BorderLayout());
125161
officialPanel.setBorder(BorderFactory.createTitledBorder("Official Configurations"));
126-
officialPanel.add(new JScrollPane(officialConfigList), BorderLayout.CENTER);
162+
JScrollPane officialScroll = new JScrollPane(officialConfigList);
163+
officialScroll.setPreferredSize(new Dimension(250, 150));
164+
officialPanel.add(officialScroll, BorderLayout.CENTER);
127165

128166
// Custom configs panel
129167
JPanel customPanel = new JPanel(new BorderLayout());
130168
customPanel.setBorder(BorderFactory.createTitledBorder("Custom Configurations"));
131-
customPanel.add(new JScrollPane(customConfigList), BorderLayout.CENTER);
169+
JScrollPane customScroll = new JScrollPane(customConfigList);
170+
customScroll.setPreferredSize(new Dimension(250, 150));
171+
customPanel.add(customScroll, BorderLayout.CENTER);
132172

133173
panel.add(officialPanel);
134174
panel.add(customPanel);
@@ -179,17 +219,33 @@ private void handleExtraction() {
179219

180220
if (selectedConfig == null) {
181221
JOptionPane.showMessageDialog(this,
182-
"Please select a configuration to extract.",
183-
"No Selection",
222+
"Please select a configuration from either the Official or Custom list to extract.\n\n" +
223+
"Tip: Official configs are pre-made setups, while Custom configs are personalized configurations.",
224+
"No Configuration Selected",
184225
JOptionPane.WARNING_MESSAGE);
185226
return;
186227
}
187228

229+
// Show confirmation dialog with more details
230+
String configTypeText = configType == ConfigType.OFFICIAL ? "Official" : "Custom";
231+
int confirm = JOptionPane.showConfirmDialog(this,
232+
"Are you sure you want to extract the " + configTypeText.toLowerCase() + " configuration:\n" +
233+
"\"" + selectedConfig.getDisplayName() + "\"?\n\n" +
234+
"This will replace your current mod settings with the settings from this configuration.\n" +
235+
"Make sure you've backed up any important configurations before proceeding!",
236+
"Confirm Configuration Extraction",
237+
JOptionPane.YES_NO_OPTION,
238+
JOptionPane.QUESTION_MESSAGE);
239+
240+
if (confirm != JOptionPane.YES_OPTION) {
241+
return;
242+
}
243+
188244
// Disable buttons and show progress
189245
setControlsEnabled(false);
190246
progressBar.setVisible(true);
191247
progressBar.setIndeterminate(true);
192-
progressBar.setString("Extracting configuration...");
248+
progressBar.setString("Preparing to extract configuration files...");
193249

194250
// Perform extraction in background thread
195251
SwingWorker<Boolean, Void> worker = new SwingWorker<Boolean, Void>() {
@@ -199,7 +255,7 @@ protected Boolean doInBackground() {
199255
SwingUtilities.invokeLater(() -> {
200256
progressBar.setIndeterminate(false);
201257
progressBar.setValue(progress);
202-
progressBar.setString("Extracting... " + progress + "%");
258+
progressBar.setString("Extracting configuration files... " + progress + "%");
203259
});
204260
});
205261
}
@@ -224,13 +280,21 @@ private void handleExtractionComplete(boolean success, String configName) {
224280

225281
if (success) {
226282
JOptionPane.showMessageDialog(this,
227-
"Configuration '" + configName + "' extracted successfully!\nMinecraft will now continue loading.",
228-
"Extraction Complete",
283+
"✅ Configuration Successfully Applied!\n\n" +
284+
"The configuration '" + configName + "' has been extracted and applied to your Minecraft installation.\n" +
285+
"All mod settings from this configuration are now active.\n\n" +
286+
"Minecraft will continue loading shortly. Please be patient as this may take a moment.\n\n" +
287+
"Tip: You can create your own configuration backups using '/packcore archive' in-game.",
288+
"Configuration Extraction Complete",
229289
JOptionPane.INFORMATION_MESSAGE);
230290
dialogResult.set(true);
231291
} else {
232292
JOptionPane.showMessageDialog(this,
233-
"Failed to extract configuration '" + configName + "'.\nPlease check the logs for details.",
293+
"❌ Configuration Extraction Failed\n\n" +
294+
"Failed to extract and apply the configuration '" + configName + "'.\n" +
295+
"Your current settings remain unchanged.\n\n" +
296+
"Please check the game logs for detailed error information, or try selecting a different configuration.\n" +
297+
"If the problem persists, contact the modpack author or check the PackCore documentation.",
234298
"Extraction Failed",
235299
JOptionPane.ERROR_MESSAGE);
236300
setControlsEnabled(true);
@@ -242,7 +306,13 @@ private void handleExtractionComplete(boolean success, String configName) {
242306

243307
private void handleSkip() {
244308
int result = JOptionPane.showConfirmDialog(this,
245-
"Are you sure you want to skip configuration extraction?\nMinecraft will use the current settings.",
309+
"Skip Configuration Extraction?\n\n" +
310+
"Minecraft will start with your current mod settings. No configurations will be applied or changed.\n\n" +
311+
"You can always apply configurations later using:\n" +
312+
"• The main menu PackCore options\n" +
313+
"• The '/packcore' commands in-game\n" +
314+
"• Re-enabling this dialog with '/packcore dialog enabled/disabled'\n\n" +
315+
"Continue without applying any configurations?",
246316
"Confirm Skip",
247317
JOptionPane.YES_NO_OPTION,
248318
JOptionPane.QUESTION_MESSAGE);

src/main/java/com/kd_gaming1/copysystem/utils/ExtractionProgressListener.java

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)