Skip to content

Commit 8fe6308

Browse files
committed
Important fixes for versions with no server
1 parent 9261757 commit 8fe6308

4 files changed

Lines changed: 28 additions & 20 deletions

File tree

src/main/java/org/mcphackers/mcp/MCP.java

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ public static void main(String[] args) {
3636
input = new Scanner(System.in);
3737
logger.log("Operating system: " + System.getProperty("os.name"));
3838
logger.log("RetroMCP " + VERSION);
39-
40-
if(Files.exists(Paths.get(MCPConfig.VERSION)))
41-
{
42-
try {
43-
VersionsParser.setCurrentVersion(new String(Files.readAllBytes(Paths.get(MCPConfig.VERSION))));
44-
} catch (Exception e) {
45-
logger.info(new Ansi().fgBrightRed().a("Unable to get current version!").fgDefault().toString());
46-
}
47-
}
4839

4940
boolean startedWithNoParams = false;
5041
boolean exit = false;
@@ -54,6 +45,11 @@ public static void main(String[] args) {
5445
logger.println(logo);
5546
}
5647
if(Files.exists(Paths.get(MCPConfig.VERSION))) {
48+
try {
49+
VersionsParser.setCurrentVersion(new String(Files.readAllBytes(Paths.get(MCPConfig.VERSION))));
50+
} catch (Exception e) {
51+
logger.info(new Ansi().fgBrightRed().a("Unable to get current version!").fgDefault().toString());
52+
}
5753
logger.info(new Ansi().a("Current version: ").fgBrightCyan().a(VersionsParser.getCurrentVersion()).fgDefault().toString());
5854
}
5955
if (args.length <= 0) {

src/main/java/org/mcphackers/mcp/tasks/TaskDecompile.java

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,24 +71,35 @@ public void doTask() throws Exception {
7171
for (Path path : new Path[] { Paths.get(tinyOut), Paths.get(excOut), Paths.get(srcZip)}) {
7272
Files.deleteIfExists(path);
7373
}
74+
FileUtil.createDirectories(Paths.get(MCPConfig.TEMP));
7475
FileUtil.deleteDirectoryIfExists(ffOut);
7576
while(step < STEPS) {
7677
step();
7778
switch (step) {
7879
case REMAP:
79-
TinyRemapper remapper = null;
80-
81-
try (OutputConsumerPath outputConsumer = new OutputConsumerPath.Builder(Paths.get(tinyOut)).build()) {
82-
remapper = remap(TinyUtils.createTinyMappingProvider(mappings, "official", "named"), originalJar, outputConsumer, getLibraryPaths(side));
83-
outputConsumer.addNonClassFiles(originalJar, NonClassCopyMode.FIX_META_INF, remapper);
84-
} finally {
85-
if (remapper != null) {
86-
remapper.finish();
87-
}
88-
}
80+
if (Files.exists(mappings)) {
81+
TinyRemapper remapper = null;
82+
83+
try (OutputConsumerPath outputConsumer = new OutputConsumerPath.Builder(Paths.get(tinyOut)).build()) {
84+
remapper = remap(TinyUtils.createTinyMappingProvider(mappings, "official", "named"), originalJar, outputConsumer, getLibraryPaths(side));
85+
outputConsumer.addNonClassFiles(originalJar, NonClassCopyMode.FIX_META_INF, remapper);
86+
} finally {
87+
if (remapper != null) {
88+
remapper.finish();
89+
}
90+
}
91+
}
92+
else {
93+
Files.copy(originalJar, Paths.get(tinyOut));
94+
}
8995
break;
9096
case EXCEPTOR:
91-
MCInjector.process(tinyOut, excOut, exc, 0);
97+
if (Files.exists(Paths.get(exc))) {
98+
MCInjector.process(tinyOut, excOut, exc, 0);
99+
}
100+
else {
101+
Files.copy(Paths.get(tinyOut), Paths.get(excOut));
102+
}
92103
// Copying a fixed jar to libs
93104
if(side == CLIENT) {
94105
Files.deleteIfExists(Paths.get(MCPConfig.CLIENT_FIXED));

src/main/java/org/mcphackers/mcp/tasks/TaskRecompile.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public void recompile(JavaCompiler compiler, DiagnosticCollector<JavaFileObject>
105105
diagnostic.getSource().getName(),
106106
diagnostic.getMessage(null)));
107107
}
108+
mgr.close();
108109
if (!success) {
109110
throw new RuntimeException("Compilation error!");
110111
}

src/main/resources/0.tree

730 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)