Skip to content

Commit 74921e4

Browse files
committed
Merge branch 'master-split'
2 parents 44c8b35 + 145adaf commit 74921e4

24 files changed

+247
-158
lines changed

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2022 MCPHackers
3+
Copyright (c) 2025 MCPHackers
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RetroMCP-Java is a complete re-design of RetroMCP in Java.
66
# Using
77

88
Using RetroMCP-Java is simple!
9-
1. Download and install JDK 8. MCPHackers recommend [Azul Zulu](https://www.azul.com/downloads/?version=java-8-lts&package=jdk)
9+
1. Download and install JDK 8. MCPHackers recommend [Azul Zulu](https://www.azul.com/downloads/?version=java-8-lts&package=jdk).
1010
2. Run the latest [release](https://github.com/MCPHackers/RetroMCP-Java/releases) from the command line or via double click. If you run it via double click and RMCP errors, make sure your PATH
1111
and your JAR file associations are properly configured.
1212
> Be careful! Using "Open with" context menu on Windows will not use a proper directory, be sure to change the default .jar file associations

build.gradle

+38-81
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,56 @@
1-
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
2-
31
plugins {
4-
id 'application'
5-
id 'com.github.johnrengelman.shadow' version '7.1.2'
6-
}
7-
8-
repositories {
9-
mavenCentral()
10-
maven { url 'https://jitpack.io/' }
11-
maven { url 'https://maven.fabricmc.net/' }
12-
maven { url 'https://mcphackers.org/libraries/' }
13-
maven { url 'https://maven.glass-launcher.net/releases/'}
2+
id "java"
143
}
154

16-
configurations {
17-
shadow
18-
implementation.extendsFrom shadow
19-
}
5+
allprojects {
6+
apply plugin: "java"
207

21-
dependencies {
22-
runtimeOnly sourceSets.test.output
8+
repositories {
9+
mavenCentral()
10+
maven { url "https://jitpack.io/" }
11+
maven { url "https://maven.fabricmc.net/" }
12+
maven { url "https://mcphackers.org/libraries/" }
13+
maven { url "https://maven.glass-launcher.net/releases" }
14+
}
2315

24-
// Required libraries
25-
shadow "org.ow2.asm:asm:${project.asm_version}"
26-
shadow "org.ow2.asm:asm-analysis:${project.asm_version}"
27-
shadow "org.ow2.asm:asm-commons:${project.asm_version}"
28-
shadow "org.ow2.asm:asm-tree:${project.asm_version}"
29-
shadow "org.ow2.asm:asm-util:${project.asm_version}"
16+
dependencies {
17+
runtimeOnly sourceSets.test.output
3018

31-
shadow "com.github.MCPHackers.RetroDebugInjector:RetroDebugInjector-NIO:${project.rdi_version}"
32-
shadow "com.github.MCPHackers.RetroDebugInjector:RetroDebugInjector:${project.rdi_version}"
33-
shadow "io.github.lassebq:fernflower:${project.fernflower_version}"
34-
shadow "org.fusesource.jansi:jansi:${project.jansi_version}"
35-
shadow "org.json:json:${project.json_version}"
36-
shadow "com.github.MCPHackers:DiffPatch:${project.diffpatch_version}"
37-
shadow "net.fabricmc:mapping-io:${project.mapping_io_version}"
19+
// Required libraries
20+
implementation "org.ow2.asm:asm:${project.asm_version}"
21+
implementation "org.ow2.asm:asm-analysis:${project.asm_version}"
22+
implementation "org.ow2.asm:asm-commons:${project.asm_version}"
23+
implementation "org.ow2.asm:asm-tree:${project.asm_version}"
24+
implementation "org.ow2.asm:asm-util:${project.asm_version}"
3825

39-
shadow "com.formdev:flatlaf:${project.flatlaf_version}"
40-
}
26+
implementation "com.github.MCPHackers.RetroDebugInjector:rdi-nio:${project.rdi_version}"
27+
implementation "com.github.MCPHackers.RetroDebugInjector:rdi:${project.rdi_version}"
4128

42-
tasks.withType(JavaCompile).configureEach {
43-
it.options.encoding = "UTF-8"
29+
implementation "io.github.lassebq:fernflower:${project.fernflower_version}"
4430

45-
// Use release flag on Java 9+ instead of source & target flags
46-
// This makes the JDK read the boot classpath and use the proper
47-
// libraries to be compliant with Java 8 without issues
48-
if (JavaVersion.current().isJava9Compatible()) {
49-
it.options.release.set(8)
31+
implementation "org.json:json:${project.json_version}"
32+
implementation "com.github.MCPHackers:DiffPatch:${project.diffpatch_version}"
33+
implementation "org.apache.commons:commons-lang3:${project.apache_version}"
34+
implementation "net.fabricmc:mapping-io:${project.mapping_io_version}"
5035
}
51-
}
52-
53-
java {
54-
sourceCompatibility = JavaVersion.VERSION_1_8
55-
targetCompatibility = JavaVersion.VERSION_1_8
56-
}
57-
58-
application {
59-
// Redirect all execution into the testing folder
60-
mainClass = 'org.mcphackers.mcp.main.MainGUI'
61-
executableDir = 'test'
62-
mkdir(executableDir)
63-
}
64-
65-
run {
66-
workingDir 'test'
67-
}
6836

69-
runShadow {
70-
workingDir 'test'
71-
}
37+
tasks.withType(JavaCompile).configureEach {
38+
it.options.encoding = "UTF-8"
7239

73-
shadowJar {
74-
manifest {
75-
attributes 'Main-Class': 'org.mcphackers.mcp.main.MainGUI'
40+
// Use release flag on Java 9+ instead of source & target flags
41+
// This makes the JDK read the boot classpath and use the proper
42+
// libraries to be compliant with Java 8 without issues
43+
if (JavaVersion.current().isJava9Compatible()) {
44+
it.options.release.set(8)
45+
}
7646
}
77-
archiveClassifier = 'GUI'
7847

79-
configurations = [project.configurations.shadow]
80-
minimize {
81-
exclude(dependency('com.formdev:.*:.*'))
48+
java {
49+
sourceCompatibility = JavaVersion.VERSION_1_8
50+
targetCompatibility = JavaVersion.VERSION_1_8
8251
}
8352
}
8453

85-
tasks.register('jarCLI', ShadowJar) {
86-
manifest {
87-
attributes 'Main-Class': 'org.mcphackers.mcp.main.MainCLI'
88-
}
89-
archiveClassifier = 'CLI'
90-
from sourceSets.main.output
91-
configurations = [project.configurations.shadow]
92-
minimize()
93-
exclude('com/formdev/**/**')
94-
exclude('META-INF/versions/**/**')
95-
exclude('META-INF/**.RSA')
96-
exclude('META-INF/**.SF')
54+
subprojects {
55+
apply plugin: "application"
9756
}
98-
99-
jar.dependsOn(jarCLI)

cli/build.gradle

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
plugins {
2+
id "com.gradleup.shadow" version "8.3.1"
3+
}
4+
5+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
6+
7+
dependencies {
8+
implementation rootProject
9+
implementation "org.fusesource.jansi:jansi:${project.jansi_version}"
10+
}
11+
12+
application {
13+
mainClass = "org.mcphackers.mcp.main.MainCLI"
14+
executableDir = "test"
15+
mkdir(executableDir)
16+
}
17+
18+
run {
19+
workingDir 'test'
20+
}
21+
22+
runShadow {
23+
workingDir 'test'
24+
}
25+
26+
tasks.named("shadowJar", ShadowJar) {
27+
configurations = [project.configurations.compileClasspath]
28+
archiveBaseName.set("RetroMCP-CLI")
29+
archiveClassifier.set("all")
30+
setDestinationDirectory(rootProject.getLayout().getBuildDirectory().dir("libs"))
31+
minimize()
32+
}

src/main/java/org/mcphackers/mcp/main/MainCLI.java renamed to cli/src/main/java/org/mcphackers/mcp/main/MainCLI.java

+16-12
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ public MainCLI(String[] args) {
7979
log(new Ansi().fgBrightRed().a("Error: Java Development Kit is required to recompile!").toString());
8080
log("Using Java from " + Paths.get(Util.getJava()).toAbsolutePath());
8181
}
82+
if (Util.getJavaVersion() > 8) {
83+
warning("WARNING: JDK " + Util.getJavaVersion() + " is being used! Java 8 is recommended.");
84+
}
8285
if (version != null) log(version);
8386
log(new Ansi().fgDefault().a("Enter a command to execute:").toString());
8487
}
@@ -147,16 +150,9 @@ public MainCLI(String[] args) {
147150
helpCommand = null;
148151
executeTimes++;
149152
}
150-
if (Util.getJavaVersion() > 8) {
151-
log("WARNING: JDK " + Util.getJavaVersion() + " is being used! Java 8 is recommended.");
152-
}
153153
}
154154

155155
public static void main(String[] args) {
156-
if (args.length != 0) {
157-
new MainCLI(args);
158-
return;
159-
}
160156
AnsiConsole.systemInstall();
161157
new MainCLI(args);
162158
}
@@ -245,6 +241,9 @@ private void setParams(Map<String, Object> parsedArgs, TaskMode mode) {
245241
case "server":
246242
side = Side.SERVER;
247243
break;
244+
case "merged":
245+
side = Side.MERGED;
246+
break;
248247
}
249248
if (mode == TaskMode.HELP) {
250249
for (TaskMode taskMode : TaskMode.registeredTasks) {
@@ -283,6 +282,16 @@ public void log(String msg) {
283282
System.out.println(msg);
284283
}
285284

285+
@Override
286+
public void warning(String msg) {
287+
System.out.println(Ansi.ansi().fgYellow().a(msg).fgDefault());
288+
}
289+
290+
@Override
291+
public void error(String msg) {
292+
System.out.println(Ansi.ansi().fgRed().a(msg).fgDefault());
293+
}
294+
286295
@Override
287296
public boolean yesNoInput(String title, String msg) {
288297
log(msg);
@@ -385,11 +394,6 @@ public void clearProgressBars() {
385394
progressBarNames = new String[0];
386395
}
387396

388-
@Override
389-
public Path getWorkingDir() {
390-
return Paths.get("");
391-
}
392-
393397
@Override
394398
public boolean updateDialogue(String changelog, String version) {
395399
return yesNoInput("New version found: " + version, changelog + "\n\nAre you sure you want to update?");

gradle.properties

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
asm_version=9.7
1+
asm_version=9.7.1
22
fernflower_version=1.0.0
3-
rdi_version=30164e1
3+
rdi_version=c9cbed5
44
jansi_version=2.4.1
55
json_version=20240303
66
diffpatch_version=cde1224
7+
apache_version=3.12.0
78
mapping_io_version=0.6.1
8-
flatlaf_version=3.5
9+
flatlaf_version=3.5.4

gui/build.gradle

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
plugins {
2+
id "com.gradleup.shadow" version "8.3.1"
3+
}
4+
5+
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
6+
7+
dependencies {
8+
implementation rootProject
9+
10+
implementation "com.formdev:flatlaf:${project.flatlaf_version}"
11+
}
12+
13+
application {
14+
mainClass = "org.mcphackers.mcp.main.MainGUI"
15+
executableDir = "test"
16+
mkdir(executableDir)
17+
}
18+
19+
run {
20+
workingDir "test"
21+
}
22+
23+
runShadow {
24+
workingDir "test"
25+
}
26+
27+
tasks.named("shadowJar", ShadowJar) {
28+
configurations = [project.configurations.compileClasspath]
29+
archiveBaseName.set("RetroMCP-GUI")
30+
archiveClassifier.set("all")
31+
setDestinationDirectory(rootProject.getLayout().getBuildDirectory().dir("libs"))
32+
minimize()
33+
}

src/main/java/org/mcphackers/mcp/gui/MCPFrame.java renamed to gui/src/main/java/org/mcphackers/mcp/gui/MCPFrame.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import org.mcphackers.mcp.MCP;
44
import org.mcphackers.mcp.MCPPaths;
5+
import org.mcphackers.mcp.Theme;
56
import org.mcphackers.mcp.main.MainGUI;
67
import org.mcphackers.mcp.tasks.Task;
78
import org.mcphackers.mcp.tasks.Task.Side;
@@ -184,7 +185,7 @@ public void popupMenuCanceled(PopupMenuEvent e) {
184185
});
185186
SwingUtilities.invokeLater(() -> {
186187
if (mcp.options.theme != null) {
187-
mcp.changeTheme(mcp.options.theme);
188+
mcp.changeTheme(Theme.THEMES_MAP.get(mcp.options.theme));
188189

189190
topRightContainer.updateUI();
190191
revalidate();

src/main/java/org/mcphackers/mcp/gui/MenuBar.java renamed to gui/src/main/java/org/mcphackers/mcp/gui/MenuBar.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ protected MenuBar(MCPFrame frame) {
149149
themeItem.setSelected(true);
150150
mcp.options.save();
151151
});
152-
if (theme.equals(MainGUI.THEME)) {
152+
if (theme.equals(this.mcp.theme)) {
153153
themeItem.setSelected(true);
154154
}
155155
themeItems[i] = themeItem;

0 commit comments

Comments
 (0)