add check

This commit is contained in:
wagyourtail 2021-07-06 15:59:06 -06:00
parent 2e98eee7e0
commit de42109771
No known key found for this signature in database
GPG Key ID: E6E3EB7DCD4EB017
1 changed files with 1 additions and 1 deletions

View File

@ -89,7 +89,6 @@ public class ProguardTask extends BaritoneGradleTask {
private void copyMcJar() throws IOException { private void copyMcJar() throws IOException {
File mcClientJar = this.getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("launch").getRuntimeClasspath().getFiles() File mcClientJar = this.getProject().getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().findByName("launch").getRuntimeClasspath().getFiles()
.stream() .stream()
//this line will change when using official mappings in 1.17
.filter(f -> f.getName().startsWith("minecraft-")) .filter(f -> f.getName().startsWith("minecraft-"))
.map(f -> { .map(f -> {
switch (compType) { switch (compType) {
@ -104,6 +103,7 @@ public class ProguardTask extends BaritoneGradleTask {
}) })
.findFirst() .findFirst()
.get(); .get();
if (!mcClientJar.exists()) throw new IOException("Failed to find minecraft! " + mcClientJar.getAbsolutePath());
if (!copyMcTargetDir.exists() && !copyMcTargetDir.mkdirs()) throw new IOException("Failed to create target for copyMcJar"); if (!copyMcTargetDir.exists() && !copyMcTargetDir.mkdirs()) throw new IOException("Failed to create target for copyMcJar");
Files.copy(mcClientJar.toPath(), copyMcTargetJar.toPath(), REPLACE_EXISTING); Files.copy(mcClientJar.toPath(), copyMcTargetJar.toPath(), REPLACE_EXISTING);
} }